|
LLVM
4.0.0
|
#include "AMDGPU.h"#include "AMDGPUMCInstLower.h"#include "AMDGPUSubtarget.h"#include "SIInstrInfo.h"#include "llvm/ADT/Statistic.h"#include "llvm/CodeGen/MachineFunctionPass.h"#include "llvm/CodeGen/MachineInstrBuilder.h"#include "llvm/CodeGen/MachineRegisterInfo.h"#include "llvm/IR/Constants.h"#include "llvm/IR/Function.h"#include "llvm/IR/LLVMContext.h"#include "llvm/Support/Debug.h"#include "llvm/Support/raw_ostream.h"#include "llvm/Target/TargetMachine.h"Go to the source code of this file.
Macros | |
| #define | DEBUG_TYPE "si-shrink-instructions" |
| The pass tries to use the 32-bit encoding for instructions when possible. More... | |
Functions | |
| STATISTIC (NumInstructionsShrunk,"Number of 64-bit instruction reduced to 32-bit.") | |
| STATISTIC (NumLiteralConstantsFolded,"Number of literal constants folded into 32-bit instructions.") | |
| static bool | isVGPR (const MachineOperand *MO, const SIRegisterInfo &TRI, const MachineRegisterInfo &MRI) |
| static bool | canShrink (MachineInstr &MI, const SIInstrInfo *TII, const SIRegisterInfo &TRI, const MachineRegisterInfo &MRI) |
| static void | foldImmediates (MachineInstr &MI, const SIInstrInfo *TII, MachineRegisterInfo &MRI, bool TryToCommute=true) |
This function checks MI for operands defined by a move immediate instruction and then folds the literal constant into the instruction if it can. More... | |
| static void | copyFlagsToImplicitVCC (MachineInstr &MI, const MachineOperand &Orig) |
| static bool | isKImmOperand (const SIInstrInfo *TII, const MachineOperand &Src) |
| static bool | isKUImmOperand (const SIInstrInfo *TII, const MachineOperand &Src) |
| static bool | isKImmOrKUImmOperand (const SIInstrInfo *TII, const MachineOperand &Src, bool &IsUnsigned) |
| static bool | isReverseInlineImm (const SIInstrInfo *TII, const MachineOperand &Src, int32_t &ReverseImm) |
| static void | copyExtraImplicitOps (MachineInstr &NewMI, MachineFunction &MF, const MachineInstr &MI) |
| Copy implicit register operands from specified instruction to this instruction that are not part of the instruction definition. More... | |
| static void | shrinkScalarCompare (const SIInstrInfo *TII, MachineInstr &MI) |
| #define DEBUG_TYPE "si-shrink-instructions" |
The pass tries to use the 32-bit encoding for instructions when possible.
Definition at line 27 of file SIShrinkInstructions.cpp.
|
static |
Definition at line 78 of file SIShrinkInstructions.cpp.
References llvm::MachineOperand::getImm(), llvm::SIInstrInfo::getNamedOperand(), llvm::MachineInstr::getOpcode(), llvm::SIInstrInfo::hasModifiersSet(), and isVGPR().
|
static |
Copy implicit register operands from specified instruction to this instruction that are not part of the instruction definition.
Definition at line 232 of file SIShrinkInstructions.cpp.
References llvm::MachineInstr::addOperand(), llvm::MachineInstr::getDesc(), llvm::MCInstrDesc::getNumImplicitDefs(), llvm::MCInstrDesc::getNumImplicitUses(), llvm::MCInstrDesc::getNumOperands(), llvm::MachineInstr::getNumOperands(), llvm::MachineInstr::getOperand(), i, llvm::MachineOperand::isImplicit(), llvm::MachineOperand::isReg(), and llvm::MachineOperand::isRegMask().
|
static |
Definition at line 178 of file SIShrinkInstructions.cpp.
References llvm::MachineInstr::implicit_operands(), llvm::MachineOperand::isKill(), and llvm::MachineOperand::isUndef().
|
static |
This function checks MI for operands defined by a move immediate instruction and then folds the literal constant into the instruction if it can.
This function assumes that MI is a VOP1, VOP2, or VOPC instruction and will only fold literal constants if we are still in SSA.
Definition at line 133 of file SIShrinkInstructions.cpp.
References assert(), llvm::MachineOperand::ChangeToImmediate(), llvm::tgtok::Def, llvm::MachineInstr::eraseFromParent(), llvm::MachineOperand::getImm(), llvm::AMDGPU::getNamedOperandIdx(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), llvm::MachineRegisterInfo::getUniqueVRegDef(), llvm::MachineRegisterInfo::hasOneUse(), llvm::MachineInstr::isCommutable(), llvm::MachineOperand::isImm(), llvm::isInt< 32 >(), llvm::SIInstrInfo::isLiteralConstant(), llvm::MachineInstr::isMoveImmediate(), llvm::MachineOperand::isReg(), llvm::MachineRegisterInfo::isSSA(), llvm::isUInt< 32 >(), llvm::SIInstrInfo::isVOP1(), llvm::SIInstrInfo::isVOP2(), llvm::SIInstrInfo::isVOPC(), and llvm::MachineRegisterInfo::use_empty().
|
static |
Definition at line 190 of file SIShrinkInstructions.cpp.
References llvm::MachineOperand::getImm(), llvm::MachineInstr::getOperandNo(), llvm::MachineOperand::getParent(), llvm::SIInstrInfo::isInlineConstant(), and llvm::isInt< 16 >().
Referenced by shrinkScalarCompare().
|
static |
Definition at line 202 of file SIShrinkInstructions.cpp.
References llvm::MachineOperand::getImm(), llvm::SIInstrInfo::isInlineConstant(), llvm::isInt< 16 >(), and llvm::isUInt< 16 >().
Referenced by shrinkScalarCompare().
|
static |
Definition at line 196 of file SIShrinkInstructions.cpp.
References llvm::MachineOperand::getImm(), llvm::MachineInstr::getOperandNo(), llvm::MachineOperand::getParent(), llvm::SIInstrInfo::isInlineConstant(), and llvm::isUInt< 16 >().
Referenced by shrinkScalarCompare().
|
static |
Src should be replaced with a bitreverse of an inline immediate. Definition at line 220 of file SIShrinkInstructions.cpp.
References llvm::MachineOperand::getImm(), llvm::SIInstrInfo::isInlineConstant(), and llvm::isInt< 32 >().
|
static |
Definition at line 67 of file SIShrinkInstructions.cpp.
References llvm::SIRegisterInfo::getPhysRegClass(), llvm::MachineOperand::getReg(), llvm::MachineRegisterInfo::getRegClass(), llvm::SIRegisterInfo::hasVGPRs(), llvm::MachineOperand::isReg(), and llvm::TargetRegisterInfo::isVirtualRegister().
Referenced by canShrink().
|
static |
Definition at line 244 of file SIShrinkInstructions.cpp.
References llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::AMDGPU::getSOPKOp(), llvm::MachineOperand::isImm(), isKImmOperand(), isKImmOrKUImmOperand(), isKUImmOperand(), llvm::MachineOperand::isReg(), llvm::MachineInstr::setDesc(), and llvm::SIInstrInfo::sopkIsZext().
| STATISTIC | ( | NumInstructionsShrunk | , |
| "Number of 64-bit instruction reduced to 32-bit." | |||
| ) |
| STATISTIC | ( | NumLiteralConstantsFolded | , |
| "Number of literal constants folded into 32-bit instructions." | |||
| ) |
1.8.6