diff options
author | Chris Lattner <sabre@nondot.org> | 2003-04-24 19:09:05 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-04-24 19:09:05 +0000 |
commit | 53a0c38b5fdb45974b74373ab17bf4d2fa27e292 (patch) | |
tree | 6628bb35469e4e4c1118ed2c0c542c55817ed1e0 | |
parent | 4bc8e640b8338566f59bea3532e818eb9e2685b2 (diff) |
add a new targetdata ctor to create a target data appropriate to the module
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5903 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Target/TargetData.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/Target/TargetData.cpp b/lib/Target/TargetData.cpp index 96c6ba9bfe..701b36640e 100644 --- a/lib/Target/TargetData.cpp +++ b/lib/Target/TargetData.cpp @@ -11,6 +11,7 @@ //===----------------------------------------------------------------------===// #include "llvm/Target/TargetData.h" +#include "llvm/Module.h" #include "llvm/DerivedTypes.h" #include "llvm/Constants.h" @@ -103,6 +104,23 @@ TargetData::TargetData(const std::string &TargetName, 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() { AnnotationManager::registerAnnotationFactory(AID, 0); // Deregister factory } |