[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPC32CodeEmitter.cpp
Misha Brukman
brukman at cs.uiuc.edu
Wed Oct 13 23:40:07 PDT 2004
Changes in directory llvm/lib/Target/PowerPC:
PPC32CodeEmitter.cpp updated: 1.5 -> 1.6
---
Log message:
* Claim to support machine code emission - return false from
addPassesToEmitMachineCode()
* Add support for registers and constants in getMachineOpValue()
This enables running "int main() { ret 0 }" via the PowerPC JIT.
---
Diffs of the changes: (+26 -4)
Index: llvm/lib/Target/PowerPC/PPC32CodeEmitter.cpp
diff -u llvm/lib/Target/PowerPC/PPC32CodeEmitter.cpp:1.5 llvm/lib/Target/PowerPC/PPC32CodeEmitter.cpp:1.6
--- llvm/lib/Target/PowerPC/PPC32CodeEmitter.cpp:1.5 Thu Oct 14 01:07:25 2004
+++ llvm/lib/Target/PowerPC/PPC32CodeEmitter.cpp Thu Oct 14 01:39:56 2004
@@ -68,8 +68,7 @@
PM.add(new PPC32CodeEmitter(*this, MCE));
// Delete machine code for this function after emitting it
PM.add(createMachineCodeDeleter());
- // We don't yet support machine code emission
- return true;
+ return false;
}
bool PPC32CodeEmitter::runOnMachineFunction(MachineFunction &MF) {
@@ -88,8 +87,31 @@
int64_t PPC32CodeEmitter::getMachineOpValue(MachineInstr &MI,
MachineOperand &MO) {
- abort();
- return 0;
+ int64_t rv = 0; // Return value; defaults to 0 for unhandled cases
+ // or things that get fixed up later by the JIT.
+ if (MO.isPCRelativeDisp()) {
+ std::cerr << "PPC32CodeEmitter: PC-relative disp unhandled\n";
+ abort();
+ } else if (MO.isRegister()) {
+ rv = MO.getReg();
+ } else if (MO.isImmediate()) {
+ rv = MO.getImmedValue();
+#if 0
+ } else if (MO.isGlobalAddress()) {
+ } else if (MO.isMachineBasicBlock()) {
+ MachineBasicBlock *MBB = MO.getMachineBasicBlock();
+ } else if (MO.isExternalSymbol()) {
+ } else if (MO.isFrameIndex()) {
+ unsigned index = MO.getFrameIndex();
+ } else if (MO.isConstantPoolIndex()) {
+ unsigned index = MO.getCosntantPoolIndex();
+#endif
+ } else {
+ std::cerr << "ERROR: Unknown type of MachineOperand: " << MO << "\n";
+ abort();
+ }
+
+ return rv;
}
More information about the llvm-commits
mailing list