Hi everyone, I was happily using MCJIT for over a year until yesterday when I created a function call with an argument of a struct type. That caused a crash in SelectionDAG around DataLayout::getAlignment(). I remember the noise about the DataLayout started being mandatory. But I cannot find precise information. Should I set the DataLayout in every Module created? Where can I get the DataLayout for the host process from? Can a DataLayout instance be shared between modules? - Paweł -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160505/716ff0a1/attachment.html>
Pawel, Hopefully this provides a partial answer: when using MCJIT I set the data layout for every module. My code looks roughly like: TargetRegistry::lookupTarget(sys::getProcessTriple())-> createTargetMachine()->createDataLayout(); -Josh On Thu, May 5, 2016 at 5:34 AM, Paweł Bylica <llvm-dev at lists.llvm.org> wrote:> Hi everyone, > > I was happily using MCJIT for over a year until yesterday when I created a > function call with an argument of a struct type. That caused a crash in > SelectionDAG around DataLayout::getAlignment(). > > I remember the noise about the DataLayout started being mandatory. But I > cannot find precise information. > > Should I set the DataLayout in every Module created? > > Where can I get the DataLayout for the host process from? > > Can a DataLayout instance be shared between modules? > > - Paweł > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160505/49e515c2/attachment.html>
Another approach that we use - we just wipe the DataLayout on the module about to be handed to the ExecutionEngine, and in MCJIT.cpp there is a line that says 'if datalayout isDefault() (eg. empty string representation "") set it to the datalayout of the Target Machine'. Cheers, -Neil. On 05/05/16 13:48, Josh Klontz via llvm-dev wrote:> Pawel, > > Hopefully this provides a partial answer: when using MCJIT I set the > data layout for every module. My code looks roughly like: > > TargetRegistry::lookupTarget(sys::getProcessTriple())->createTargetMachine()->createDataLayout(); > > -Josh > > On Thu, May 5, 2016 at 5:34 AM, Paweł Bylica <llvm-dev at lists.llvm.org > <mailto:llvm-dev at lists.llvm.org>> wrote: > > Hi everyone, > > I was happily using MCJIT for over a year until yesterday when I > created a function call with an argument of a struct type. That > caused a crash in SelectionDAG around DataLayout::getAlignment(). > > I remember the noise about the DataLayout started being mandatory. > But I cannot find precise information. > > Should I set the DataLayout in every Module created? > > Where can I get the DataLayout for the host process from? > > Can a DataLayout instance be shared between modules? > > - Paweł > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > > > > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160505/bf00c919/attachment.html>