<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, May 26, 2014 at 9:18 PM, Chandler Carruth <span dir="ltr"><<a href="mailto:chandlerc@google.com" target="_blank">chandlerc@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class=""><br><div class="gmail_quote">On Mon, May 26, 2014 at 5:05 PM, Ben Gamari <span dir="ltr"><<a href="mailto:bgamari.foss@gmail.com" target="_blank">bgamari.foss@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="overflow:hidden">Our C-- representation might refer to `f` without calling it (e.g. when<br>

building a thunk). In this case we don't have access to the function's<br>
signature, which we can only infer from a `call` node. For this reason,<br>
we currently demote all pointers to some common type (i8* currently) so<br>
we don't run into LLVM's type system in cases where we can't infer a<br>
value's type.</div></blockquote></div><br></div>Couldn't you then conjure up an i8* global (or whatever other placeholder you want) and when you discover that it is in fact a function, replace all the uses with a bitcast from the actual function to an i8*?</div>

</div>
</blockquote></div><br></div><div class="gmail_extra">I believe GHC streams textual LLVM assembly to a file and invokes llc separately.</div><div class="gmail_extra"><br></div><div class="gmail_extra">I could imagine a system that streams out a function definition at a time, where each definition is preceded by declarations of all symbols that it needs, with types inferred from the call nodes.</div>
</div>