Enable exception handling int JIT
[oota-llvm.git] / lib / Target / PowerPC / PPCCodeEmitter.cpp
index 8f5e6fcbf0aa48fe64bcf50731c67db533516b44..a23f4e41eb6a1b5a3c78335106202de8b16df544 100644 (file)
@@ -20,6 +20,7 @@
 #include "llvm/CodeGen/MachineCodeEmitter.h"
 #include "llvm/CodeGen/MachineFunctionPass.h"
 #include "llvm/CodeGen/MachineInstrBuilder.h"
+#include "llvm/CodeGen/MachineModuleInfo.h"
 #include "llvm/CodeGen/Passes.h"
 #include "llvm/Support/Debug.h"                   
 #include "llvm/Support/Compiler.h"
@@ -38,6 +39,11 @@ namespace {
     /// getMachineOpValue - evaluates the MachineOperand of a given MachineInstr
     ///
     int getMachineOpValue(MachineInstr &MI, MachineOperand &MO);
+    
+    void getAnalysisUsage(AnalysisUsage &AU) const {
+      AU.addRequired<MachineModuleInfo>();
+      MachineFunctionPass::getAnalysisUsage(AU);
+    }
 
   public:
     static char ID;
@@ -82,6 +88,8 @@ bool PPCCodeEmitter::runOnMachineFunction(MachineFunction &MF) {
   assert((MF.getTarget().getRelocationModel() != Reloc::Default ||
           MF.getTarget().getRelocationModel() != Reloc::Static) &&
          "JIT relocation model must be set to static or default!");
+
+  MCE.setModuleInfo(&getAnalysis<MachineModuleInfo>());
   do {
     MovePCtoLROffset = 0;
     MCE.startFunction(MF);
@@ -101,6 +109,9 @@ void PPCCodeEmitter::emitBasicBlock(MachineBasicBlock &MBB) {
     default:
       MCE.emitWordBE(getBinaryCodeForInstr(*I));
       break;
+    case TargetInstrInfo::LABEL:
+      MCE.emitLabel(MI.getOperand(0).getImm());
+      break;
     case PPC::IMPLICIT_DEF_GPRC:
     case PPC::IMPLICIT_DEF_G8RC:
     case PPC::IMPLICIT_DEF_F8: