- Move conversion of [SU]ADDO from DAG combiner into legalizer.
[oota-llvm.git] / lib / CodeGen / MachOWriter.h
index a26945874af957cf7100801ad27916c84a9e6dcc..e2b6fa8dd4d9373b5eaedc1619e04ea7ec56fbc7 100644 (file)
@@ -2,8 +2,8 @@
 //
 //                     The LLVM Compiler Infrastructure
 //
-// This file was developed by Nate Begeman and is distributed under the
-// University of Illinois Open Source License. See LICENSE.TXT for details.
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
 //
@@ -21,6 +21,7 @@
 #include "llvm/Target/TargetData.h"
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Target/TargetMachOWriterInfo.h"
+#include <map>
 
 namespace llvm {
   class GlobalVariable;
@@ -28,6 +29,7 @@ namespace llvm {
   class MachineCodeEmitter;
   class MachOCodeEmitter;
   class OutputBuffer;
+  class raw_ostream;
 
   /// MachOSym - This struct contains information about each symbol that is
   /// added to logical symbol table for the module.  This is eventually
@@ -84,11 +86,12 @@ namespace llvm {
   class MachOWriter : public MachineFunctionPass {
     friend class MachOCodeEmitter;
   public:
+    static char ID;
     MachineCodeEmitter &getMachineCodeEmitter() const {
       return *(MachineCodeEmitter*)MCE;
     }
 
-    MachOWriter(std::ostream &O, TargetMachine &TM);
+    MachOWriter(raw_ostream &O, TargetMachine &TM);
     virtual ~MachOWriter();
 
     virtual const char *getPassName() const {
@@ -99,7 +102,7 @@ namespace llvm {
   protected:
     /// Output stream to send the resultant object file to.
     ///
-    std::ostream &O;
+    raw_ostream &O;
 
     /// Target machine description.
     ///
@@ -254,19 +257,19 @@ namespace llvm {
       // The following constants are getting pulled in by one of the
       // system headers, which creates a neat clash with the enum.
 #if !defined(VM_PROT_NONE)
-#define VM_PROT_NONE           0x00
+#define VM_PROT_NONE    0x00
 #endif
 #if !defined(VM_PROT_READ)
-#define VM_PROT_READ           0x01
+#define VM_PROT_READ    0x01
 #endif
 #if !defined(VM_PROT_WRITE)
-#define VM_PROT_WRITE          0x02
+#define VM_PROT_WRITE   0x02
 #endif
 #if !defined(VM_PROT_EXECUTE)
-#define VM_PROT_EXECUTE                0x04
+#define VM_PROT_EXECUTE 0x04
 #endif
 #if !defined(VM_PROT_ALL)
-#define VM_PROT_ALL            0x07
+#define VM_PROT_ALL     0x07
 #endif
 
       // Constants for the vm protection fields
@@ -465,7 +468,7 @@ namespace llvm {
       
       const Type *Ty = C->getType();
       if (Ty->isPrimitiveType() || Ty->isInteger()) {
-        unsigned Size = TM.getTargetData()->getTypeSize(Ty);
+        unsigned Size = TM.getTargetData()->getABITypeSize(Ty);
         switch(Size) {
         default: break; // Fall through to __TEXT,__const
         case 4:
@@ -583,7 +586,7 @@ namespace llvm {
     /// PendingSyms - This is a list of externally defined symbols that we have
     /// been asked to emit, but have not seen a reference to.  When a reference
     /// is seen, the symbol will move from this list to the SymbolTable.
-    std::vector<MachOSym> PendingSyms;
+    std::vector<GlobalValue*> PendingGlobals;
     
     /// DynamicSymbolTable - This is just a vector of indices into
     /// SymbolTable to aid in emitting the DYSYMTAB load command.
@@ -613,10 +616,12 @@ namespace llvm {
                                  unsigned ToIndex,
                                  OutputBuffer &RelocOut,
                                  OutputBuffer &SecOut,
-                                 bool Scattered) {
+                                 bool Scattered,
+                                 bool Extern) {
       return TM.getMachOWriterInfo()->GetTargetRelocation(MR, FromIdx, ToAddr,
                                                           ToIndex, RelocOut,
-                                                          SecOut, Scattered);
+                                                          SecOut, Scattered,
+                                                          Extern);
     }
   };
 }