summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeon
diff options
context:
space:
mode:
authorTom Stellard <[email protected]>2012-08-23 19:27:48 +0000
committerTom Stellard <[email protected]>2012-08-23 21:54:32 +0000
commit5a1edb8655aeab17bf0d90e202fb31a1adb53498 (patch)
tree36ae701132e8da585b1fc8dc7c1ccfb6bcb47680 /src/gallium/drivers/radeon
parentcb5227b403a9c78a734e5e67657da6c485881cbb (diff)
radeon/llvm: Simplify the convert to ISA pass
Diffstat (limited to 'src/gallium/drivers/radeon')
-rw-r--r--src/gallium/drivers/radeon/AMDGPUConvertToISA.cpp11
-rw-r--r--src/gallium/drivers/radeon/AMDGPUInstrInfo.cpp14
-rw-r--r--src/gallium/drivers/radeon/AMDGPUInstrInfo.h2
3 files changed, 7 insertions, 20 deletions
diff --git a/src/gallium/drivers/radeon/AMDGPUConvertToISA.cpp b/src/gallium/drivers/radeon/AMDGPUConvertToISA.cpp
index b876a660fe7..fbca0a7b832 100644
--- a/src/gallium/drivers/radeon/AMDGPUConvertToISA.cpp
+++ b/src/gallium/drivers/radeon/AMDGPUConvertToISA.cpp
@@ -52,15 +52,10 @@ bool AMDGPUConvertToISAPass::runOnMachineFunction(MachineFunction &MF)
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) ) {
+ for (MachineBasicBlock::iterator I = MBB.begin(), E = MBB.end();
+ I != E; ++I) {
MachineInstr &MI = *I;
- MachineInstr * newInstr = TII->convertToISA(MI, MF, MBB.findDebugLoc(I));
- if (!newInstr) {
- continue;
- }
- MBB.insert(I, newInstr);
- MI.eraseFromParent();
+ TII->convertToISA(MI, MF, MBB.findDebugLoc(I));
}
}
return false;
diff --git a/src/gallium/drivers/radeon/AMDGPUInstrInfo.cpp b/src/gallium/drivers/radeon/AMDGPUInstrInfo.cpp
index 03a647e4387..9aae09a4a15 100644
--- a/src/gallium/drivers/radeon/AMDGPUInstrInfo.cpp
+++ b/src/gallium/drivers/radeon/AMDGPUInstrInfo.cpp
@@ -27,7 +27,7 @@
using namespace llvm;
AMDGPUInstrInfo::AMDGPUInstrInfo(TargetMachine &tm)
- : AMDGPUGenInstrInfo(), RI(tm, *this), TM(tm) { }
+ : AMDGPUGenInstrInfo(0,0), RI(tm, *this), TM(tm) { }
const AMDGPURegisterInfo &AMDGPUInstrInfo::getRegisterInfo() const {
return RI;
@@ -234,17 +234,13 @@ AMDGPUInstrInfo::isSafeToMoveRegClassDefs(const TargetRegisterClass *RC) const {
// TODO: Implement this function
return true;
}
-
-MachineInstr * AMDGPUInstrInfo::convertToISA(MachineInstr & MI, MachineFunction &MF,
+
+void AMDGPUInstrInfo::convertToISA(MachineInstr & MI, MachineFunction &MF,
DebugLoc DL) const
{
- MachineInstrBuilder newInstr;
MachineRegisterInfo &MRI = MF.getRegInfo();
const AMDGPURegisterInfo & RI = getRegisterInfo();
- // Create the new instruction
- newInstr = BuildMI(MF, DL, TM.getInstrInfo()->get(MI.getOpcode()));
-
for (unsigned i = 0; i < MI.getNumOperands(); i++) {
MachineOperand &MO = MI.getOperand(i);
// Convert dst regclass to one that is supported by the ISA
@@ -258,9 +254,5 @@ MachineInstr * AMDGPUInstrInfo::convertToISA(MachineInstr & MI, MachineFunction
MRI.setRegClass(MO.getReg(), newRegClass);
}
}
- // Add the operand to the new instruction
- newInstr.addOperand(MO);
}
-
- return newInstr;
}
diff --git a/src/gallium/drivers/radeon/AMDGPUInstrInfo.h b/src/gallium/drivers/radeon/AMDGPUInstrInfo.h
index dd5108e8192..264311962ba 100644
--- a/src/gallium/drivers/radeon/AMDGPUInstrInfo.h
+++ b/src/gallium/drivers/radeon/AMDGPUInstrInfo.h
@@ -138,7 +138,7 @@ public:
/// convertToISA - Convert the AMDIL MachineInstr to a supported ISA
/// MachineInstr
- virtual MachineInstr * convertToISA(MachineInstr & MI, MachineFunction &MF,
+ virtual void convertToISA(MachineInstr & MI, MachineFunction &MF,
DebugLoc DL) const;
};