[LLVMdev] Use of LLVM in a Machine Simulator.

Chris Lattner sabre at nondot.org
Tue Apr 18 09:25:38 PDT 2006


On Tue, 18 Apr 2006, Ralph Corderoy wrote:
>> Of interest may be this thesis.  It talks about converting alpha code
>> to LLVM (among other things):
>> http://llvm.org/pubs/2004-05-JoshiMSThesis.html
>
> Thanks, it was of interest.  I didn't spot its relevance from the title.

Note that the approach is still sound, but the paper is a bit dated (like 
anything talking about LLVM published more than 3 months ago :) ).  In 
particular, the spirit of this:

"Certain Alpha instructions have no direct and easy mapping to the LLVM 
IR. One option is to represent such instructions by complex pieces of LLVM 
code. For example, a ctpop instructions counts the number of set bits in a 
registers. Although it can be converted into a loop in LLVM, it would be 
very difficult for the back end to recognize such loops and regenerate the 
ctpop instructions. Secondly, such detailed translation is not required 
for optimizations like dead code elimination. Hence, we chose to represent 
such instructions in a simpler manner using function calls. These function 
calls can be easily recognized by the back end and translated to a single 
instruction."

... is right, but the details are no longer true (LLVM does now have 
support for ctpop).  Likewise, the spirit of this is correct:

"The LLVM compiler framework has the ability to define intrinsic 
functions: functions about which the compiler knows nothing and hence 
makes conservative transformations. One drawback of using such intrinsics 
is that they interfere with the dead code elimination process: because of 
conservative assumptions, LLVM cannot eliminate such function calls. 
Specifically, these functions can, in theory, write to memory and hence 
cannot be eliminated."

... but the details are no longer right.  In particular, you can specify 
whether intrinsics have side effects, etc now, which allows them to be 
DCE'd, CSE'd, hoisted out of loops, etc.

Also, note that the alpha backend described in the paper is quite 
different than the current alpha backend.

If you have any specific questions, this list is the place to ask. :)

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/




More information about the llvm-dev mailing list