summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-08-03 17:34:19 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-08-03 17:34:19 +0000
commitc0deed3263bbf0816eb87c1627ad169845d3f8f8 (patch)
treebf802a95632e506541294992fd14c906554be973
parent59e476b1b9bf8fde31827fcb186a42cc115440c9 (diff)
downloadbcm5719-llvm-c0deed3263bbf0816eb87c1627ad169845d3f8f8.tar.gz
bcm5719-llvm-c0deed3263bbf0816eb87c1627ad169845d3f8f8.zip
Provide target data from the module if the target machine doesn't have any.
llvm-svn: 77973
-rw-r--r--llvm/tools/llc/llc.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/llvm/tools/llc/llc.cpp b/llvm/tools/llc/llc.cpp
index 5782e422457..f5815708223 100644
--- a/llvm/tools/llc/llc.cpp
+++ b/llvm/tools/llc/llc.cpp
@@ -310,7 +310,13 @@ int main(int argc, char **argv) {
// used by strange things like the C backend.
if (Target.WantsWholeFile()) {
PassManager PM;
- PM.add(new TargetData(*Target.getTargetData()));
+
+ // Add the target data from the target machine, if it exists, or the module.
+ if (const TargetData *TD = Target.getTargetData())
+ PM.add(new TargetData(*TD));
+ else
+ PM.add(new TargetData(&mod));
+
if (!NoVerify)
PM.add(createVerifierPass());
@@ -328,7 +334,12 @@ int main(int argc, char **argv) {
// Build up all of the passes that we want to do to the module.
ExistingModuleProvider Provider(M.release());
FunctionPassManager Passes(&Provider);
- Passes.add(new TargetData(*Target.getTargetData()));
+
+ // Add the target data from the target machine, if it exists, or the module.
+ if (const TargetData *TD = Target.getTargetData())
+ Passes.add(new TargetData(*TD));
+ else
+ Passes.add(new TargetData(&mod));
#ifndef NDEBUG
if (!NoVerify)
OpenPOWER on IntegriCloud