aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-06-16 18:11:26 +0000
committerChris Lattner <sabre@nondot.org>2006-06-16 18:11:26 +0000
commitacbc07aa2216f84967a1bcccaca1a425b141f77a (patch)
tree97165cd65201741aa6b44c2eff9a36c2048baf05
parenta827953c32e420740c281b4a38a056d15b180932 (diff)
Remove ctor with each piece specifyable (which causes overload ambiguities),
add a new init method. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28828 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Target/TargetData.h21
-rw-r--r--lib/Target/TargetData.cpp33
2 files changed, 12 insertions, 42 deletions
diff --git a/include/llvm/Target/TargetData.h b/include/llvm/Target/TargetData.h
index 17dc8254e5..30568155e6 100644
--- a/include/llvm/Target/TargetData.h
+++ b/include/llvm/Target/TargetData.h
@@ -45,20 +45,16 @@ class TargetData : public ImmutablePass {
unsigned char PointerAlignment; // Defaults to 8 bytes
public:
- TargetData(const std::string &TargetName = "",
- bool LittleEndian = false,
- unsigned char PtrSize = 8,
- unsigned char PtrAl = 8, unsigned char DoubleAl = 8,
- unsigned char FloatAl = 4, unsigned char LongAl = 8,
- unsigned char IntAl = 4, unsigned char ShortAl = 2,
- unsigned char ByteAl = 1, unsigned char BoolAl = 1);
-
/// Constructs a TargetData from a string of the following format:
/// "E-p:64:64-d:64-f:32-l:64-i:32-s:16-b:8-B:8"
/// The above string is considered the default, and any values not specified
/// in the string will be assumed to be as above.
- TargetData(const std::string &TargetName,
- const std::string &TargetDescription);
+ TargetData(const std::string &TargetName = "",
+ const std::string &TargetDescription = "") {
+ assert(!TargetName.empty() &&
+ "ERROR: Tool did not specify a target data to use!");
+ init(TargetDescription);
+ }
// Copy constructor
TargetData (const TargetData &TD) :
@@ -78,6 +74,11 @@ public:
TargetData(const std::string &ToolName, const Module *M);
~TargetData(); // Not virtual, do not subclass this class
+ /// init - Specify configuration if not available at ctor time.
+ ///
+ void init(const std::string &TargetDescription);
+
+
/// Target endianness...
bool isLittleEndian() const { return LittleEndian; }
bool isBigEndian() const { return !LittleEndian; }
diff --git a/lib/Target/TargetData.cpp b/lib/Target/TargetData.cpp
index f7b7b4c3e5..d2b6a54ecd 100644
--- a/lib/Target/TargetData.cpp
+++ b/lib/Target/TargetData.cpp
@@ -95,38 +95,7 @@ unsigned StructLayout::getElementContainingOffset(uint64_t Offset) const {
// TargetData Class Implementation
//===----------------------------------------------------------------------===//
-TargetData::TargetData(const std::string &TargetName,
- bool isLittleEndian, unsigned char PtrSize,
- unsigned char PtrAl, unsigned char DoubleAl,
- unsigned char FloatAl, unsigned char LongAl,
- unsigned char IntAl, unsigned char ShortAl,
- unsigned char ByteAl, unsigned char BoolAl) {
-
- // If this assert triggers, a pass "required" TargetData information, but the
- // top level tool did not provide one for it. We do not want to default
- // construct, or else we might end up using a bad endianness or pointer size!
- //
- assert(!TargetName.empty() &&
- "ERROR: Tool did not specify a target data to use!");
-
- LittleEndian = isLittleEndian;
- PointerSize = PtrSize;
- PointerAlignment = PtrAl;
- DoubleAlignment = DoubleAl;
- FloatAlignment = FloatAl;
- LongAlignment = LongAl;
- IntAlignment = IntAl;
- ShortAlignment = ShortAl;
- ByteAlignment = ByteAl;
- BoolAlignment = BoolAl;
-}
-
-TargetData::TargetData(const std::string &TargetName,
- const std::string &TargetDescription) {
- assert(!TargetName.empty() &&
- "ERROR: Tool did not specify a target data to use!");
-
-
+void TargetData::init(const std::string &TargetDescription) {
std::string temp = TargetDescription;
LittleEndian = false;