diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-08-03 17:34:19 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-08-03 17:34:19 +0000 |
commit | 4e02eb0f67356762eeb12a75f8d4d6f47de955a4 (patch) | |
tree | c7f052c6d7eb8fa6869864f0e890011d79a6a729 /tools/llc | |
parent | d5fe92efbc1774ada25a1cfa18009bfc5c6e625c (diff) | |
download | external_llvm-4e02eb0f67356762eeb12a75f8d4d6f47de955a4.zip external_llvm-4e02eb0f67356762eeb12a75f8d4d6f47de955a4.tar.gz external_llvm-4e02eb0f67356762eeb12a75f8d4d6f47de955a4.tar.bz2 |
Provide target data from the module if the target machine doesn't have any.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77973 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llc')
-rw-r--r-- | tools/llc/llc.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/tools/llc/llc.cpp b/tools/llc/llc.cpp index 5782e42..f581570 100644 --- a/tools/llc/llc.cpp +++ b/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) |