[llvm-commits] CVS: llvm/lib/Target/TargetData.cpp

Chris Lattner lattner at cs.uiuc.edu
Thu Apr 24 14:10:01 PDT 2003


Changes in directory llvm/lib/Target:

TargetData.cpp updated: 1.27 -> 1.28

---
Log message:

add a new targetdata ctor to create a target data appropriate to the module


---
Diffs of the changes:

Index: llvm/lib/Target/TargetData.cpp
diff -u llvm/lib/Target/TargetData.cpp:1.27 llvm/lib/Target/TargetData.cpp:1.28
--- llvm/lib/Target/TargetData.cpp:1.27	Tue Feb 25 14:27:09 2003
+++ llvm/lib/Target/TargetData.cpp	Thu Apr 24 14:09:05 2003
@@ -11,6 +11,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Target/TargetData.h"
+#include "llvm/Module.h"
 #include "llvm/DerivedTypes.h"
 #include "llvm/Constants.h"
 
@@ -101,6 +102,23 @@
   IntAlignment     = IntAl;
   ShortAlignment   = ShortAl;
   ByteAlignment    = ByteAl;
+}
+
+TargetData::TargetData(const std::string &ToolName, const Module *M)
+  : AID(AnnotationManager::getID("TargetData::" + ToolName)) {
+  AnnotationManager::registerAnnotationFactory(AID, TypeAnFactory, this);
+
+  LittleEndian     = M->isLittleEndian();
+  SubWordDataSize  = 1;
+  IntegerRegSize   = 8;
+  PointerSize      = M->has32BitPointers() ? 32 : 64;
+  PointerAlignment = PointerSize;
+  DoubleAlignment  = 8;
+  FloatAlignment   = 4;
+  LongAlignment    = 8;
+  IntAlignment     = 4;
+  ShortAlignment   = 2;
+  ByteAlignment    = 1;
 }
 
 TargetData::~TargetData() {





More information about the llvm-commits mailing list