<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><a name="_MailEndCompose"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Using byte_size=16, bit_size=80 (and optional data_bit_offset) would be the right way to go as far as the DWARF spec is concerned.<o:p></o:p></span></a></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Persuading TypeInfo to describe something that would generate this is really the question.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">--paulr<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> aprantl@apple.com [mailto:aprantl@apple.com]
<br>
<b>Sent:</b> Monday, November 02, 2015 8:39 AM<br>
<b>To:</b> Keno Fischer<br>
<b>Cc:</b> llvm-dev; Duncan P. N. Exon Smith; David Blaikie; Eric Christopher; Robinson, Paul<br>
<b>Subject:</b> Re: Representing X86 long double in Debug Info<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal">On Nov 1, 2015, at 3:14 AM, Keno Fischer <<a href="mailto:kfischer@college.harvard.edu">kfischer@college.harvard.edu</a>> wrote:<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<div>
<p class="MsoNormal">I'm in the process of teaching the Verifier to validate that the size of debug info variable and the described value matches (already caught a couple of bugs, both in my frontend and in LLVM itself). However, I've run into the following:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<div>
<p class="MsoNormal">size of passed value (80) does not match size of declared variable (128)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> call void @llvm.dbg.declare(metadata x86_fp80* %x, metadata !11, metadata !13), !dbg !14<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> %x = alloca x86_fp80, align 16<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">!11 = !DILocalVariable(name: "x", scope: !4, file: !1, line: 2, type: !12)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">!12 = !DIBasicType(name: "long double", size: 128, align: 128, encoding: DW_ATE_float)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">!13 = !DIExpression()<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">which happens because llvm knows that fp80s are 80bits, while clang declares them as 128bits in the debug info. We might have to special case this in the verifier, but before we do that, I wanted to ask about the following:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Reading the DWARF standard, it seems like the following would be a valid description of an X86 80bit long double:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">DW_TAG_base_type<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">DW_AT_name "long double"<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">DW_AT_byte_size 16<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">DW_AT_bit_size 80<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">As far as I can tell from looking through the source code, both LLDB and GDB would read this just fine, it would be a more accurate description of a long double and if we add support for it in LLVM IR, the verifier would be able to understand
what's actually going on. Does this seem like a reasonable thing to have LLVM do or would you prefer to just disable this check in the verifier if there are x86_fp80 types around?<o:p></o:p></p>
</div>
</div>
</div>
</blockquote>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Looking at the code in clang CGDebugInfo just passes through the width of the type as it is described by the TypeInfo, which in turn is defined by the Target. At the moment I do not understand why an x86_fp80 is reported to be 128 bits
wide. (Since it’s a type natively supported by LLVM <a href="http://llvm.org/docs/LangRef.html#floating-point-types">http://llvm.org/docs/LangRef.html#floating-point-types</a> I would have expected it to be more like size=80, align=128)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">This looks like a bug to me and the debug info should describe an x86_fp80 as being 80 bits wide, but I don’t understand the mechanics well enough to decide whether the TypeInfo is wrong here or if we should work around it in CGDebugInfo.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<div>
<p class="MsoNormal">[Summoning more people who may have a better idea]<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
<div>
<p class="MsoNormal">-- adrian<o:p></o:p></p>
</div>
</div>
</div>
</body>
</html>