Hi,<br><br>Where you normally would add '-c' to the clang argument list to generate an object, instead add '-S -emit-llvm '. That will generate you a textual IR file that you can inspect. <br><br>Cheers,<br><br>James<br><div class="gmail_quote"><div dir="ltr">On Tue, 11 Aug 2015 at 05:28, 修心 <<a href="mailto:haifeng_q@foxmail.com">haifeng_q@foxmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>
<div style="WHITE-SPACE:normal;WORD-SPACING:0px;TEXT-TRANSFORM:none;COLOR:rgb(0,0,0);FONT:14px/21px 微软雅黑;LETTER-SPACING:normal;BACKGROUND-COLOR:rgb(255,255,255);TEXT-INDENT:0px">HI!</div>
<div style="WHITE-SPACE:normal;WORD-SPACING:0px;TEXT-TRANSFORM:none;COLOR:rgb(0,0,0);FONT:14px/21px 微软雅黑;LETTER-SPACING:normal;BACKGROUND-COLOR:rgb(255,255,255);TEXT-INDENT:0px"><br></div>
<div style="WHITE-SPACE:normal;WORD-SPACING:0px;TEXT-TRANSFORM:none;COLOR:rgb(0,0,0);FONT:14px/21px 微软雅黑;LETTER-SPACING:normal;BACKGROUND-COLOR:rgb(255,255,255);TEXT-INDENT:0px"><span style="COLOR:rgb(0,0,0)"> </span><span style="FONT-SIZE:10.5pt;LINE-HEIGHT:1.5;BACKGROUND-COLOR:window">How</span><span style="FONT-SIZE:10.5pt;LINE-HEIGHT:1.5;BACKGROUND-COLOR:window"><span> </span>the<span> </span></span><span style="FONT-SIZE:10.5pt;LINE-HEIGHT:1.5;BACKGROUND-COLOR:window">generated</span><span style="FONT-SIZE:10.5pt;LINE-HEIGHT:1.5;BACKGROUND-COLOR:window"><span> </span></span><span style="FONT-SIZE:10.5pt;LINE-HEIGHT:1.5;BACKGROUND-COLOR:window">LLVM IR with clang? </span></div>
<div style="WHITE-SPACE:normal;WORD-SPACING:0px;TEXT-TRANSFORM:none;COLOR:rgb(0,0,0);FONT:14px/21px 微软雅黑;LETTER-SPACING:normal;BACKGROUND-COLOR:rgb(255,255,255);TEXT-INDENT:0px"><span style="FONT-SIZE:10.5pt;LINE-HEIGHT:1.5;BACKGROUND-COLOR:window"> </span><span style="FONT-SIZE:10.5pt;LINE-HEIGHT:1.5;BACKGROUND-COLOR:window">Want</span><span style="FONT-SIZE:10.5pt;LINE-HEIGHT:1.5;BACKGROUND-COLOR:window"> </span><span style="FONT-SIZE:10.5pt;LINE-HEIGHT:1.5;BACKGROUND-COLOR:window">to</span><span style="FONT-SIZE:10.5pt;LINE-HEIGHT:1.5;BACKGROUND-COLOR:window"><span> </span></span><span style="FONT-SIZE:10.5pt;LINE-HEIGHT:1.5;BACKGROUND-COLOR:window">learn </span><span style="FONT-SIZE:10.5pt;LINE-HEIGHT:1.5;BACKGROUND-COLOR:window">By</span><span style="FONT-SIZE:10.5pt;LINE-HEIGHT:1.5;BACKGROUND-COLOR:window"><span> </span></span><span style="FONT-SIZE:10.5pt;LINE-HEIGHT:1.5;BACKGROUND-COLOR:window">IR<span> </span></span><span style="FONT-SIZE:10.5pt;LINE-HEIGHT:1.5;BACKGROUND-COLOR:window">files </span><span style="FONT-SIZE:10.5pt;LINE-HEIGHT:1.5;BACKGROUND-COLOR:window">how to</span><span style="FONT-SIZE:10.5pt;LINE-HEIGHT:1.5;BACKGROUND-COLOR:window"><span> </span></span><span style="FONT-SIZE:10.5pt;LINE-HEIGHT:1.5;BACKGROUND-COLOR:window">use</span><span style="FONT-SIZE:10.5pt;LINE-HEIGHT:1.5;BACKGROUND-COLOR:window"><span> </span>the<span> </span></span><span style="FONT-SIZE:10.5pt;LINE-HEIGHT:1.5;BACKGROUND-COLOR:window">external</span><span style="FONT-SIZE:10.5pt;LINE-HEIGHT:1.5;BACKGROUND-COLOR:window"><span> </span></span><span style="FONT-SIZE:10.5pt;LINE-HEIGHT:1.5;BACKGROUND-COLOR:window">Library<span> </span></span><span style="FONT-SIZE:10.5pt;LINE-HEIGHT:1.5;BACKGROUND-COLOR:window">type ?</span></div>
<div style="WHITE-SPACE:normal;WORD-SPACING:0px;TEXT-TRANSFORM:none;COLOR:rgb(0,0,0);FONT:14px/21px 微软雅黑;LETTER-SPACING:normal;BACKGROUND-COLOR:rgb(255,255,255);TEXT-INDENT:0px"><span style="FONT-SIZE:10.5pt;LINE-HEIGHT:1.5;BACKGROUND-COLOR:window"><br></span></div>
<div style="WHITE-SPACE:normal;WORD-SPACING:0px;TEXT-TRANSFORM:none;COLOR:rgb(0,0,0);FONT:14px/21px 微软雅黑;LETTER-SPACING:normal;BACKGROUND-COLOR:rgb(255,255,255);TEXT-INDENT:0px"><span style="FONT-SIZE:10.5pt;LINE-HEIGHT:1.5;BACKGROUND-COLOR:window"> My code:</span></div>
<div style="WHITE-SPACE:normal;WORD-SPACING:0px;TEXT-TRANSFORM:none;COLOR:rgb(0,0,0);FONT:14px/21px 微软雅黑;LETTER-SPACING:normal;BACKGROUND-COLOR:rgb(255,255,255);TEXT-INDENT:0px"><span style="FONT-SIZE:10.5pt;LINE-HEIGHT:1.5;BACKGROUND-COLOR:window"><br></span></div>
<div style="WHITE-SPACE:normal;WORD-SPACING:0px;TEXT-TRANSFORM:none;COLOR:rgb(0,0,0);FONT:14px/21px 微软雅黑;LETTER-SPACING:normal;BACKGROUND-COLOR:rgb(255,255,255);TEXT-INDENT:0px"><span style="FONT-SIZE:10.5pt;LINE-HEIGHT:1.5;BACKGROUND-COLOR:window">#include <string></span></div><span style="WHITE-SPACE:normal;WORD-SPACING:0px;TEXT-TRANSFORM:none;FLOAT:none;COLOR:rgb(0,0,0);FONT:14px/21px 微软雅黑;DISPLAY:inline!important;LETTER-SPACING:normal;BACKGROUND-COLOR:rgb(255,255,255);TEXT-INDENT:0px">#include <iostream></span><br style="WHITE-SPACE:normal;WORD-SPACING:0px;TEXT-TRANSFORM:none;COLOR:rgb(0,0,0);FONT:14px/21px 微软雅黑;LETTER-SPACING:normal;BACKGROUND-COLOR:rgb(255,255,255);TEXT-INDENT:0px"><br style="WHITE-SPACE:normal;WORD-SPACING:0px;TEXT-TRANSFORM:none;COLOR:rgb(0,0,0);FONT:14px/21px 微软雅黑;LETTER-SPACING:normal;BACKGROUND-COLOR:rgb(255,255,255);TEXT-INDENT:0px"><br style="WHITE-SPACE:normal;WORD-SPACING:0px;TEXT-TRANSFORM:none;COLOR:rgb(0,0,0);FONT:14px/21px 微软雅黑;LETTER-SPACING:normal;BACKGROUND-COLOR:rgb(255,255,255);TEXT-INDENT:0px"><span style="WHITE-SPACE:normal;WORD-SPACING:0px;TEXT-TRANSFORM:none;FLOAT:none;COLOR:rgb(0,0,0);FONT:14px/21px 微软雅黑;DISPLAY:inline!important;LETTER-SPACING:normal;BACKGROUND-COLOR:rgb(255,255,255);TEXT-INDENT:0px">int main(int argc, char* argv[])</span><br style="WHITE-SPACE:normal;WORD-SPACING:0px;TEXT-TRANSFORM:none;COLOR:rgb(0,0,0);FONT:14px/21px 微软雅黑;LETTER-SPACING:normal;BACKGROUND-COLOR:rgb(255,255,255);TEXT-INDENT:0px"><span style="WHITE-SPACE:normal;WORD-SPACING:0px;TEXT-TRANSFORM:none;FLOAT:none;COLOR:rgb(0,0,0);FONT:14px/21px 微软雅黑;DISPLAY:inline!important;LETTER-SPACING:normal;BACKGROUND-COLOR:rgb(255,255,255);TEXT-INDENT:0px">{</span><br style="WHITE-SPACE:normal;WORD-SPACING:0px;TEXT-TRANSFORM:none;COLOR:rgb(0,0,0);FONT:14px/21px 微软雅黑;LETTER-SPACING:normal;BACKGROUND-COLOR:rgb(255,255,255);TEXT-INDENT:0px"><span style="white-space:pre-wrap;WORD-SPACING:0px;TEXT-TRANSFORM:none;COLOR:rgb(0,0,0);FONT:14px/21px 微软雅黑;LETTER-SPACING:normal;BACKGROUND-COLOR:rgb(255,255,255);TEXT-INDENT:0px"></span><span style="WHITE-SPACE:normal;WORD-SPACING:0px;TEXT-TRANSFORM:none;FLOAT:none;COLOR:rgb(0,0,0);FONT:14px/21px 微软雅黑;DISPLAY:inline!important;LETTER-SPACING:normal;BACKGROUND-COLOR:rgb(255,255,255);TEXT-INDENT:0px">std::wstring strOut = L"error msg!";</span><br style="WHITE-SPACE:normal;WORD-SPACING:0px;TEXT-TRANSFORM:none;COLOR:rgb(0,0,0);FONT:14px/21px 微软雅黑;LETTER-SPACING:normal;BACKGROUND-COLOR:rgb(255,255,255);TEXT-INDENT:0px"><span style="white-space:pre-wrap;WORD-SPACING:0px;TEXT-TRANSFORM:none;COLOR:rgb(0,0,0);FONT:14px/21px 微软雅黑;LETTER-SPACING:normal;BACKGROUND-COLOR:rgb(255,255,255);TEXT-INDENT:0px"></span><span style="WHITE-SPACE:normal;WORD-SPACING:0px;TEXT-TRANSFORM:none;FLOAT:none;COLOR:rgb(0,0,0);FONT:14px/21px 微软雅黑;DISPLAY:inline!important;LETTER-SPACING:normal;BACKGROUND-COLOR:rgb(255,255,255);TEXT-INDENT:0px">std::wcout << strOut << std::endl;</span><br style="WHITE-SPACE:normal;WORD-SPACING:0px;TEXT-TRANSFORM:none;COLOR:rgb(0,0,0);FONT:14px/21px 微软雅黑;LETTER-SPACING:normal;BACKGROUND-COLOR:rgb(255,255,255);TEXT-INDENT:0px"><br style="WHITE-SPACE:normal;WORD-SPACING:0px;TEXT-TRANSFORM:none;COLOR:rgb(0,0,0);FONT:14px/21px 微软雅黑;LETTER-SPACING:normal;BACKGROUND-COLOR:rgb(255,255,255);TEXT-INDENT:0px"><span style="white-space:pre-wrap;WORD-SPACING:0px;TEXT-TRANSFORM:none;COLOR:rgb(0,0,0);FONT:14px/21px 微软雅黑;LETTER-SPACING:normal;BACKGROUND-COLOR:rgb(255,255,255);TEXT-INDENT:0px"></span><span style="WHITE-SPACE:normal;WORD-SPACING:0px;TEXT-TRANSFORM:none;FLOAT:none;COLOR:rgb(0,0,0);FONT:14px/21px 微软雅黑;DISPLAY:inline!important;LETTER-SPACING:normal;BACKGROUND-COLOR:rgb(255,255,255);TEXT-INDENT:0px">return 0;</span><br style="WHITE-SPACE:normal;WORD-SPACING:0px;TEXT-TRANSFORM:none;COLOR:rgb(0,0,0);FONT:14px/21px 微软雅黑;LETTER-SPACING:normal;BACKGROUND-COLOR:rgb(255,255,255);TEXT-INDENT:0px"><span style="WHITE-SPACE:normal;WORD-SPACING:0px;TEXT-TRANSFORM:none;FLOAT:none;COLOR:rgb(0,0,0);FONT:14px/21px 微软雅黑;DISPLAY:inline!important;LETTER-SPACING:normal;BACKGROUND-COLOR:rgb(255,255,255);TEXT-INDENT:0px">}</span></div>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div>