Add a predicate
[oota-llvm.git] / include / llvm / CodeGen / ELFWriter.h
index 3d3d448aa126b898ed9620a32a271021367d9325..b3914794f0418bff748342544cb6a9841fd94121 100644 (file)
@@ -2,8 +2,8 @@
 //
 //                     The LLVM Compiler Infrastructure
 //
-// This file was developed by the LLVM research group and is distributed under
-// the University of Illinois Open Source License. See LICENSE.TXT for details.
+// This file was developed by Chris Lattner and is distributed under the
+// University of Illinois Open Source License. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
 //
@@ -131,7 +131,7 @@ namespace llvm {
         SHF_LINK_ORDER       = 1 << 7, // Preserve order after combining
         SHF_OS_NONCONFORMING = 1 << 8, // nonstandard OS support required
         SHF_GROUP            = 1 << 9, // Section is a member of a group
-        SHF_TLS              = 1 << 10,// Section holds thread-local data
+        SHF_TLS              = 1 << 10 // Section holds thread-local data
       };
 
       ELFSection(const std::string &name)
@@ -165,6 +165,15 @@ namespace llvm {
       return *SN;
     }
 
+    ELFSection &getDataSection() {
+      return getSection(".data", ELFSection::SHT_PROGBITS,
+                        ELFSection::SHF_WRITE | ELFSection::SHF_ALLOC);
+    }
+    ELFSection &getBSSSection() {
+      return getSection(".bss", ELFSection::SHT_NOBITS,
+                        ELFSection::SHF_WRITE | ELFSection::SHF_ALLOC);
+    }
+
     /// ELFSym - This struct contains information about each symbol that is
     /// added to logical symbol table for the module.  This is eventually
     /// turned into a real symbol table in the file.
@@ -247,23 +256,23 @@ namespace llvm {
     }
     void outxword(DataBuffer &Output, uint64_t X) {
       if (isLittleEndian) {
-        Output.push_back((X >>  0) & 255);
-        Output.push_back((X >>  8) & 255);
-        Output.push_back((X >> 16) & 255);
-        Output.push_back((X >> 24) & 255);
-        Output.push_back((X >> 32) & 255);
-        Output.push_back((X >> 40) & 255);
-        Output.push_back((X >> 48) & 255);
-        Output.push_back((X >> 56) & 255);
+        Output.push_back(unsigned(X >>  0) & 255);
+        Output.push_back(unsigned(X >>  8) & 255);
+        Output.push_back(unsigned(X >> 16) & 255);
+        Output.push_back(unsigned(X >> 24) & 255);
+        Output.push_back(unsigned(X >> 32) & 255);
+        Output.push_back(unsigned(X >> 40) & 255);
+        Output.push_back(unsigned(X >> 48) & 255);
+        Output.push_back(unsigned(X >> 56) & 255);
       } else {
-        Output.push_back((X >> 56) & 255);
-        Output.push_back((X >> 48) & 255);
-        Output.push_back((X >> 40) & 255);
-        Output.push_back((X >> 32) & 255);
-        Output.push_back((X >> 24) & 255);
-        Output.push_back((X >> 16) & 255);
-        Output.push_back((X >>  8) & 255);
-        Output.push_back((X >>  0) & 255);
+        Output.push_back(unsigned(X >> 56) & 255);
+        Output.push_back(unsigned(X >> 48) & 255);
+        Output.push_back(unsigned(X >> 40) & 255);
+        Output.push_back(unsigned(X >> 32) & 255);
+        Output.push_back(unsigned(X >> 24) & 255);
+        Output.push_back(unsigned(X >> 16) & 255);
+        Output.push_back(unsigned(X >>  8) & 255);
+        Output.push_back(unsigned(X >>  0) & 255);
       }
     }
     void outaddr32(DataBuffer &Output, unsigned X) {
@@ -302,8 +311,7 @@ namespace llvm {
     }
 
   private:
-    void EmitGlobal(GlobalVariable *GV, ELFSection &DataSection,
-                    ELFSection &BSSSection);
+    void EmitGlobal(GlobalVariable *GV);
 
     void EmitSymbolTable();