LLVM API Documentation
#include "AMDGPU.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/LLVMContext.h"#include "llvm/IR/Function.h"#include "llvm/Support/Debug.h"#include "llvm/Target/TargetMachine.h"
Go to the source code of this file.
Namespaces | |
| namespace | llvm |
List of target independent CodeGen pass IDs. | |
Defines | |
| #define | DEBUG_TYPE "si-shrink-instructions" |
| The pass tries to use the 32-bit encoding for instructions when possible. | |
Functions | |
| STATISTIC (NumInstructionsShrunk,"Number of 64-bit instruction reduced to 32-bit.") | |
| STATISTIC (NumLiteralConstantsFolded,"Number of literal constants folded into 32-bit instructions.") | |
| void | llvm::initializeSIShrinkInstructionsPass (PassRegistry &) |
| INITIALIZE_PASS_BEGIN (SIShrinkInstructions, DEBUG_TYPE,"SI Lower il Copies", false, false) INITIALIZE_PASS_END(SIShrinkInstructions | |
| 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. This function assumes that MI is a VOP1, VOP2, or VOPC instruction and will only fold literal constants if we are still in SSA. | |
Variables | |
| DEBUG_TYPE | |
| SI Lower il | Copies |
| SI Lower il | false |
| #define DEBUG_TYPE "si-shrink-instructions" |
The pass tries to use the 32-bit encoding for instructions when possible.
Definition at line 25 of file SIShrinkInstructions.cpp.
| static bool canShrink | ( | MachineInstr & | MI, |
| const SIInstrInfo * | TII, | ||
| const SIRegisterInfo & | TRI, | ||
| const MachineRegisterInfo & | MRI | ||
| ) | [static] |
Definition at line 84 of file SIShrinkInstructions.cpp.
References llvm::MachineOperand::getImm(), llvm::SIInstrInfo::getNamedOperand(), and isVGPR().
| static void foldImmediates | ( | MachineInstr & | MI, |
| const SIInstrInfo * | TII, | ||
| MachineRegisterInfo & | MRI, | ||
| bool | TryToCommute = true |
||
| ) | [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 120 of file SIShrinkInstructions.cpp.
References llvm::APFloat::bitcastToAPInt(), llvm::MachineOperand::ChangeToImmediate(), llvm::SIInstrInfo::commuteInstruction(), llvm::tgtok::Def, llvm::MachineInstr::eraseFromParent(), llvm::MachineOperand::getFPImm(), llvm::MachineOperand::getImm(), llvm::SIInstrInfo::getNamedOperand(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), llvm::SIInstrInfo::getRegisterInfo(), llvm::APFloat::getSemantics(), llvm::MachineRegisterInfo::getUniqueVRegDef(), llvm::ConstantFP::getValueAPF(), llvm::APInt::getZExtValue(), llvm::APFloat::IEEEsingle, llvm::MachineInstr::isCommutable(), llvm::MachineOperand::isFPImm(), llvm::MachineOperand::isImm(), llvm::SIInstrInfo::isLiteralConstant(), llvm::MachineInstr::isMoveImmediate(), llvm::MachineOperand::isReg(), llvm::MachineRegisterInfo::isSSA(), llvm::isUInt< 32 >(), isVGPR(), llvm::SIInstrInfo::isVOP1(), llvm::SIInstrInfo::isVOP2(), llvm::SIInstrInfo::isVOPC(), llvm::MachineRegisterInfo::removeRegOperandFromUseList(), and llvm::MachineRegisterInfo::use_empty().
| INITIALIZE_PASS_BEGIN | ( | SIShrinkInstructions | , |
| DEBUG_TYPE | , | ||
| "SI Lower il Copies" | , | ||
| false | , | ||
| false | |||
| ) |
| static bool isVGPR | ( | const MachineOperand * | MO, |
| const SIRegisterInfo & | TRI, | ||
| const MachineRegisterInfo & | MRI | ||
| ) | [static] |
Definition at line 73 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(), and foldImmediates().
| STATISTIC | ( | NumInstructionsShrunk | , |
| "Number of 64-bit instruction reduced to 32-bit." | |||
| ) |
| STATISTIC | ( | NumLiteralConstantsFolded | , |
| "Number of literal constants folded into 32-bit instructions." | |||
| ) |
| SI Lower il Copies |
Definition at line 64 of file SIShrinkInstructions.cpp.
Definition at line 64 of file SIShrinkInstructions.cpp.
| SI Lower il false |
Definition at line 64 of file SIShrinkInstructions.cpp.