[llvm-commits] CVS: llvm/include/llvm/Module.h

LLVM llvm at cs.uiuc.edu
Sun Jul 25 10:52:37 PDT 2004



Changes in directory llvm/include/llvm:

Module.h updated: 1.46 -> 1.47

---
Log message:

bug 263: http://llvm.cs.uiuc.edu/PR263 :
The necessary changes to module in order to support both target triples and
a list of dependent libraries.


---
Diffs of the changes:  (+30 -5)

Index: llvm/include/llvm/Module.h
diff -u llvm/include/llvm/Module.h:1.46 llvm/include/llvm/Module.h:1.47
--- llvm/include/llvm/Module.h:1.46	Sat Jul 17 18:30:11 2004
+++ llvm/include/llvm/Module.h	Sun Jul 25 12:52:27 2004
@@ -47,6 +47,7 @@
 public:
   typedef iplist<GlobalVariable> GlobalListType;
   typedef iplist<Function> FunctionListType;
+  typedef std::vector<std::string> LibraryListType;
 
   // Global Variable iterators...
   typedef GlobalListType::iterator                             giterator;
@@ -60,18 +61,24 @@
   typedef std::reverse_iterator<iterator>             reverse_iterator;
   typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
 
+  // Library list iterators
+  typedef LibraryListType::iterator literator;
+  typedef LibraryListType::const_iterator const_literator;
+
   enum Endianness  { AnyEndianness, LittleEndian, BigEndian };
   enum PointerSize { AnyPointerSize, Pointer32, Pointer64 };
 
 private:
   GlobalListType GlobalList;     // The Global Variables in the module
   FunctionListType FunctionList; // The Functions in the module
+  LibraryListType LibraryList;   // The Libraries needed by the module
   SymbolTable *SymTab;           // Symbol Table for the module
-  std::string ModuleID;    // Human readable identifier for the module
+  std::string ModuleID;          // Human readable identifier for the module
+  std::string TargetTriple;      // Platform target triple Module compiled on
 
   // These flags are probably not the right long-term way to handle this kind of
   // target information, but it is sufficient for now.
-  Endianness  Endian;       // True if target is little endian
+  Endianness  Endian;     // True if target is little endian
   PointerSize PtrSize;    // True if target has 32-bit pointers (false = 64-bit)
 
   // Accessor for the underlying GVRefMap... only through the Constant class...
@@ -84,7 +91,9 @@
   Module(const std::string &ModuleID);
   ~Module();
 
-  const std::string &getModuleIdentifier() const { return ModuleID; }
+  const std::string& getModuleIdentifier() const { return ModuleID; }
+  const std::string& getTargetTriple() const { return TargetTriple; }
+  void setTargetTriple(std::string& T) { TargetTriple = T; }
 
   /// Target endian information...
   Endianness getEndianness() const { return Endian; }
@@ -181,6 +190,7 @@
   //===--------------------------------------------------------------------===//
   // Module iterator forwarding functions
   //
+  // Globals list interface
   inline giterator                gbegin()       { return GlobalList.begin(); }
   inline const_giterator          gbegin() const { return GlobalList.begin(); }
   inline giterator                gend  ()       { return GlobalList.end();   }
@@ -198,8 +208,7 @@
   inline const GlobalVariable     &gback() const { return GlobalList.back(); }
   inline       GlobalVariable     &gback()       { return GlobalList.back(); }
 
-
-
+  // FunctionList interface
   inline iterator                begin()       { return FunctionList.begin(); }
   inline const_iterator          begin() const { return FunctionList.begin(); }
   inline iterator                end  ()       { return FunctionList.end();   }
@@ -217,6 +226,22 @@
   inline const Function          &back() const { return FunctionList.back(); }
   inline       Function          &back()       { return FunctionList.back(); }
 
+  // LibraryList interface
+  inline literator           lbegin()       { return LibraryList.begin(); }
+  inline const_literator     lbegin() const { return LibraryList.begin(); }
+  inline literator           lend  ()       { return LibraryList.end();   }
+  inline const_literator     lend  () const { return LibraryList.end();   }
+
+  inline unsigned             lsize() const { return LibraryList.size(); }
+  inline bool                lempty() const { return LibraryList.empty(); }
+  inline const std::string&  lfront() const { return LibraryList.front(); }
+  inline       std::string&  lfront()       { return LibraryList.front(); }
+  inline const std::string&   lback() const { return LibraryList.back(); }
+  inline       std::string&   lback()       { return LibraryList.back(); }
+
+  inline void linsert(std::string& Lib){ LibraryList.push_back(Lib); }
+  inline void lremove(std::string& Lib);
+
   void print(std::ostream &OS) const { print(OS, 0); }
   void print(std::ostream &OS, AssemblyAnnotationWriter *AAW) const;
 





More information about the llvm-commits mailing list