diff -r cfc0e730bcda -r 732cb155d806 progs/fun_llvm.scala --- a/progs/fun_llvm.scala Mon Oct 14 00:48:01 2019 +0100 +++ b/progs/fun_llvm.scala Wed Oct 16 11:00:48 2019 +0100 @@ -271,5 +271,46 @@ def main(args: Array[String]) : Unit = //println(compile(args(0))) compile_and_run(args(0)) +} -} \ No newline at end of file + + + + +/* +LLVM notes + +Registers are places for data inside the CPU. ++ up to 10 times faster access than to main memory +- expensive; typically just 32 of them in a 32-bit CPU + +High-level view of x86 +• Not a stack machine; no direct correspondence to operand stacks +• Arithmetics, etc. is done with values in registers + +• Started as academic project at University of Illinois in 2002 +• Now a large open source project with many contributors and a growing user base + +Single Static Assignment (SSA) form +• Only one assignment in the program text to each variable +• But dynamically, this assignment can be executed many times +• Many stores to a memory location are allowed +• Also, Φ (phi) instructions can be used, in the beginning of a basic block +• Value is one of the arguments, depending on from which block control came to this block +• Register allocation tries to keep these variables in same real register + +Why SSA form? +Many code optimizations can be done more efficiently + +Function definition form + define t @name(t1 x1, t2 x2, ..., tn xn) { + l1: block1 + l2: block2 + ... + lm : blockm + } + + + + +*/ \ No newline at end of file