<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=iso-8859-1">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Helvetica;
        panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@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.apple-style-span
        {mso-style-name:apple-style-span;}
span.apple-converted-space
        {mso-style-name:apple-converted-space;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</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 style='word-wrap: break-word;
-webkit-nbsp-mode: space;-webkit-line-break: after-white-space'>

<div class=Section1>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Hey Evan,<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>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>At the point of the instructions you suggested I step through,
X86ISelLowering has this state:<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>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>-                              this         0x00000000005fe728
{VarArgsFrameIndex=-842150451 RegSaveFrameIndex=-842150451
VarArgsGPOffset=3452816845 ...}            llvm::X86TargetLowering * const<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>+                             llvm::TargetLowering     {TM={...}
TD=0x00000000008edac0 IsLittleEndian=true ...}                llvm::TargetLowering<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>                                VarArgsFrameIndex       -842150451         int<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>                                RegSaveFrameIndex      -842150451         int<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>                                VarArgsGPOffset             3452816845         unsigned
int<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>                                VarArgsFPOffset              3452816845         unsigned
int<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>                                BytesToPopOnReturn    0              int<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>                                BytesCallerReserves       0              int<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>-                              Subtarget            0x00000000008eda90
{AsmFlavor=Intel PICStyle=None X86SSELevel=SSE2 ...}     const
llvm::X86Subtarget *<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>+                             llvm::TargetSubtarget    {...}         llvm::TargetSubtarget<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>                                AsmFlavor           Intel       llvm::X86Subtarget::AsmWriterFlavorTy<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>                                PICStyle               None     llvm::PICStyle::Style<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>                                X86SSELevel       SSE2       llvm::X86Subtarget::X86SSEEnum<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>                                X863DNowLevel               -842150451         llvm::X86Subtarget::X863DNowEnum<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>                                HasX86_64          true       bool<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>                                DarwinVers        0              unsigned
char<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>                                stackAlignment 8              unsigned
int<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>                                MaxInlineSizeThreshold               128         unsigned
int<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>                                Is64Bit   true       bool<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>                                HasLow4GUserAddress                true       bool<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>                                TargetType         isWindows          llvm::X86Subtarget::<unnamed-tag><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>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'>  <span style='color:blue'>if</span>
(GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee)) {<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'>    <span style='color:green'>// We should use extra
load for direct calls to dllimported functions in<o:p></o:p></span></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'>    <span style='color:green'>// non-JIT mode.<o:p></o:p></span></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:green'>  // it get’s into here<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'>    <span style='color:blue'>if</span> ((IsTailCall
|| !Is64Bit ||    // both these are false<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'>         getTargetMachine().getCodeModel() !=
CodeModel::Large)   // this is false<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'>        &&
!Subtarget->GVRequiresExtraLoad(G->getGlobal(),   // this is short
circuited away<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'>                                          
getTargetMachine(), <span style='color:blue'>true</span>))<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'>      Callee = DAG.getTargetGlobalAddress(G->getGlobal(),
getPointerTy());  // this is passed over because the test is false<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>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>  // since it made it through the if (Global…., it skips
down to <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>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'>  <span style='color:green'>// Returns a chain &
a flag for retval copy to use.<o:p></o:p></span></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'>  SDVTList NodeTys = DAG.getVTList(MVT::Other,
MVT::Flag);<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>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Thanks!<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>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Chuck.<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>

<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"'>
llvmdev-bounces@cs.uiuc.edu [mailto:llvmdev-bounces@cs.uiuc.edu] <b>On Behalf
Of </b>Evan Cheng<br>
<b>Sent:</b> Friday, February 15, 2008 9:35 AM<br>
<b>To:</b> LLVM Developers Mailing List<br>
<b>Subject:</b> Re: [LLVMdev] LLVM2.2 x64 JIT trouble on VStudio build<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>

<div>

<p class=MsoNormal>On Feb 12, 2008, at 5:26 PM, Chuck Rose III wrote:<o:p></o:p></p>

</div>

<p class=MsoNormal><br>
<br>
<o:p></o:p></p>

<div>

<div>

<div>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'>Hola LLVMers,<o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'> <o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'>I’m debugging through some strangeness that I’m seeing
on X64 on windows with LLVM2.2.  I had to change the code so that it would
engage the x64 target machine on windows builds, but I’ve otherwise left
LLVM 2.2 alone.  The basic idea is that I’ve got a function bar
which is compiled by VStudio and I’m creating another function foo via
LLVM JIT which is going to call into bar.  This has been working for me
for a long time on win32 and also under xcode of course.  I’ve
included the code that generates the situation at the bottom.  Some
questions (which may be really brain dead) are:<o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'> <o:p></o:p></span></p>

</div>

<div style='margin-left:.5in'>

<p class=MsoNormal style='text-indent:-.25in'><span style='font-size:11.0pt;
font-family:"Calibri","sans-serif";color:black'>1.</span><span
style='font-size:7.0pt;color:black'>      <span
class=apple-converted-space> </span></span><span style='font-size:11.0pt;
font-family:"Calibri","sans-serif";color:black'>Why isn’t the stack
getting set up in foo prior to the call down into bar?<o:p></o:p></span></p>

</div>

</div>

</div>

<div>

<p class=MsoNormal><o:p> </o:p></p>

</div>

<p class=MsoNormal>What is the triplet of the target? x86_64-win32?<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><br>
<br>
<o:p></o:p></p>

<div>

<div>

<div style='margin-left:.5in'>

<p class=MsoNormal style='text-indent:-.25in'><span style='font-size:11.0pt;
font-family:"Calibri","sans-serif";color:black'>2.</span><span
style='font-size:7.0pt;color:black'>      <span
class=apple-converted-space> </span></span><span style='font-size:11.0pt;
font-family:"Calibri","sans-serif";color:black'>Why is the call to bar a
pointer to a jump.  I.e. why didn’t it resolve the address in foo?<o:p></o:p></span></p>

</div>

</div>

</div>

<div>

<p class=MsoNormal><o:p> </o:p></p>

</div>

<p class=MsoNormal>Not sure. I can't reproduce this. Can you step through the
code in X86ISelLowering.cpp::LowerCALL()? Around<o:p></o:p></p>

</div>

<div>

<div>

<p class=MsoNormal>  // If the callee is a GlobalAddress node (quite
common, every direct call is)              
                     
                     
                     
                     
                     
      <o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>  // turn it into a TargetGlobalAddress node so
that legalize doesn't hack it.<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><o:p> </o:p></p>

</div>

<div>

<p class=MsoNormal>Evan<o:p></o:p></p>

</div>

</div>

<div>

<p class=MsoNormal><br>
<br>
<o:p></o:p></p>

<div>

<div>

<div style='margin-left:.5in'>

<p class=MsoNormal style='text-indent:-.25in'><span style='font-size:11.0pt;
font-family:"Calibri","sans-serif";color:black'>3.</span><span
style='font-size:7.0pt;color:black'>      <span
class=apple-converted-space> </span></span><span style='font-size:11.0pt;
font-family:"Calibri","sans-serif";color:black'>What are some good places for
me to be looking to try and drill down further on what’s happening? 
I’ve tried switching calling conventions and have watched it create
machine instructions for adjusting the stack up and down, but they seem to be
removed by the time it actually gets down to execution time.<o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'> <o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'>Any suggestions would be appreciated.<o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'> <o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'>Thanks,<o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'>Chuck.<o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'> <o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'>Call into function (foo)<o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:8.0pt;font-family:"Courier New";
color:gray'>0000000000980030 
mov         rax,140001591h</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:8.0pt;font-family:"Courier New";
color:gray'>000000000098003A 
call        rax 
                 </span><span
style='font-size:8.0pt;font-family:Wingdings;color:gray'>ß</span><span
class=apple-converted-space><span style='font-size:8.0pt;font-family:"Courier New";
color:gray'> </span></span><span style='font-size:8.0pt;font-family:"Courier New";
color:gray'>this is calling to bar via a jump table</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:8.0pt;font-family:"Courier New";
color:gray'>000000000098003C 
ret             </span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'> <o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'>Leads to<o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:8.0pt;font-family:"Courier New";
color:gray'>0000000140001591 
jmp         bar (1400064E0h)</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'> <o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'>Leads to<o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:8.0pt;font-family:"Courier New";
color:black'>void bar(int i)</span><span style='font-size:11.0pt;font-family:
"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:8.0pt;font-family:"Courier New";
color:black'>{</span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:8.0pt;font-family:"Courier New";
color:gray'>00000001400064E0 
mov         dword ptr [rsp+8],ecx</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:8.0pt;font-family:"Courier New";
color:gray'>00000001400064E4 
push        rdi </span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:8.0pt;font-family:"Courier New";
color:gray'>00000001400064E5 
sub         rsp,20h</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:8.0pt;font-family:"Courier New";
color:gray'>00000001400064E9 
mov         rdi,rsp</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:8.0pt;font-family:"Courier New";
color:gray'>00000001400064EC 
mov         rcx,8</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:8.0pt;font-family:"Courier New";
color:gray'>00000001400064F6 
mov         eax,0CCCCCCCCh</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:8.0pt;font-family:"Courier New";
color:gray'>00000001400064FB  rep stos    dword ptr [rdi]</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:8.0pt;font-family:"Courier New";
color:gray'>00000001400064FD 
mov         ecx,dword ptr [rsp+30h]</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:8.0pt;font-family:"Courier New";
color:black'>    printf("the int is %i\n",i);</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:8.0pt;font-family:"Courier New";
color:gray'>0000000140006501 
mov         edx,dword ptr [i]</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:8.0pt;font-family:"Courier New";
color:gray'>0000000140006505 
lea         rcx,[string "the int
is %i\n" (140C1A240h)]</span><span style='font-size:11.0pt;font-family:
"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:8.0pt;font-family:"Courier New";
color:gray'>000000014000650C 
call        qword ptr [__imp_printf
(141145920h)]</span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:8.0pt;font-family:"Courier New";
color:black'>}</span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:8.0pt;font-family:"Courier New";
color:gray'>0000000140006512 
add         rsp,20h</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:8.0pt;font-family:"Courier New";
color:gray'>0000000140006516 
pop         rdi </span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:8.0pt;font-family:"Courier New";
color:gray'>0000000140006517 
ret             </span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'> <o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'>At this point, we seem to be jumping back up but the stack is no
longer in order, so<o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:8.0pt;font-family:"Courier New";
color:gray'>000000000098003C 
ret             </span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'> <o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'>Takes us into wonderland<o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:8.0pt;font-family:"Courier New";
color:gray'>0000000100000003 
???             </span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'> <o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'>But unfortunately not through the looking glass.<o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'> <o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'>Here’s the modification of the Fibonacci program which got
me the above:<o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:blue'>#include</span><span class=apple-converted-space><span
style='font-size:10.0pt;font-family:"Courier New";color:black'> </span></span><span
style='font-size:10.0pt;font-family:"Courier New";color:#A31515'>"llvm/Module.h"</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:blue'>#include</span><span class=apple-converted-space><span
style='font-size:10.0pt;font-family:"Courier New";color:black'> </span></span><span
style='font-size:10.0pt;font-family:"Courier New";color:#A31515'>"llvm/DerivedTypes.h"</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:blue'>#include</span><span class=apple-converted-space><span
style='font-size:10.0pt;font-family:"Courier New";color:black'> </span></span><span
style='font-size:10.0pt;font-family:"Courier New";color:#A31515'>"llvm/Constants.h"</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:blue'>#include</span><span class=apple-converted-space><span
style='font-size:10.0pt;font-family:"Courier New";color:black'> </span></span><span
style='font-size:10.0pt;font-family:"Courier New";color:#A31515'>"llvm/Instructions.h"</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:blue'>#include</span><span class=apple-converted-space><span
style='font-size:10.0pt;font-family:"Courier New";color:black'> </span></span><span
style='font-size:10.0pt;font-family:"Courier New";color:#A31515'>"llvm/ModuleProvider.h"</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:blue'>#include</span><span class=apple-converted-space><span
style='font-size:10.0pt;font-family:"Courier New";color:black'> </span></span><span
style='font-size:10.0pt;font-family:"Courier New";color:#A31515'>"llvm/Analysis/Verifier.h"</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:blue'>#include</span><span class=apple-converted-space><span
style='font-size:10.0pt;font-family:"Courier New";color:black'> </span></span><span
style='font-size:10.0pt;font-family:"Courier New";color:#A31515'>"llvm/ExecutionEngine/JIT.h"</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:blue'>#include</span><span class=apple-converted-space><span
style='font-size:10.0pt;font-family:"Courier New";color:black'> </span></span><span
style='font-size:10.0pt;font-family:"Courier New";color:#A31515'>"llvm/ExecutionEngine/Interpreter.h"</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:blue'>#include</span><span class=apple-converted-space><span
style='font-size:10.0pt;font-family:"Courier New";color:black'> </span></span><span
style='font-size:10.0pt;font-family:"Courier New";color:#A31515'>"llvm/ExecutionEngine/GenericValue.h"</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:blue'>#include</span><span class=apple-converted-space><span
style='font-size:10.0pt;font-family:"Courier New";color:black'> </span></span><span
style='font-size:10.0pt;font-family:"Courier New";color:#A31515'>"llvm/System/DynamicLibrary.h"</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:blue'>#include</span><span class=apple-converted-space><span
style='font-size:10.0pt;font-family:"Courier New";color:black'> </span></span><span
style='font-size:10.0pt;font-family:"Courier New";color:#A31515'>"llvm/CallingConv.h"</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:blue'>#include</span><span class=apple-converted-space><span
style='font-size:10.0pt;font-family:"Courier New";color:black'> </span></span><span
style='font-size:10.0pt;font-family:"Courier New";color:#A31515'><iostream></span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:blue'>#include</span><span class=apple-converted-space><span
style='font-size:10.0pt;font-family:"Courier New";color:black'> </span></span><span
style='font-size:10.0pt;font-family:"Courier New";color:#A31515'><stdio.h></span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:blue'>using</span><span class=apple-converted-space><span
style='font-size:10.0pt;font-family:"Courier New";color:black'> </span></span><span
style='font-size:10.0pt;font-family:"Courier New";color:blue'>namespace</span><span
class=apple-converted-space><span style='font-size:10.0pt;font-family:"Courier New";
color:black'> </span></span><span style='font-size:10.0pt;font-family:
"Courier New";color:black'>llvm;</span><span style='font-size:11.0pt;
font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'> </span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:blue'>void</span><span class=apple-converted-space><span
style='font-size:10.0pt;font-family:"Courier New";color:black'> </span></span><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>bar(</span><span
style='font-size:10.0pt;font-family:"Courier New";color:blue'>int</span><span
class=apple-converted-space><span style='font-size:10.0pt;font-family:"Courier New";
color:black'> </span></span><span style='font-size:10.0pt;font-family:
"Courier New";color:black'>i)</span><span style='font-size:11.0pt;font-family:
"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>{</span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>    printf(</span><span style='font-size:10.0pt;
font-family:"Courier New";color:#A31515'>"the int is %i\n"</span><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>,i);</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>}</span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'> </span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>Function* createBarFunction(Module* M)</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>{</span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>    Function* pBarF =
cast<Function>(M->getOrInsertFunction(</span><span style='font-size:
10.0pt;font-family:"Courier New";color:#A31515'>"bar"</span><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>, Type::VoidTy,
Type::Int32Ty, NULL));</span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>   <span class=apple-converted-space> </span></span><span
style='font-size:10.0pt;font-family:"Courier New";color:blue'>return</span><span
class=apple-converted-space><span style='font-size:10.0pt;font-family:"Courier New";
color:black'> </span></span><span style='font-size:10.0pt;font-family:
"Courier New";color:black'>pBarF;</span><span style='font-size:11.0pt;
font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>}</span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'> </span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>Function* createFooFunction(Module* M)</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>{</span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>    Function* pBarF = createBarFunction(M),</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>           
* pFooF;</span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'> </span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>    pFooF =
cast<Function>(M->getOrInsertFunction(</span><span style='font-size:
10.0pt;font-family:"Courier New";color:#A31515'>"foo"</span><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>, Type::VoidTy,
Type::Int32Ty, NULL));</span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>    BasicBlock* pBody =<span
class=apple-converted-space> </span></span><span style='font-size:10.0pt;
font-family:"Courier New";color:blue'>new</span><span
class=apple-converted-space><span style='font-size:10.0pt;font-family:"Courier New";
color:black'> </span></span><span style='font-size:10.0pt;font-family:
"Courier New";color:black'>BasicBlock(</span><span style='font-size:10.0pt;
font-family:"Courier New";color:#A31515'>"body"</span><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>,pFooF);</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>    Argument* pArg = pFooF->arg_begin();</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>    pArg->setName(</span><span style='font-size:
10.0pt;font-family:"Courier New";color:#A31515'>"i"</span><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>);</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>    std::vector<Value*> barArgs;</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>    barArgs.push_back(pArg);</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>   <span class=apple-converted-space> </span></span><span
style='font-size:10.0pt;font-family:"Courier New";color:blue'>new</span><span
class=apple-converted-space><span style='font-size:10.0pt;font-family:"Courier New";
color:black'> </span></span><span style='font-size:10.0pt;font-family:
"Courier New";color:black'>CallInst(pBarF, barArgs.begin(), barArgs.end(),<span
class=apple-converted-space> </span></span><span style='font-size:10.0pt;
font-family:"Courier New";color:#A31515'>""</span><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>, pBody);</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>    </span><span style='font-size:10.0pt;
font-family:"Courier New";color:blue'>new</span><span
class=apple-converted-space><span style='font-size:10.0pt;font-family:"Courier New";
color:black'> </span></span><span style='font-size:10.0pt;font-family:
"Courier New";color:black'>ReturnInst(NULL, pBody);</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>   <span class=apple-converted-space> </span></span><span
style='font-size:10.0pt;font-family:"Courier New";color:blue'>return</span><span
class=apple-converted-space><span style='font-size:10.0pt;font-family:"Courier New";
color:black'> </span></span><span style='font-size:10.0pt;font-family:
"Courier New";color:black'>pFooF;</span><span style='font-size:11.0pt;
font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>}</span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'> </span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:blue'>int</span><span class=apple-converted-space><span style='font-size:
10.0pt;font-family:"Courier New";color:black'> </span></span><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>main(</span><span
style='font-size:10.0pt;font-family:"Courier New";color:blue'>int</span><span
class=apple-converted-space><span style='font-size:10.0pt;font-family:"Courier New";
color:black'> </span></span><span style='font-size:10.0pt;font-family:
"Courier New";color:black'>argc,<span class=apple-converted-space> </span></span><span
style='font-size:10.0pt;font-family:"Courier New";color:blue'>char</span><span
class=apple-converted-space><span style='font-size:10.0pt;font-family:"Courier New";
color:black'> </span></span><span style='font-size:10.0pt;font-family:
"Courier New";color:black'>**argv) {</span><span style='font-size:11.0pt;
font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>   <span class=apple-converted-space> </span></span><span
style='font-size:10.0pt;font-family:"Courier New";color:green'>// Create some
module to put our function into it.</span><span style='font-size:11.0pt;
font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>    Module *M =<span class=apple-converted-space> </span></span><span
style='font-size:10.0pt;font-family:"Courier New";color:blue'>new</span><span
class=apple-converted-space><span style='font-size:10.0pt;font-family:"Courier New";
color:black'> </span></span><span style='font-size:10.0pt;font-family:
"Courier New";color:black'>Module(</span><span style='font-size:10.0pt;
font-family:"Courier New";color:#A31515'>"test"</span><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>);</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'> </span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>    M->setDataLayout(</span><span
style='font-size:10.0pt;font-family:"Courier New";color:#A31515'>"e-p:64:64:64-i1:8:8:8-i8:8:8:8-i32:32:32:32-f32:32:32:32"</span><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>);</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>    Function* pFooF = createFooFunction(M);</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>    M->print(std::cout);</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'> </span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>   <span class=apple-converted-space> </span></span><span
style='font-size:10.0pt;font-family:"Courier New";color:green'>// Now we going
to create JIT</span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>    ExistingModuleProvider *MP =<span
class=apple-converted-space> </span></span><span style='font-size:10.0pt;
font-family:"Courier New";color:blue'>new</span><span
class=apple-converted-space><span style='font-size:10.0pt;font-family:"Courier New";
color:black'> </span></span><span style='font-size:10.0pt;font-family:
"Courier New";color:black'>ExistingModuleProvider(M);</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>    ExecutionEngine *EE =
ExecutionEngine::create(MP,<span class=apple-converted-space> </span></span><span
style='font-size:10.0pt;font-family:"Courier New";color:blue'>false</span><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>);</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'> </span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>    sys::DynamicLibrary::AddSymbol(</span><span
style='font-size:10.0pt;font-family:"Courier New";color:#A31515'>"bar"</span><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>, (</span><span
style='font-size:10.0pt;font-family:"Courier New";color:blue'>void</span><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>*) bar);</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>    llvm::Module::FunctionListType& funcList =
MP->getModule()->getFunctionList();</span><span style='font-size:11.0pt;
font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'> </span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>   <span class=apple-converted-space> </span></span><span
style='font-size:10.0pt;font-family:"Courier New";color:blue'>for</span><span
class=apple-converted-space><span style='font-size:10.0pt;font-family:"Courier New";
color:black'> </span></span><span style='font-size:10.0pt;font-family:
"Courier New";color:black'>(llvm::Module::FunctionListType::iterator i =
funcList.begin() ; i != funcList.end() ; ++i)</span><span style='font-size:
11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>    {</span><span style='font-size:11.0pt;
font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>       
EE->getPointerToFunction(i);</span><span style='font-size:11.0pt;font-family:
"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>    }</span><span style='font-size:11.0pt;
font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'> </span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>    EE->recompileAndRelinkFunction(pFooF);</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'> </span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>    std::vector<GenericValue> Args(1);</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>    Args[0].IntVal = APInt(32, 3);</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>    GenericValue GV = EE->runFunction(pFooF,
Args);</span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'> </span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>   <span class=apple-converted-space> </span></span><span
style='font-size:10.0pt;font-family:"Courier New";color:blue'>return</span><span
class=apple-converted-space><span style='font-size:10.0pt;font-family:"Courier New";
color:black'> </span></span><span style='font-size:10.0pt;font-family:
"Courier New";color:black'>0;</span><span style='font-size:11.0pt;font-family:
"Calibri","sans-serif";color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>}</span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'><o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:black'> <o:p></o:p></span></p>

</div>

</div>

<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Helvetica","sans-serif";
color:black'>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>
        <a
href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><o:p></o:p></span></p>

</div>

</div>

<p class=MsoNormal><o:p> </o:p></p>

</div>

</body>

</html>