[llvm-commits] CVS: llvm/lib/Target/CBackend/CTargetMachine.h

Owen Anderson resistor at mac.com
Tue May 2 18:30:17 PDT 2006



Changes in directory llvm/lib/Target/CBackend:

CTargetMachine.h updated: 1.10 -> 1.11
---
Log message:

Refactor TargetMachine, pushing handling of TargetData into the target-specific subclasses.  This has one caller-visible change: getTargetData() now returns a pointer instead of a reference.

This fixes PR 759: http://llvm.cs.uiuc.edu/PR759 .



---
Diffs of the changes:  (+6 -1)

 CTargetMachine.h |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletion(-)


Index: llvm/lib/Target/CBackend/CTargetMachine.h
diff -u llvm/lib/Target/CBackend/CTargetMachine.h:1.10 llvm/lib/Target/CBackend/CTargetMachine.h:1.11
--- llvm/lib/Target/CBackend/CTargetMachine.h:1.10	Wed Mar 22 23:43:15 2006
+++ llvm/lib/Target/CBackend/CTargetMachine.h	Tue May  2 20:29:57 2006
@@ -19,8 +19,11 @@
 namespace llvm {
 
 struct CTargetMachine : public TargetMachine {
+  const TargetData DataLayout;       // Calculates type size & alignment
+
   CTargetMachine(const Module &M, const std::string &FS)
-    : TargetMachine("CBackend", M) {}
+    : TargetMachine("CBackend", M),
+      DataLayout("CBackend") {}
 
   // This is the only thing that actually does anything here.
   virtual bool addPassesToEmitFile(PassManager &PM, std::ostream &Out,
@@ -28,6 +31,8 @@
 
   // This class always works, but shouldn't be the default in most cases.
   static unsigned getModuleMatchQuality(const Module &M) { return 1; }
+  
+  virtual const TargetData       *getTargetData() const { return &DataLayout; }
 };
 
 } // End llvm namespace






More information about the llvm-commits mailing list