Skip to content

Instantly share code, notes, and snippets.

View jackbergus's full-sized avatar
🏖️

Giacomo Bergami jackbergus

🏖️
View GitHub Profile
@jackbergus
jackbergus / stack.ll
Created December 8, 2017 18:14 — forked from barrucadu/stack.ll
Stack implementation in LLVM IR
; The stack pointer is going to be an index into the stack, and the
; stack is an array of words. The alternative would be to have the
; stack pointer me a pointer to memory, but this is perhaps a bit
; nicer, as where the stack actually lives is totally irrelevant.
@stack = global [1000 x i64] undef
@sp = global i64 undef;
; Now we have the basic stack operations: push, pop, and peek. As can
; be seen from the definitions, LLVM is typed, which is really nice as