aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-03-03 02:12:47 +0000
committerChris Lattner <sabre@nondot.org>2004-03-03 02:12:47 +0000
commit2bed9ecc4b5d74e61c997eb2d3877e0ab6257979 (patch)
treedff3f19a23639c3b0540d5925f940a23ec53a5a2
parent0a94348fb9285088a6db78f66b4b97e47bdd431e (diff)
downloadexternal_llvm-2bed9ecc4b5d74e61c997eb2d3877e0ab6257979.zip
external_llvm-2bed9ecc4b5d74e61c997eb2d3877e0ab6257979.tar.gz
external_llvm-2bed9ecc4b5d74e61c997eb2d3877e0ab6257979.tar.bz2
Add a new constructor
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12087 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Target/TargetMachine.h6
-rw-r--r--lib/Target/TargetMachine.cpp5
2 files changed, 11 insertions, 0 deletions
diff --git a/include/llvm/Target/TargetMachine.h b/include/llvm/Target/TargetMachine.h
index 7d9586c..cfefe34 100644
--- a/include/llvm/Target/TargetMachine.h
+++ b/include/llvm/Target/TargetMachine.h
@@ -52,6 +52,12 @@ protected: // Can only create subclasses...
unsigned char DoubleAl = 8, unsigned char FloatAl = 4,
unsigned char LongAl = 8, unsigned char IntAl = 4,
unsigned char ShortAl = 2, unsigned char ByteAl = 1);
+
+ // This constructor is used for targets that support arbitrary TargetData
+ // layouts, like the C backend. It initializes the TargetData to match that
+ // of the specified module.
+ TargetMachine(const std::string &name, IntrinsicLowering *IL,
+ const Module &M);
public:
virtual ~TargetMachine();
diff --git a/lib/Target/TargetMachine.cpp b/lib/Target/TargetMachine.cpp
index 30199be..2c8b796 100644
--- a/lib/Target/TargetMachine.cpp
+++ b/lib/Target/TargetMachine.cpp
@@ -30,6 +30,11 @@ TargetMachine::TargetMachine(const std::string &name, IntrinsicLowering *il,
IntAl, ShortAl, ByteAl) {
IL = il ? il : new DefaultIntrinsicLowering();
}
+TargetMachine::TargetMachine(const std::string &name, IntrinsicLowering *il,
+ const Module &M)
+ : Name(name), DataLayout(name, &M) {
+ IL = il ? il : new DefaultIntrinsicLowering();
+}
TargetMachine::~TargetMachine() {
delete IL;