<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=ks_c_5601-1987">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:"¸¼Àº °íµñ";
panose-1:2 11 5 3 2 0 0 2 0 4;}
@font-face
{font-family:"\@¸¼Àº °íµñ";
panose-1:2 11 5 3 2 0 0 2 0 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
text-align:justify;
text-justify:inter-ideograph;
text-autospace:none;
word-break:break-hangul;
font-size:10.0pt;
font-family:"¸¼Àº °íµñ";}
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;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:40.0pt;
margin-bottom:.0001pt;
mso-para-margin-top:0cm;
mso-para-margin-right:0cm;
mso-para-margin-bottom:0cm;
mso-para-margin-left:4.0gd;
mso-para-margin-bottom:.0001pt;
text-align:justify;
text-justify:inter-ideograph;
text-autospace:none;
word-break:break-hangul;
font-size:10.0pt;
font-family:"¸¼Àº °íµñ";}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"¸¼Àº °íµñ";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;}
/* Page Definitions */
@page Section1
{size:612.0pt 792.0pt;
margin:3.0cm 72.0pt 72.0pt 72.0pt;}
div.Section1
{page:Section1;}
/* List Definitions */
@list l0
{mso-list-id:642387723;
mso-list-type:hybrid;
mso-list-template-ids:1109800386 220099956 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
{mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:38.0pt;
text-indent:-18.0pt;}
ol
{margin-bottom:0cm;}
ul
{margin-bottom:0cm;}
-->
</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=KO link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><span lang=EN-US>Hello~!<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>I¡¯m beginner about LLVM.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>My purpose is inserting a function call to
basic block, which is composed of IR codes.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>For this, I did following works.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>1) Generate bytecodes from c++ codes<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>2) Generate the C++ codes, composed of LLVM
APIs.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> $ llc –march=cpp main.bc -o=main_irgen.cpp<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>3) Insert function call APIs to the
generated C++ codes from step 2)<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>4) Compile the functional call inserted codes.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> $ g++ -O2 main_irgen.cpp `llvm-config
--cxxflags --ldflags --libs core` -o main_irgen.cpp<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> -> In this step, an error occurred.
The messages are as follows<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> g++: Internal error: segmentation
fault (program cc1plus)<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> <o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>When the generated ¡°main_irgen.cpp¡± file had
3000~4000 code lines, no error occurred. But, the file had over 30000 code
lines, internal error occurred.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>It was likely that the memory was lacking.
But the computer memory is 4G.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>If you know, give me the way to solve or
solution.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Thank¡¯U.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
</div>
</body>
</html>