[self sp];


- LLVM -

deep dive

@qmx - blog.qmx.me

whoami

dynjs
# disclaimer

- LLVM -

Overview

history

3-stage

compiler

Frontends

C

C++

Objective-C

Julia

Haskell

LLVM IR

LLVM IR

%2 = add i64 %1, %0, !dbg !6336
  ret i64 %2, !dbg !6336

not so high-level

ASM

Backends

x86

PowerPC

ARM

LLVM Optimizer

IR2IR

optimizer

SSA Form

CFG

Dominator Tree

Optimization Passes

Constant Propagation

Constant Propagation

add int 2,2

5?

Tail Recursion Elimination

TRE

function factorial(n) {
  if(n == 0) {
    return 1
  } else {
    return n*factorial(n-1);
  }
}

Dead Code Elimination

DCE

var a = 1, b = a;
// who uses 'a'?

Escape Analysis

EA

_someVar = 3;
int (^foo)(int) = ^(int x) {
  return x + _someVar;
};

Clang

several frontends

CSA

not-so-wild guess

ARC

how?

The CFGs!

DataFlow analysis

register liveness

demo / code dive

?

thanks!