path: root/tools/llc
diff options
authorRafael Espindola <>2014-02-25 23:25:17 +0000
committerRafael Espindola <>2014-02-25 23:25:17 +0000
commit356deb5ecde78fdef706e325325c23c828666b9f (patch)
tree21aa8a0fb4fed7044dc5449561035d3d8e26a825 /tools/llc
parent7e2bf3c6f908cc79dd48c69f86920a3826141e72 (diff)
Use DataLayout from the module when easily available.
Eventually DataLayoutPass should go away, but for now that is the only easy way to get a DataLayout in some APIs. This patch only changes the ones that have easy access to a Module. One interesting issue with sometimes using DataLayoutPass and sometimes fetching it from the Module is that we have to make sure they are equivalent. We can get most of the way there by always constructing the pass with a Module. In fact, the pass could be changed to point to an external DataLayout instead of owning one to make this stricter. Unfortunately, the C api passes a DataLayout, so it has to be up to the caller to make sure the pass and the module are in sync. git-svn-id: 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llc')
1 files changed, 2 insertions, 3 deletions
diff --git a/tools/llc/llc.cpp b/tools/llc/llc.cpp
index 5b311cb6173..bb72f252fe4 100644
--- a/tools/llc/llc.cpp
+++ b/tools/llc/llc.cpp
@@ -299,9 +299,8 @@ static int compileModule(char **argv, LLVMContext &Context) {
// Add the target data from the target machine, if it exists, or the module.
if (const DataLayout *DL = Target.getDataLayout())
- PM.add(new DataLayoutPass(*DL));
- else
- PM.add(new DataLayoutPass(mod));
+ mod->setDataLayout(DL);
+ PM.add(new DataLayoutPass(mod));
// Override default to generate verbose assembly.