<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jan 30, 2015 at 10:37 PM, reed kotler <span dir="ltr"><<a href="mailto:rkotler@mips.com" target="_blank">rkotler@mips.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div>Ok.<br>
<br>
I'm basically just following the model of the other fast-isel
ports.</div></div></blockquote><div><br></div><div>Yeah, not your fault - just an architectural quirk.<br><br>It's possible we could workaround the debug info side of this by declaring the virtual dtor (or some other virtual function - even an explicit anchor as we have in some other places) and defining it out of line.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div bgcolor="#FFFFFF" text="#000000"><div><div><div class="h5"><br>
<br>
On 01/30/2015 09:12 PM, David Blaikie wrote:<br>
</div></div></div><div><div class="h5">
<blockquote type="cite">
<div dir="ltr">(I'm assuming you're building LLVM with clang, in
this case?)<br>
<br>
Looks like IntrinsicInst is one of those "lies" in LLVM that
works via type punning that's undefined behavior in C++, so it's
code that should be fixed anyway.<br>
<br>
In any case, the reason this produces the debugging experience
you're seeing is that LLVM (& GCC, for that matter) assumes
that if your class has virtual functions, such as IntrinsicInst,
here - then to use the type one must've emitted the vtable for
the type somewhere (the C++ standard requires this - if you odr
use the type, all the virtual functions must be defined
somewhere in the program). The debug info emission attempts to
reduce the number of times the debug info for the type is
emitted by piggybacking on this fact - producing the type
definition only where the vtable is produced.<br>
<br>
As it turns out, with this class, the vtable is never emitted.
This is because the type has no key function (no non-inline
virtual function) and the ctor itself is never emitted, so the
vtable is never needed... and thus no debug info.<br>
<br>
The right way to fix this is to stop relying on undefined type
punning - though I don't know enough about the APIs here to say
just how to achieve that goal.<br>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Fri, Jan 30, 2015 at 8:55 PM, reed
kotler <span dir="ltr"><<a href="mailto:rkotler@mips.com" target="_blank">rkotler@mips.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">When
trying to display and do anything with a variable of type
IntrinsicInst, gdb thinks that it's an incomplete<br>
type and kind find any member functions or even display
the class.<br>
<br>
<br>
<br>
<br>
(gdb) list 1337<br>
1332<br>
1333 // Finish off the call including any return
values.<br>
1334 return finishCall(CLI, RetVT, NumBytes);<br>
1335 }<br>
1336<br>
1337 bool MipsFastISel::fastLowerIntrinsicCall(const
IntrinsicInst *II) {<br>
1338 switch (II->getIntrinsicID()) {<br>
1339 default:<br>
1340 return false;<br>
1341 case Intrinsic::bswap: {<br>
(gdb) print II<br>
$10 = (const llvm::IntrinsicInst *) 0x61b8ec8<br>
(gdb) print *II<br>
$11 = <incomplete type><br>
(gdb) call II->getIntrinsicID()<br>
Couldn't find method llvm::IntrinsicInst::getIntrinsicID<br>
(gdb)<br>
<br>
<br>
However, up the call tree:<br>
<br>
(gdb) frame 3<br>
#3 0x000000000368db6d in llvm::FastISel::selectOperator
(this=0x6235290,<br>
I=0x61b8ec8, Opcode=49)<br>
at /home/rkotler/workspace/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp:1535<br>
1535 return selectCall(I);<br>
(gdb) list 1535<br>
1530<br>
1531 // Dynamic-sized alloca is not handled yet.<br>
1532 return false;<br>
1533<br>
1534 case Instruction::Call:<br>
1535 return selectCall(I);<br>
1536<br>
1537 case Instruction::BitCast:<br>
1538 return selectBitCast(I);<br>
1539<br>
(gdb) call I->dump()<br>
%2 = call float @llvm.powi.f32(float %0, i32 %1)<br>
(gdb)<br>
(gdb) print *I<br>
$12 = {<llvm::Value> = {<br>
_vptr$Value = 0x60c67f0 <vtable for
llvm::CallInst+16>, VTy = 0x61035c0,<br>
UseList = 0x61d3310, NameAndIsUsedByMD = {Value = 0},
SubclassID = 68 'D',<br>
HasValueHandle = 0 '\000', SubclassOptionalData = 0
'\000',<br>
SubclassData = 0, NumOperands = 3, static
MaximumAlignment = 536870912},<br>
OperandList = 0x61b8e80}<br>
(gdb)<br>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>
<a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</blockquote>
</div>
<br>
</div>
</div>
</blockquote>
<br>
</div></div></div>
</blockquote></div><br></div></div>