Ok, thanks, this makes sense. But there is no way to get the SelectionDAG to do it for me via something like visitGetElementrPtr? On Thu, Dec 8, 2011 at 2:54 PM, Eli Friedman <eli.friedman at gmail.com> wrote:> > On Thu, Dec 8, 2011 at 2:37 PM, Ryan Taylor <ryta1203 at gmail.com> wrote: > >> > >> Thanks. > >> > >> So basically then this operation is not target-independent like the docs > >> suggest? > > It is target-independent in the sense that a frontend can generate > code using GEP's without worrying about how a given target actually > lays out structures. It isn't target-independent in the sense that > the actual computed offset in bytes isn't the same for every target. > See also > http://nondot.org/sabre/LLVMNotes/SizeOf-OffsetOf-VariableSizedStructs.txt > . > > -Eli >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20111208/4aefbbeb/attachment.html>
On Thu, Dec 8, 2011 at 3:29 PM, Ryan Taylor <ryta1203 at gmail.com> wrote:> Ok, thanks, this makes sense. But there is no way to get the SelectionDAG to > do it for me via something like visitGetElementrPtr?SelectionDAGBuilder::visitGetElementPtr uses the same algorithm you want to use, but it is specialized for building a SelectionDAG, which is lower level than LLVM IR. -Eli> > > On Thu, Dec 8, 2011 at 2:54 PM, Eli Friedman <eli.friedman at gmail.com> wrote: >> >> > On Thu, Dec 8, 2011 at 2:37 PM, Ryan Taylor <ryta1203 at gmail.com> wrote: >> >> >> >> Thanks. >> >> >> >> So basically then this operation is not target-independent like the >> >> docs >> >> suggest? >> >> It is target-independent in the sense that a frontend can generate >> code using GEP's without worrying about how a given target actually >> lays out structures. It isn't target-independent in the sense that >> the actual computed offset in bytes isn't the same for every target. >> See also >> http://nondot.org/sabre/LLVMNotes/SizeOf-OffsetOf-VariableSizedStructs.txt >> . >> >> -Eli > >
Eli, Ok, thanks, this is a big help. So how can I use the TargetData (or get the TargetData) without having a DAG? On Thu, Dec 8, 2011 at 3:45 PM, Eli Friedman <eli.friedman at gmail.com> wrote:> On Thu, Dec 8, 2011 at 3:29 PM, Ryan Taylor <ryta1203 at gmail.com> wrote: > > Ok, thanks, this makes sense. But there is no way to get the > SelectionDAG to > > do it for me via something like visitGetElementrPtr? > > SelectionDAGBuilder::visitGetElementPtr uses the same algorithm you > want to use, but it is specialized for building a SelectionDAG, which > is lower level than LLVM IR. > > -Eli > > > > > > > On Thu, Dec 8, 2011 at 2:54 PM, Eli Friedman <eli.friedman at gmail.com> > wrote: > >> > >> > On Thu, Dec 8, 2011 at 2:37 PM, Ryan Taylor <ryta1203 at gmail.com> > wrote: > >> >> > >> >> Thanks. > >> >> > >> >> So basically then this operation is not target-independent like the > >> >> docs > >> >> suggest? > >> > >> It is target-independent in the sense that a frontend can generate > >> code using GEP's without worrying about how a given target actually > >> lays out structures. It isn't target-independent in the sense that > >> the actual computed offset in bytes isn't the same for every target. > >> See also > >> > http://nondot.org/sabre/LLVMNotes/SizeOf-OffsetOf-VariableSizedStructs.txt > >> . > >> > >> -Eli > > > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20111208/29326cbd/attachment.html>