[llvm-commits] CVS: llvm/include/llvm/Target/TargetAsmInfo.h TargetMachine.h

Jim Laskey jlaskey at apple.com
Thu Sep 7 15:07:09 PDT 2006



Changes in directory llvm/include/llvm/Target:

TargetAsmInfo.h updated: 1.1 -> 1.2
TargetMachine.h updated: 1.69 -> 1.70
---
Log message:

Make target asm info a property of the target machine.


---
Diffs of the changes:  (+23 -2)

 TargetAsmInfo.h |    5 ++++-
 TargetMachine.h |   20 +++++++++++++++++++-
 2 files changed, 23 insertions(+), 2 deletions(-)


Index: llvm/include/llvm/Target/TargetAsmInfo.h
diff -u llvm/include/llvm/Target/TargetAsmInfo.h:1.1 llvm/include/llvm/Target/TargetAsmInfo.h:1.2
--- llvm/include/llvm/Target/TargetAsmInfo.h:1.1	Wed Sep  6 13:35:33 2006
+++ llvm/include/llvm/Target/TargetAsmInfo.h	Thu Sep  7 17:06:40 2006
@@ -21,6 +21,9 @@
 
 namespace llvm {
 
+  // Forward declaration.
+  class TargetMachine;
+
   /// TargetAsmInfo - This class is intended to be used as a base class for asm
   /// properties and features specific to the target.
   class TargetAsmInfo {
@@ -266,7 +269,7 @@
     unsigned getAddressSize() const {
       return AddressSize;
     }
-    bool getNeedsSet() const {
+    bool needsSet() const {
       return NeedsSet;
     }
     const char *getCommentString() const {


Index: llvm/include/llvm/Target/TargetMachine.h
diff -u llvm/include/llvm/Target/TargetMachine.h:1.69 llvm/include/llvm/Target/TargetMachine.h:1.70
--- llvm/include/llvm/Target/TargetMachine.h:1.69	Sun Sep  3 23:14:57 2006
+++ llvm/include/llvm/Target/TargetMachine.h	Thu Sep  7 17:06:40 2006
@@ -20,6 +20,7 @@
 
 namespace llvm {
 
+class TargetAsmInfo;
 class TargetData;
 class TargetSubtarget;
 class TargetInstrInfo;
@@ -65,11 +66,16 @@
   TargetMachine(const TargetMachine &);   // DO NOT IMPLEMENT
   void operator=(const TargetMachine &);  // DO NOT IMPLEMENT
 protected: // Can only create subclasses.
-  TargetMachine() { }
+  TargetMachine() : AsmInfo(NULL) { }
 
   /// getSubtargetImpl - virtual method implemented by subclasses that returns
   /// a reference to that target's TargetSubtarget-derived member variable.
   virtual const TargetSubtarget *getSubtargetImpl() const { return 0; }
+  
+  /// AsmInfo - Contains target specific asm information.
+  ///
+  mutable const TargetAsmInfo *AsmInfo;
+  
 public:
   virtual ~TargetMachine();
 
@@ -96,6 +102,18 @@
   virtual const TargetFrameInfo        *getFrameInfo() const { return 0; }
   virtual       TargetLowering    *getTargetLowering() const { return 0; }
   virtual const TargetData            *getTargetData() const { return 0; }
+  
+  
+  /// getTargetAsmInfo - Return target specific asm information.
+  ///
+  const TargetAsmInfo *getTargetAsmInfo() const {
+    if (!AsmInfo) AsmInfo = createTargetAsmInfo();
+    return AsmInfo;
+  }
+  
+  /// createTargetAsmInfo - Create a new instance of target specific asm
+  /// information.
+  virtual const TargetAsmInfo *createTargetAsmInfo() const { return NULL; }
 
   /// getSubtarget - This method returns a pointer to the specified type of
   /// TargetSubtarget.  In debug builds, it verifies that the object being






More information about the llvm-commits mailing list