summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/R600/AMDGPUInstrInfo.cpp
diff options
context:
space:
mode:
authorTom Stellard <thomas.stellard@amd.com>2013-10-22 18:19:10 +0000
committerTom Stellard <thomas.stellard@amd.com>2013-10-22 18:19:10 +0000
commit26a3b67b3b40eb58a8cf4c61d4047a3a3a258d71 (patch)
treea53d3edc09e74507c9646371e6b5567666a3a9ec /llvm/lib/Target/R600/AMDGPUInstrInfo.cpp
parentc460b0dcf1c53cdcff04ead35ca60cf785e01225 (diff)
downloadbcm5719-llvm-26a3b67b3b40eb58a8cf4c61d4047a3a3a258d71.tar.gz
bcm5719-llvm-26a3b67b3b40eb58a8cf4c61d4047a3a3a258d71.zip
R600: Simplify handling of private address space
The AMDGPUIndirectAddressing pass was previously responsible for lowering private loads and stores to indirect addressing instructions. However, this pass was buggy and way too complicated. The only advantage it had over the new simplified code was that it saved one instruction per direct write to private memory. This optimization likely has a minimal impact on performance, and we may be able to duplicate it using some other transformation. For the private address space, we now: 1. Lower private loads/store to Register(Load|Store) instructions 2. Reserve part of the register file as 'private memory' 3. After regalloc lower the Register(Load|Store) instructions to MOV instructions that use indirect addressing. llvm-svn: 193179
Diffstat (limited to 'llvm/lib/Target/R600/AMDGPUInstrInfo.cpp')
-rw-r--r--llvm/lib/Target/R600/AMDGPUInstrInfo.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/llvm/lib/Target/R600/AMDGPUInstrInfo.cpp b/llvm/lib/Target/R600/AMDGPUInstrInfo.cpp
index bb7f97ff11d..434c91a5231 100644
--- a/llvm/lib/Target/R600/AMDGPUInstrInfo.cpp
+++ b/llvm/lib/Target/R600/AMDGPUInstrInfo.cpp
@@ -118,6 +118,46 @@ AMDGPUInstrInfo::loadRegFromStackSlot(MachineBasicBlock &MBB,
assert(!"Not Implemented");
}
+bool AMDGPUInstrInfo::expandPostRAPseudo (MachineBasicBlock::iterator MI) const {
+ MachineBasicBlock *MBB = MI->getParent();
+
+ switch(MI->getOpcode()) {
+ default:
+ if (isRegisterLoad(*MI)) {
+ unsigned RegIndex = MI->getOperand(2).getImm();
+ unsigned Channel = MI->getOperand(3).getImm();
+ unsigned Address = calculateIndirectAddress(RegIndex, Channel);
+ unsigned OffsetReg = MI->getOperand(1).getReg();
+ if (OffsetReg == AMDGPU::INDIRECT_BASE_ADDR) {
+ buildMovInstr(MBB, MI, MI->getOperand(0).getReg(),
+ getIndirectAddrRegClass()->getRegister(Address));
+ } else {
+ buildIndirectRead(MBB, MI, MI->getOperand(0).getReg(),
+ Address, OffsetReg);
+ }
+ } else if (isRegisterStore(*MI)) {
+ unsigned RegIndex = MI->getOperand(2).getImm();
+ unsigned Channel = MI->getOperand(3).getImm();
+ unsigned Address = calculateIndirectAddress(RegIndex, Channel);
+ unsigned OffsetReg = MI->getOperand(1).getReg();
+ if (OffsetReg == AMDGPU::INDIRECT_BASE_ADDR) {
+ buildMovInstr(MBB, MI, getIndirectAddrRegClass()->getRegister(Address),
+ MI->getOperand(0).getReg());
+ } else {
+ buildIndirectWrite(MBB, MI, MI->getOperand(0).getReg(),
+ calculateIndirectAddress(RegIndex, Channel),
+ OffsetReg);
+ }
+ } else {
+ return false;
+ }
+ }
+
+ MBB->erase(MI);
+ return true;
+}
+
+
MachineInstr *
AMDGPUInstrInfo::foldMemoryOperandImpl(MachineFunction &MF,
MachineInstr *MI,
OpenPOWER on IntegriCloud