|
LLVM
7.0.0
|
#include "AMDGPU.h"#include "AMDGPUSubtarget.h"#include "SIInstrInfo.h"#include "MCTargetDesc/AMDGPUMCTargetDesc.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 | canShrink (MachineInstr &MI, const SIInstrInfo *TII, const SIRegisterInfo &TRI, const MachineRegisterInfo &MRI) |
| static bool | 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 67 of file SIShrinkInstructions.cpp.
References llvm::SIInstrInfo::getNamedOperand(), llvm::MachineInstr::getOpcode(), llvm::MachineOperand::getReg(), llvm::SIInstrInfo::hasModifiersSet(), llvm::MachineOperand::isReg(), and llvm::SIRegisterInfo::isVGPR().
Referenced by shrinkScalarCompare().
|
static |
Copy implicit register operands from specified instruction to this instruction that are not part of the instruction definition.
Definition at line 231 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(), llvm::MachineOperand::isImplicit(), llvm::MachineOperand::isReg(), and llvm::MachineOperand::isRegMask().
Referenced by shrinkScalarCompare().
|
static |
Definition at line 177 of file SIShrinkInstructions.cpp.
References llvm::MachineInstr::implicit_operands(), llvm::MachineOperand::isKill(), and llvm::MachineOperand::isUndef().
Referenced by shrinkScalarCompare().
|
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 instructions.
Definition at line 123 of file SIShrinkInstructions.cpp.
References assert(), llvm::tgtok::Def, llvm::MachineInstr::eraseFromParent(), llvm::MachineOperand::getImm(), llvm::MachineOperand::getIndex(), llvm::AMDGPU::getNamedOperandIdx(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::MachineRegisterInfo::getUniqueVRegDef(), llvm::MachineRegisterInfo::hasOneUse(), llvm::MachineInstr::isCommutable(), llvm::MachineOperand::isFI(), llvm::MachineOperand::isImm(), llvm::isInt< 32 >(), llvm::MachineInstr::isMoveImmediate(), llvm::isUInt< 32 >(), llvm::TargetRegisterInfo::isVirtualRegister(), llvm::SIInstrInfo::isVOP1(), llvm::SIInstrInfo::isVOP2(), llvm::SIInstrInfo::isVOPC(), Reg, llvm::MachineOperand::setSubReg(), and llvm::MachineRegisterInfo::use_empty().
Referenced by shrinkScalarCompare().
|
static |
Definition at line 189 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 201 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 195 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 219 of file SIShrinkInstructions.cpp.
References llvm::MachineOperand::getImm(), llvm::SIInstrInfo::isInlineConstant(), and llvm::isInt< 32 >().
Referenced by shrinkScalarCompare().
|
static |
Definition at line 243 of file SIShrinkInstructions.cpp.
References llvm::MachineInstrBuilder::add(), assert(), llvm::MachineBasicBlock::begin(), llvm::MachineFunction::begin(), llvm::BuildMI(), canShrink(), copyExtraImplicitOps(), copyFlagsToImplicitVCC(), llvm::dbgs(), llvm::MachineBasicBlock::end(), llvm::MachineFunction::end(), llvm::MachineInstr::eraseFromParent(), foldImmediates(), llvm::MDNode::get(), llvm::MachineInstr::getDebugLoc(), llvm::MachineFunction::getFunction(), llvm::MachineOperand::getImm(), llvm::GCNSubtarget::getInstrInfo(), llvm::AMDGPU::getNamedOperandIdx(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), llvm::MachineFunction::getRegInfo(), llvm::AMDGPU::getSOPKOp(), llvm::MachineFunction::getSubtarget(), llvm::AMDGPU::getVOPe32(), I, llvm::MachineInstr::isCommutable(), llvm::MachineInstr::isCompare(), llvm::MachineOperand::isImm(), isKImmOperand(), isKImmOrKUImmOperand(), isKUImmOperand(), llvm::TargetRegisterInfo::isPhysicalRegister(), llvm::MachineOperand::isReg(), isReverseInlineImm(), llvm::TargetRegisterInfo::isVirtualRegister(), LLVM_DEBUG, MI, MRI, llvm::MachineInstr::setDesc(), llvm::MachineOperand::setImm(), llvm::MachineRegisterInfo::setRegAllocationHint(), llvm::SIInstrInfo::sopkIsZext(), llvm::ARM_MB::ST, std::swap(), llvm::MachineInstr::tieOperands(), TII, and TRI.
| STATISTIC | ( | NumInstructionsShrunk | , |
| "Number of 64-bit instruction reduced to 32-bit." | |||
| ) |
| STATISTIC | ( | NumLiteralConstantsFolded | , |
| "Number of literal constants folded into 32-bit instructions." | |||
| ) |
1.8.13