[LLVMdev] llvm and assemble code

Bo Schwarzstein bo.schwarzstein at gmail.com
Fri Dec 14 19:45:23 PST 2007


Hi Guys,
    I am really a fresh man on compiler. I want to make a compiler that transform C-like language into assemble form, as the the same as Pixie's or Aqsis's RenderMan Shading Language compiler, just like this,

#!version 2.1.1
surface
#!parameters:
uniform float Ka = 1
uniform float Kd = 1
#!variables:
varying vector Nf
varying vector temporary_0
varying vector temporary_1
varying vector temporary_2
uniform vector temporary_3
varying vector temporary_4
varying vector temporary_5
#!Init:
 return            
#!Code:
 normalize ("v=v")  temporary_0  N 
 faceforward ("v=vv")  Nf  temporary_0  I 
 vfromf             temporary_3 Ka
 vuvector           temporary_2 temporary_3
 ambient ("c=")  temporary_4 
 mulvv              temporary_1 temporary_2 temporary_4
 vfromf             temporary_3 Kd
 vuvector           temporary_4 temporary_3
 diffuse ("c=n")  temporary_5  Nf 
 mulvv              temporary_2 temporary_4 temporary_5
 addvv              temporary_0 temporary_1 temporary_2
 mulvv              Ci Cs temporary_0
 movevv             Oi Os
 mulvv              Ci Ci Oi
 return     

    Where should I begin, I have read Mr.Lattner's Kaleidoscope Tutorial, But How can I transform AST to the IR, optimize, then output assemble code ?
    Thanks very much. I wish I do not post in wrong place.

Bo Schwarzstein,bo.schwarzstein at gmail.com
2007-12-15 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20071215/1432a941/attachment.html>


More information about the llvm-dev mailing list