Skip to content

Instantly share code, notes, and snippets.

View steakhal's full-sized avatar

Balazs Benics steakhal

View GitHub Profile
@steakhal
steakhal / stack.ll
Created January 29, 2020 16:20 — 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