Skip to content

Instantly share code, notes, and snippets.

View Bloofer's full-sized avatar

Joonmo Yang Bloofer

View GitHub Profile
@Bloofer
Bloofer / Copy propagation result
Last active January 4, 2018 04:27
Copy propagation result
z = 3 + x
@Bloofer
Bloofer / Copy propagation
Last active January 4, 2018 04:28
Copy propagation
y = x
z = 3 + y
@Bloofer
Bloofer / OCaml Makefile example
Created January 4, 2018 04:34
OCaml Makefile example
all: run
run: m.cmo error.cmo lexer.cmo parser.cmo main.cmo
ocamlc -o run m.cmo error.cmo lexer.cmo parser.cmo pp.cmo main.cmo
error.cmo : error.ml m.cmo
ocamlc -c error.ml
m.cmo : m.ml
ocamlc -c m.ml
@Bloofer
Bloofer / Makefile example
Last active January 4, 2018 04:34
Makefile example
target … : dependency …
command
@Bloofer
Bloofer / OCaml build
Created January 4, 2018 04:36
OCaml build
.PHONY: all clean
all:
ocamlbuild -use-ocamlfind main.native
clean:
ocamlbuild -clean
@Bloofer
Bloofer / Common subexpression elimination
Created January 4, 2018 07:08
Common subexpression elimination
a = b * c + g;
d = b * c * e;
@Bloofer
Bloofer / Common subexpression elimination result
Created January 4, 2018 07:09
Common subexpression elimination result
tmp = b * c;
a = tmp + g;
d = tmp * e;
@Bloofer
Bloofer / Constant folding
Created January 4, 2018 07:13
Constant folding
int a = 30;
int b = 9 - (a / 5);
int c;
c = b * 4;
if (c > 10) {
c = c - 10;
}
return c * (60 / a);
@Bloofer
Bloofer / Constant folding step1
Created January 4, 2018 07:15
Constant folding step1
int a = 30;
int b = 3;
int c;
c = b * 4;
if (c > 10) {
c = c - 10;
}
return c * 2;
@Bloofer
Bloofer / Constant folding step2
Created January 4, 2018 07:17
Constant folding step2
int a = 30;
int b = 3;
int c;
c = 12;
if (true) {
c = 2;
}
return c * 2;