progs/fun_llvm.scala
changeset 701 681c36b2af27
parent 679 8fc109f36b78
child 705 bfc8703b1527
equal deleted inserted replaced
700:52263ffd17b9 701:681c36b2af27
   276 
   276 
   277 
   277 
   278 
   278 
   279 
   279 
   280 
   280 
   281 /*
       
   282 LLVM notes
       
   283 
       
   284 Registers are places for data inside the CPU.
       
   285 + up to 10 times faster access than to main memory 
       
   286 - expensive; typically just 32 of them in a 32-bit CPU
       
   287 
       
   288 High-level view of x86
       
   289 • Not a stack machine; no direct correspondence to operand stacks
       
   290 • Arithmetics, etc. is done with values in registers
       
   291 
       
   292 • Started as academic project at University of Illinois in 2002
       
   293 • Now a large open source project with many contributors and a growing user base
       
   294 
       
   295 Single Static Assignment (SSA) form
       
   296 • Only one assignment in the program text to each variable
       
   297 • But dynamically, this assignment can be executed many times
       
   298 • Many stores to a memory location are allowed
       
   299 • Also, Φ (phi) instructions can be used, in the beginning of a basic block
       
   300 • Value is one of the arguments, depending on from which block control came to this block
       
   301 • Register allocation tries to keep these variables in same real register
       
   302 
       
   303 Why SSA form?
       
   304 Many code optimizations can be done more efficiently
       
   305 
       
   306 Function definition form
       
   307  define t @name(t1 x1, t2 x2, ..., tn xn) {
       
   308  l1: block1
       
   309  l2: block2
       
   310  ... 
       
   311  lm : blockm
       
   312  }
       
   313 
       
   314 
       
   315 
       
   316 
       
   317 */