aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJim Laskey <jlaskey@mac.com>2006-09-07 22:06:40 +0000
committerJim Laskey <jlaskey@mac.com>2006-09-07 22:06:40 +0000
commita0f3d17daac73c9c71aad497b298cbe82848f726 (patch)
tree66926558c3c809eb673cc06c4bd7a2cc9d0cec7a /include
parent8e8de8f7765a08ab3aa4f48b302cf19ccb9740e2 (diff)
downloadexternal_llvm-a0f3d17daac73c9c71aad497b298cbe82848f726.zip
external_llvm-a0f3d17daac73c9c71aad497b298cbe82848f726.tar.gz
external_llvm-a0f3d17daac73c9c71aad497b298cbe82848f726.tar.bz2
Make target asm info a property of the target machine.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30162 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/CodeGen/AsmPrinter.h4
-rw-r--r--include/llvm/CodeGen/DwarfWriter.h6
-rw-r--r--include/llvm/Target/TargetAsmInfo.h5
-rw-r--r--include/llvm/Target/TargetMachine.h20
4 files changed, 28 insertions, 7 deletions
diff --git a/include/llvm/CodeGen/AsmPrinter.h b/include/llvm/CodeGen/AsmPrinter.h
index 042e1d3..52a621d 100644
--- a/include/llvm/CodeGen/AsmPrinter.h
+++ b/include/llvm/CodeGen/AsmPrinter.h
@@ -49,7 +49,7 @@ namespace llvm {
/// Target Asm Printer information.
///
- TargetAsmInfo *TAI;
+ const TargetAsmInfo *TAI;
/// Name-mangler for global names.
///
@@ -65,7 +65,7 @@ namespace llvm {
std::string CurrentSection;
protected:
- AsmPrinter(std::ostream &o, TargetMachine &TM, TargetAsmInfo *T);
+ AsmPrinter(std::ostream &o, TargetMachine &TM, const TargetAsmInfo *T);
public:
/// SwitchToTextSection - Switch to the specified section of the executable
diff --git a/include/llvm/CodeGen/DwarfWriter.h b/include/llvm/CodeGen/DwarfWriter.h
index 1b5cd8f..bd95fe2 100644
--- a/include/llvm/CodeGen/DwarfWriter.h
+++ b/include/llvm/CodeGen/DwarfWriter.h
@@ -88,7 +88,7 @@ private:
AsmPrinter *Asm;
/// TAI - Target Asm Printer.
- TargetAsmInfo *TAI;
+ const TargetAsmInfo *TAI;
/// TD - Target data.
const TargetData *TD;
@@ -387,12 +387,12 @@ private:
public:
- DwarfWriter(std::ostream &OS, AsmPrinter *A, TargetAsmInfo *T);
+ DwarfWriter(std::ostream &OS, AsmPrinter *A, const TargetAsmInfo *T);
virtual ~DwarfWriter();
// Accessors.
//
- TargetAsmInfo *getTargetAsmInfo() const { return TAI; }
+ const TargetAsmInfo *getTargetAsmInfo() const { return TAI; }
/// SetDebugInfo - Set DebugInfo when it's known that pass manager has
/// created it. Set by the target AsmPrinter.
diff --git a/include/llvm/Target/TargetAsmInfo.h b/include/llvm/Target/TargetAsmInfo.h
index 56c2517..6f63ba3 100644
--- a/include/llvm/Target/TargetAsmInfo.h
+++ b/include/llvm/Target/TargetAsmInfo.h
@@ -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 @@ namespace llvm {
unsigned getAddressSize() const {
return AddressSize;
}
- bool getNeedsSet() const {
+ bool needsSet() const {
return NeedsSet;
}
const char *getCommentString() const {
diff --git a/include/llvm/Target/TargetMachine.h b/include/llvm/Target/TargetMachine.h
index 2a41d5e..6b5efd4 100644
--- a/include/llvm/Target/TargetMachine.h
+++ b/include/llvm/Target/TargetMachine.h
@@ -20,6 +20,7 @@
namespace llvm {
+class TargetAsmInfo;
class TargetData;
class TargetSubtarget;
class TargetInstrInfo;
@@ -65,11 +66,16 @@ class TargetMachine {
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 @@ public:
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