Reapply 91184 with fixes and an addition to the testcase to cover the problem
[oota-llvm.git] / lib / CodeGen / MachOCodeEmitter.h
index c280706e488b0049e4f174e7f3a57e66cecfd79d..475244646bd133cbc90c6f56f4e1ba451e573eb5 100644 (file)
 #ifndef MACHOCODEEMITTER_H
 #define MACHOCODEEMITTER_H
 
-#include "MachOWriter.h"
+#include "llvm/CodeGen/ObjectCodeEmitter.h"
+#include <map>
 
 namespace llvm {
 
+class MachOWriter;
+
 /// MachOCodeEmitter - This class is used by the MachOWriter to emit the code 
 /// for functions to the Mach-O file.
 
@@ -27,7 +30,7 @@ class MachOCodeEmitter : public ObjectCodeEmitter {
   /// machine directly, indicating what header values and flags to set.
   bool is64Bit, isLittleEndian;
 
-  const TargetAsmInfo *TAI;
+  const MCAsmInfo *MAI;
 
   /// Relocations - These are the relocations that the function needs, as
   /// emitted.
@@ -36,12 +39,7 @@ class MachOCodeEmitter : public ObjectCodeEmitter {
   std::map<uint64_t, uintptr_t> Labels;
 
 public:
-  MachOCodeEmitter(MachOWriter &mow, MachOSection &mos) : 
-        ObjectCodeEmitter(&mos), MOW(mow), TM(MOW.TM) {
-    is64Bit = TM.getTargetData()->getPointerSizeInBits() == 64;
-    isLittleEndian = TM.getTargetData()->isLittleEndian();
-    TAI = TM.getTargetAsmInfo();  
-  }
+  MachOCodeEmitter(MachOWriter &mow, MachOSection &mos);
 
   virtual void startFunction(MachineFunction &MF);
   virtual bool finishFunction(MachineFunction &MF);
@@ -49,7 +47,7 @@ public:
   virtual void addRelocation(const MachineRelocation &MR) {
     Relocations.push_back(MR);
   }
-  
+
   void emitConstantPool(MachineConstantPool *MCP);
   void emitJumpTables(MachineJumpTableInfo *MJTI);