Skip to content

Instantly share code, notes, and snippets.

@samflores
Last active October 13, 2015 17:08
Show Gist options
  • Save samflores/d85300fd32b782b59098 to your computer and use it in GitHub Desktop.
Save samflores/d85300fd32b782b59098 to your computer and use it in GitHub Desktop.
;> ooze "(def identity (fn [x] x)) (identity #t)"
; ModuleID = 'spikes'
%AnyVT = type <{ %AnyVT*, i8 }>
%Any = type <{ %AnyVT* }>
%Double = type <{ %AnyVT*, double }>
%Long = type <{ %AnyVT*, i64 }>
%Character = type <{ %AnyVT*, i32 }>
%Boolean = type <{ %AnyVT*, i1 }>
@"core/Any-vtable" = private constant %AnyVT zeroinitializer
@"core/Double-vtable" = private constant %AnyVT <{ %AnyVT* @"core/Any-vtable", i8 1 }>
@"core/Long-vtable" = private constant %AnyVT <{ %AnyVT* @"core/Any-vtable", i8 2 }>
@"core/Character-vtable" = private constant %AnyVT <{ %AnyVT* @"core/Any-vtable", i8 3 }>
@"core/Boolean-vtable" = private constant %AnyVT <{ %AnyVT* @"core/Any-vtable", i8 4 }>
@identity = global %Any* (%Any*)* @"spikes/fn"
define void @"core/Any#ctor"(%Any*) {
entry:
%1 = getelementptr inbounds %Any* %0, i32 0, i32 0
store %AnyVT* @"core/Any-vtable", %AnyVT** %1
ret void
}
define void @"core/Double#ctor"(%Double*, double) {
entry:
%2 = getelementptr inbounds %Double* %0, i32 0, i32 0
store %AnyVT* @"core/Double-vtable", %AnyVT** %2
%3 = getelementptr inbounds %Double* %0, i32 0, i32 1
store double %1, double* %3
ret void
}
define void @"core/Long#ctor"(%Long*, i64) {
entry:
%2 = getelementptr inbounds %Long* %0, i32 0, i32 0
store %AnyVT* @"core/Long-vtable", %AnyVT** %2
%3 = getelementptr inbounds %Long* %0, i32 0, i32 1
store i64 %1, i64* %3
ret void
}
define void @"core/Character#ctor"(%Character*, i32) {
entry:
%2 = getelementptr inbounds %Character* %0, i32 0, i32 0
store %AnyVT* @"core/Character-vtable", %AnyVT** %2
%3 = getelementptr inbounds %Character* %0, i32 0, i32 1
store i32 %1, i32* %3
ret void
}
define void @"core/Boolean#ctor"(%Boolean*, i1) {
entry:
%2 = getelementptr inbounds %Boolean* %0, i32 0, i32 0
store %AnyVT* @"core/Boolean-vtable", %AnyVT** %2
%3 = getelementptr inbounds %Boolean* %0, i32 0, i32 1
store i1 %1, i1* %3
ret void
}
define i64 @"spikes/entry"(i64) {
entry:
%1 = alloca %Boolean
call void @"core/Boolean#ctor"(%Boolean* %1, i1 true)
%2 = bitcast %Boolean* %1 to %Any*
%3 = call %Any* @"spikes/fn"(%Any* %2)
}
; Function Attrs: nounwind
define %Any* @"spikes/fn"(%Any*) #0 {
entry:
ret %Any* %0
}
attributes #0 = { nounwind }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment