# HG changeset patch # User Christian Urban # Date 1571220048 -3600 # Node ID 732cb155d806642ecaf788d4b2aa089798a52d61 # Parent cfc0e730bcdace4f23fe99ca75880082b538419c updated diff -r cfc0e730bcda -r 732cb155d806 coursework/cw02.pdf Binary file coursework/cw02.pdf has changed diff -r cfc0e730bcda -r 732cb155d806 coursework/cw02.tex --- a/coursework/cw02.tex Mon Oct 14 00:48:01 2019 +0100 +++ b/coursework/cw02.tex Wed Oct 16 11:00:48 2019 +0100 @@ -173,7 +173,8 @@ after each derivation step and rectify the computed values after each injection. Use this lexer to tokenize the programs in Figure~\ref{fib} and \ref{loop}. Give the tokens of these -programs where whitespaces are filtered out.\bigskip +programs where whitespaces are filtered out. Make sure you can +tokenise \textbf{exactly} these programs.\bigskip \begin{figure}[h] 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