Add a new constructor
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12087 91177308-0d34-0410-b5e6-96231b3b80d8
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 @@
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 @@
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;