FunctionPass *createSIPropagateImmReadsPass(TargetMachine &tm);
FunctionPass *createSICodeEmitterPass(formatted_raw_ostream &OS);
- FunctionPass *createAMDGPUReorderPreloadInstructionsPass(TargetMachine &tm);
-
FunctionPass *createAMDGPULowerInstructionsPass(TargetMachine &tm);
FunctionPass *createAMDGPULowerShaderInstructionsPass(TargetMachine &tm);
}
}
-bool AMDGPUInstrInfo::isRegPreload(const MachineInstr &MI) const
-{
- return (get(MI.getOpcode()).TSFlags >> AMDGPU_TFLAG_SHIFTS::PRELOAD_REG) & 0x1;
-}
-
#include "AMDGPUInstrEnums.include"
virtual MachineInstr * convertToISA(MachineInstr & MI, MachineFunction &MF,
DebugLoc DL) const;
- bool isRegPreload(const MachineInstr &MI) const;
-
#include "AMDGPUInstrEnums.h.include"
};
} // End llvm namespace
-/* AMDGPU target flags are stored in bits 32-39 */
-namespace AMDGPU_TFLAG_SHIFTS {
- enum TFLAGS {
- PRELOAD_REG = 32
- };
-}
-
-
#endif // AMDGPUINSTRINFO_H_
class AMDGPUInst <dag outs, dag ins, string asm, list<dag> pattern> : Instruction {
field bits<16> AMDILOp = 0;
field bits<3> Gen = 0;
- field bit PreloadReg = 0;
let Namespace = "AMDIL";
let OutOperandList = outs;
let InOperandList = ins;
let AsmString = asm;
let Pattern = pattern;
- let TSFlags{32} = PreloadReg;
let TSFlags{42-40} = Gen;
let TSFlags{63-48} = AMDILOp;
}
(outs GPRF32:$dst),
(ins i32imm:$src),
"LOAD_INPUT $dst, $src",
- [] >{
- let PreloadReg = 1;
- }
+ [] >;
def MASK_WRITE : AMDGPUShaderInst <
(outs),
(outs GPRF32:$dst),
(ins i32imm:$src),
"RESERVE_REG $dst, $src",
- [(set GPRF32:$dst, (int_AMDGPU_reserve_reg imm:$src))]> {
- let PreloadReg = 1;
- }
+ [(set GPRF32:$dst, (int_AMDGPU_reserve_reg imm:$src))]
+ >;
def STORE_OUTPUT: AMDGPUShaderInst <
(outs GPRF32:$dst),
+++ /dev/null
-//===-- AMDGPUReorderPreloadInstructions.cpp - TODO: Add brief description -------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// TODO: Add full description
-//
-//===----------------------------------------------------------------------===//
-
-#include "AMDGPU.h"
-#include "AMDIL.h"
-#include "AMDILInstrInfo.h"
-#include "llvm/CodeGen/MachineFunctionPass.h"
-#include "llvm/CodeGen/MachineInstrBuilder.h"
-#include "llvm/CodeGen/MachineRegisterInfo.h"
-#include "llvm/Function.h"
-
-using namespace llvm;
-
-namespace {
- class AMDGPUReorderPreloadInstructionsPass : public MachineFunctionPass {
-
- private:
- static char ID;
- TargetMachine &TM;
-
- public:
- AMDGPUReorderPreloadInstructionsPass(TargetMachine &tm) :
- MachineFunctionPass(ID), TM(tm) { }
-
- bool runOnMachineFunction(MachineFunction &MF);
-
- const char *getPassName() const { return "AMDGPU Reorder Preload Instructions"; }
- };
-} /* End anonymous namespace */
-
-char AMDGPUReorderPreloadInstructionsPass::ID = 0;
-
-FunctionPass *llvm::createAMDGPUReorderPreloadInstructionsPass(TargetMachine &tm) {
- return new AMDGPUReorderPreloadInstructionsPass(tm);
-}
-
-/* This pass moves instructions that represent preloaded registers to the
- * start of the program. */
-bool AMDGPUReorderPreloadInstructionsPass::runOnMachineFunction(MachineFunction &MF)
-{
- const AMDGPUInstrInfo * TII =
- static_cast<const AMDGPUInstrInfo*>(TM.getInstrInfo());
-
- for (MachineFunction::iterator BB = MF.begin(), BB_E = MF.end();
- BB != BB_E; ++BB) {
- MachineBasicBlock &MBB = *BB;
- for (MachineBasicBlock::iterator I = MBB.begin(), Next = llvm::next(I);
- I != MBB.end(); I = Next, Next = llvm::next(I) ) {
- MachineInstr &MI = *I;
- if (TII->isRegPreload(MI)) {
- MF.front().insert(MF.front().begin(), MI.removeFromParent());
- }
- }
- }
- return false;
-}
bool AMDGPUPassConfig::addPreRegAlloc() {
const AMDILSubtarget &ST = TM->getSubtarget<AMDILSubtarget>();
- PM->add(createAMDGPUReorderPreloadInstructionsPass(*TM));
if (ST.device()->getGeneration() <= AMDILDeviceInfo::HD6XXX) {
PM->add(createR600LowerShaderInstructionsPass(*TM));
PM->add(createR600LowerInstructionsPass(*TM));
AMDGPUConvertToISA.cpp \
AMDGPULowerInstructions.cpp \
AMDGPULowerShaderInstructions.cpp \
- AMDGPUReorderPreloadInstructions.cpp \
AMDGPUInstrInfo.cpp \
AMDGPURegisterInfo.cpp \
AMDGPUUtil.cpp \
{
MF.dump();
TM = &MF.getTarget();
- const AMDGPUInstrInfo * TII =
- static_cast<const AMDGPUInstrInfo*>(TM->getInstrInfo());
emitState(MF);
for (MachineBasicBlock::iterator I = MBB.begin(), E = MBB.end();
I != E; ++I) {
MachineInstr &MI = *I;
- if (!TII->isRegPreload(MI) && MI.getOpcode() != AMDIL::KILL
- && MI.getOpcode() != AMDIL::RETURN) {
+ if (MI.getOpcode() != AMDIL::KILL && MI.getOpcode() != AMDIL::RETURN) {
emitInstr(MI);
}
}
> {
field bits<32> Inst = 0;
- let PreloadReg = 1;
}
def USE_SGPR_64 : InstSI <
> {
field bits<32> Inst = 0;
- let PreloadReg = 1;
}
def VS_LOAD_BUFFER_INDEX : InstSI <
[(set VReg_32:$dst, (int_SI_vs_load_buffer_index))]> {
field bits<32> Inst = 0;
- let PreloadReg = 1;
}
} // end usesCustomInserter