Skip to content

Instantly share code, notes, and snippets.

@rhysd
Created April 9, 2014 08:18
Show Gist options
  • Save rhysd/10240494 to your computer and use it in GitHub Desktop.
Save rhysd/10240494 to your computer and use it in GitHub Desktop.
; ModuleID = 'main_module'
%String = type { i32, i32, i8 }
%MatchData = type { i32, i32*, %"Nil | PCRE::Pcre", %String*, i32, i32*, i32 }
%"Nil | PCRE::Pcre" = type { i32, [2 x i32] }
%Regex = type { i32, %String*, i8*, i32 }
%"Int32 | Nil" = type { i32, [1 x i32] }
%Time = type { i32, double }
%"struct.C::TimeSpec" = type { i32, i32 }
%"struct.ABI::UnwindException" = type { i32, i32, i64, i64, i64, i32 }
%LEBReader = type { i8* }
%"UInt64 | Nil" = type { i32, [2 x i32] }
%"Nil | UInt32" = type { i32, [1 x i32] }
%"Array(String)" = type { i32, i32, i32, %String** }
%StringBuilder = type { i32, i32, %"Array(String)"* }
%Exception = type { i32, %String*, i1, %"Array(String)"* }
%landing_pad = type { i8*, i32 }
%IndexOutOfBounds = type { i32, %String*, i1, %"Array(String)"* }
@finalize = private constant { i32, i32, [9 x i8] } { i32 1, i32 8, [9 x i8] c"finalize\00" }
@symbol_table = global [1 x %String*] [%String* bitcast ({ i32, i32, [9 x i8] }* @finalize to %String*)]
@"MatchData::EMPTY" = global %MatchData* null
@str = private constant { i32, i32, [1 x i8] } { i32 1, i32 0, [1 x i8] zeroinitializer }
@"$~" = global %MatchData* null
@"ABI::UA_SEARCH_PHASE" = constant i32 1
@"ABI::URC_HANDLER_FOUND" = constant i32 6
@"ABI::UA_HANDLER_FRAME" = constant i32 4
@"ABI::EH_REGISTER_0" = constant i32 0
@"ABI::EH_REGISTER_1" = constant i32 2
@"ABI::URC_INSTALL_CONTEXT" = constant i32 7
@"ABI::URC_CONTINUE_UNWIND" = constant i32 8
@str1 = private constant { i32, i32, [16 x i8] } { i32 1, i32 15, [16 x i8] c"Could not raise\00" }
@"Unwind::CURSOR_SIZE" = constant i32 127
@"Unwind::CONTEXT_SIZE" = constant i32 87
@"Unwind::REG_IP" = constant i32 -1
@str2 = private constant { i32, i32, [3 x i8] } { i32 1, i32 2, [3 x i8] c" +\00" }
@str3 = private constant { i32, i32, [3 x i8] } { i32 1, i32 2, [3 x i8] c" [\00" }
@str4 = private constant { i32, i32, [2 x i8] } { i32 1, i32 1, [2 x i8] c"]\00" }
@"$at_exit_handlers" = global i1 false
@"#Regex__(\5Cd|A|B|C|D|E|F)(\5Cd|A|B|C|D|E|F)__0" = global %Regex* null
@str5 = private constant { i32, i32, [35 x i8] } { i32 1, i32 34, [35 x i8] c"_(\5Cd|A|B|C|D|E|F)(\5Cd|A|B|C|D|E|F)_\00" }
@"PCRE::INFO_CAPTURECOUNT" = constant i32 2
@str6 = private constant { i32, i32, [32 x i8] } { i32 1, i32 31, [32 x i8] c"Error running at_exit handler: \00" }
@str7 = private constant { i32, i32, [5 x i8] } { i32 1, i32 4, [5 x i8] c"hoge\00" }
define %"Int32 | Nil" @__crystal_main(i32 %argc, i8** %argv) {
alloca:
const: ; No predecessors!
br label %"const_MatchData::EMPTY"
entry: ; No predecessors!
%0 = call %Time* @"*Time::now<Time:Class>:Time"(i32 92)
%1 = call i64 @"*Time#to_i<Time>:Int64"(%Time* %0)
%2 = trunc i64 %1 to i32
call void @srand(i32 %2)
%3 = load %MatchData** @"MatchData::EMPTY"
store %MatchData* %3, %MatchData** @"$~"
store i1 false, i1* @"$at_exit_handlers"
"const_MatchData::EMPTY": ; preds = %const
%4 = call %MatchData* @"*MatchData::new<MatchData:Class, String, Nil, String, Int32, Int32*, Int32>:MatchData"(i32 94, %String* bitcast ({ i32, i32, [1 x i8] }* @str to %String*), i1 false, %String* bitcast ({ i32, i32, [1 x i8] }* @str to %String*), i32 0, i32* null, i32 0)
store %MatchData* %4, %MatchData** @"MatchData::EMPTY"
br label %"const_#Regex__(\5Cd|A|B|C|D|E|F)(\5Cd|A|B|C|D|E|F)__0"
"const_#Regex__(\5Cd|A|B|C|D|E|F)(\5Cd|A|B|C|D|E|F)__0": ; preds = %"const_MatchData::EMPTY"
%5 = call %Regex* @"*Regex::new<Regex:Class, String, Int32>:Regex"(i32 106, %String* bitcast ({ i32, i32, [35 x i8] }* @str5 to %String*), i32 0)
store %Regex* %5, %Regex** @"#Regex__(\5Cd|A|B|C|D|E|F)(\5Cd|A|B|C|D|E|F)__0"
catch: ; No predecessors!
exit: ; No predecessors!
}
define i8* @__crystal_malloc(i32 %size) {
alloca:
%size1 = alloca i32
br label %entry
entry: ; preds = %alloca
store i32 %size, i32* %size1
%0 = load i32* %size1
%1 = call i8* @GC_malloc(i32 %0)
ret i8* %1
}
declare i8* @GC_malloc(i32)
define i8* @__crystal_realloc(i8* %ptr, i32 %size) {
alloca:
%ptr1 = alloca i8*
%size2 = alloca i32
br label %entry
entry: ; preds = %alloca
store i8* %ptr, i8** %ptr1
store i32 %size, i32* %size2
%0 = load i8** %ptr1
%1 = load i32* %size2
%2 = call i8* @GC_realloc(i8* %0, i32 %1)
ret i8* %2
}
declare i8* @GC_realloc(i8*, i32)
declare void @clock_gettime(i32, %"struct.C::TimeSpec"*)
declare %Time* @"*Time::now<Time:Class>:Time"(i32)
declare i64 @"*Time#to_i<Time>:Int64"(%Time*)
declare void @srand(i32)
declare %MatchData* @"*MatchData::new<MatchData:Class, String, Nil, String, Int32, Int32*, Int32>:MatchData"(i32, %String*, i1, %String*, i32, i32*, i32)
define i32 @__crystal_personality(i32 %version, i32 %actions, i64 %exception_class, %"struct.ABI::UnwindException"* %exception_object, i8* %context) {
alloca:
%version1 = alloca i32
%actions2 = alloca i32
%exception_class3 = alloca i64
%exception_object4 = alloca %"struct.ABI::UnwindException"*
%context5 = alloca i8*
%start = alloca i32
%ip = alloca i32
%throw_offset = alloca i32
%lsd = alloca i8*
%0 = alloca %LEBReader
%leb = alloca %LEBReader
%1 = alloca %"UInt64 | Nil"
%2 = alloca %"UInt64 | Nil"
%cs_table_length = alloca i64
%cs_table_end = alloca i8*
%"cs_offset$1" = alloca %"Nil | UInt32"
%"cs_length$1" = alloca %"Nil | UInt32"
%"cs_addr$1" = alloca %"Nil | UInt32"
%"action$1" = alloca %"UInt64 | Nil"
%cs_offset = alloca i32
%cs_length = alloca i32
%cs_addr = alloca i32
%action = alloca i64
%"#temp_297" = alloca i1
%"#temp_298" = alloca i1
br label %entry
entry: ; preds = %alloca
store i32 %version, i32* %version1
store i32 %actions, i32* %actions2
store i64 %exception_class, i64* %exception_class3
store %"struct.ABI::UnwindException"* %exception_object, %"struct.ABI::UnwindException"** %exception_object4
store i8* %context, i8** %context5
%3 = load i8** %context5
%4 = call i32 @_Unwind_GetRegionStart(i8* %3)
store i32 %4, i32* %start
%5 = load i8** %context5
%6 = call i32 @_Unwind_GetIP(i8* %5)
store i32 %6, i32* %ip
%7 = load i32* %ip
%8 = sub i32 %7, 1
%9 = load i32* %start
%10 = sub i32 %8, %9
store i32 %10, i32* %throw_offset
%11 = load i8** %context5
%12 = call i8* @_Unwind_GetLanguageSpecificData(i8* %11)
store i8* %12, i8** %lsd
%13 = load i8** %lsd
%14 = call %LEBReader @"*LEBReader::new<LEBReader:Class, UInt8*>:LEBReader"(i32 96, i8* %13)
store %LEBReader %14, %LEBReader* %0
%15 = load %LEBReader* %0
store %LEBReader %15, %LEBReader* %leb
%16 = call i8 @"*LEBReader#read_uint8<LEBReader>:UInt8"(%LEBReader* %leb)
%17 = call i8 @"*LEBReader#read_uint8<LEBReader>:UInt8"(%LEBReader* %leb)
%18 = icmp ne i8 %17, -1
br i1 %18, label %then, label %else
then: ; preds = %entry
%19 = call i64 @"*LEBReader#read_uleb128<LEBReader>:UInt64"(%LEBReader* %leb)
%20 = getelementptr %"UInt64 | Nil"* %1, i32 0, i32 0
store i32 36, i32* %20
%21 = getelementptr %"UInt64 | Nil"* %1, i32 0, i32 1
%22 = bitcast [2 x i32]* %21 to i64*
store i64 %19, i64* %22
br label %exit
else: ; preds = %entry
%23 = getelementptr %"UInt64 | Nil"* %2, i32 0, i32 0
store i32 0, i32* %23
%24 = getelementptr %"UInt64 | Nil"* %2, i32 0, i32 1
%25 = bitcast [2 x i32]* %24 to i1*
store i1 false, i1* %25
br label %exit
exit: ; preds = %else, %then
%26 = phi %"UInt64 | Nil"* [ %1, %then ], [ %2, %else ]
%27 = call i8 @"*LEBReader#read_uint8<LEBReader>:UInt8"(%LEBReader* %leb)
%28 = call i64 @"*LEBReader#read_uleb128<LEBReader>:UInt64"(%LEBReader* %leb)
store i64 %28, i64* %cs_table_length
%29 = call i8* @"*LEBReader#data<LEBReader>:UInt8*"(%LEBReader* %leb)
%30 = load i64* %cs_table_length
%31 = call i8* @"*UInt8*#+<UInt8*, UInt64>:UInt8*"(i8* %29, i64 %30)
store i8* %31, i8** %cs_table_end
%32 = getelementptr %"Nil | UInt32"* %"cs_offset$1", i32 0, i32 0
store i32 0, i32* %32
%33 = getelementptr %"Nil | UInt32"* %"cs_offset$1", i32 0, i32 1
%34 = bitcast [1 x i32]* %33 to i1*
store i1 false, i1* %34
%35 = getelementptr %"Nil | UInt32"* %"cs_length$1", i32 0, i32 0
store i32 0, i32* %35
%36 = getelementptr %"Nil | UInt32"* %"cs_length$1", i32 0, i32 1
%37 = bitcast [1 x i32]* %36 to i1*
store i1 false, i1* %37
%38 = getelementptr %"Nil | UInt32"* %"cs_addr$1", i32 0, i32 0
store i32 0, i32* %38
%39 = getelementptr %"Nil | UInt32"* %"cs_addr$1", i32 0, i32 1
%40 = bitcast [1 x i32]* %39 to i1*
store i1 false, i1* %40
%41 = getelementptr %"UInt64 | Nil"* %"action$1", i32 0, i32 0
store i32 0, i32* %41
%42 = getelementptr %"UInt64 | Nil"* %"action$1", i32 0, i32 1
%43 = bitcast [2 x i32]* %42 to i1*
store i1 false, i1* %43
br label %while
while: ; preds = %exit9, %exit
%44 = call i8* @"*LEBReader#data<LEBReader>:UInt8*"(%LEBReader* %leb)
%45 = load i8** %cs_table_end
%46 = call i1 @"*UInt8*#<<UInt8*, UInt8*>:Bool"(i8* %44, i8* %45)
br i1 %46, label %body, label %exit6
body: ; preds = %while
%47 = call i32 @"*LEBReader#read_uint32<LEBReader>:UInt32"(%LEBReader* %leb)
store i32 %47, i32* %cs_offset
%48 = call i32 @"*LEBReader#read_uint32<LEBReader>:UInt32"(%LEBReader* %leb)
store i32 %48, i32* %cs_length
%49 = call i32 @"*LEBReader#read_uint32<LEBReader>:UInt32"(%LEBReader* %leb)
store i32 %49, i32* %cs_addr
%50 = call i64 @"*LEBReader#read_uleb128<LEBReader>:UInt64"(%LEBReader* %leb)
store i64 %50, i64* %action
%51 = load i32* %cs_addr
%52 = icmp ne i32 %51, 0
br i1 %52, label %then7, label %else8
exit6: ; preds = %while
%53 = load i32* @"ABI::URC_CONTINUE_UNWIND"
ret i32 %53
then7: ; preds = %body
%54 = load i32* %cs_offset
%55 = load i32* %throw_offset
%56 = icmp ule i32 %54, %55
store i1 %56, i1* %"#temp_297"
br i1 %56, label %then12, label %else13
else8: ; preds = %body
br label %exit9
exit9: ; preds = %else8, %exit15
%57 = phi i1 [ %86, %exit15 ], [ false, %else8 ]
store i1 %57, i1* %"#temp_298"
%58 = load i32* %cs_offset
%59 = getelementptr %"Nil | UInt32"* %"cs_offset$1", i32 0, i32 0
store i32 34, i32* %59
%60 = getelementptr %"Nil | UInt32"* %"cs_offset$1", i32 0, i32 1
%61 = bitcast [1 x i32]* %60 to i32*
store i32 %58, i32* %61
%62 = load i32* %cs_length
%63 = getelementptr %"Nil | UInt32"* %"cs_length$1", i32 0, i32 0
store i32 34, i32* %63
%64 = getelementptr %"Nil | UInt32"* %"cs_length$1", i32 0, i32 1
%65 = bitcast [1 x i32]* %64 to i32*
store i32 %62, i32* %65
%66 = load i32* %cs_addr
%67 = getelementptr %"Nil | UInt32"* %"cs_addr$1", i32 0, i32 0
store i32 34, i32* %67
%68 = getelementptr %"Nil | UInt32"* %"cs_addr$1", i32 0, i32 1
%69 = bitcast [1 x i32]* %68 to i32*
store i32 %66, i32* %69
%70 = load i64* %action
%71 = getelementptr %"UInt64 | Nil"* %"action$1", i32 0, i32 0
store i32 36, i32* %71
%72 = getelementptr %"UInt64 | Nil"* %"action$1", i32 0, i32 1
%73 = bitcast [2 x i32]* %72 to i64*
store i64 %70, i64* %73
%74 = load i1* %"#temp_298"
br label %while
then10: ; preds = %exit14
%75 = load i32* %actions2
%76 = load i32* @"ABI::UA_SEARCH_PHASE"
%77 = and i32 %75, %76
%78 = icmp sgt i32 %77, 0
br i1 %78, label %then16, label %else17
else11: ; preds = %exit14
br label %exit15
then12: ; preds = %then7
%79 = load i32* %throw_offset
%80 = load i32* %cs_offset
%81 = load i32* %cs_length
%82 = add i32 %80, %81
%83 = icmp ule i32 %79, %82
br label %exit14
else13: ; preds = %then7
%84 = load i1* %"#temp_297"
br label %exit14
exit14: ; preds = %else13, %then12
%85 = phi i1 [ %83, %then12 ], [ %84, %else13 ]
br i1 %85, label %then10, label %else11
exit15: ; preds = %else11, %exit21
%86 = phi i1 [ %110, %exit21 ], [ false, %else11 ]
br label %exit9
then16: ; preds = %then10
%87 = load i32* @"ABI::URC_HANDLER_FOUND"
ret i32 %87
else17: ; preds = %then10
br label %exit18
exit18: ; preds = %else17
%88 = phi i1 [ false, %else17 ]
%89 = load i32* %actions2
%90 = load i32* @"ABI::UA_HANDLER_FRAME"
%91 = and i32 %89, %90
%92 = icmp sgt i32 %91, 0
br i1 %92, label %then19, label %else20
then19: ; preds = %exit18
%93 = load i8** %context5
%94 = load i32* @"ABI::EH_REGISTER_0"
%95 = load %"struct.ABI::UnwindException"** %exception_object4
%96 = ptrtoint %"struct.ABI::UnwindException"* %95 to i64
%97 = call i32 @"*UInt64#to_sizet<UInt64>:UInt32"(i64 %96)
call void @_Unwind_SetGR(i8* %93, i32 %94, i32 %97)
%98 = load i8** %context5
%99 = load i32* @"ABI::EH_REGISTER_1"
%100 = load %"struct.ABI::UnwindException"** %exception_object4
%101 = getelementptr %"struct.ABI::UnwindException"* %100, i32 0, i32 5
%102 = load i32* %101
%103 = call i32 @"*Int32#to_sizet<Int32>:UInt32"(i32 %102)
call void @_Unwind_SetGR(i8* %98, i32 %99, i32 %103)
%104 = load i8** %context5
%105 = load i32* %start
%106 = load i32* %cs_addr
%107 = add i32 %105, %106
%108 = call i32 @_Unwind_SetIP(i8* %104, i32 %107)
%109 = load i32* @"ABI::URC_INSTALL_CONTEXT"
ret i32 %109
else20: ; preds = %exit18
br label %exit21
exit21: ; preds = %else20
%110 = phi i1 [ false, %else20 ]
br label %exit15
}
declare i32 @_Unwind_GetRegionStart(i8*)
declare i32 @_Unwind_GetIP(i8*)
declare i8* @_Unwind_GetLanguageSpecificData(i8*)
declare %LEBReader @"*LEBReader::new<LEBReader:Class, UInt8*>:LEBReader"(i32, i8*)
declare i8 @"*LEBReader#read_uint8<LEBReader>:UInt8"(%LEBReader*)
declare i64 @"*LEBReader#read_uleb128<LEBReader>:UInt64"(%LEBReader*)
declare i8* @"*LEBReader#data<LEBReader>:UInt8*"(%LEBReader*)
declare i8* @"*UInt8*#+<UInt8*, UInt64>:UInt8*"(i8*, i64)
declare i1 @"*UInt8*#<<UInt8*, UInt8*>:Bool"(i8*, i8*)
declare i32 @"*LEBReader#read_uint32<LEBReader>:UInt32"(%LEBReader*)
declare i32 @"*UInt64#to_sizet<UInt64>:UInt32"(i64)
declare void @_Unwind_SetGR(i8*, i32, i32)
declare i32 @"*Int32#to_sizet<Int32>:UInt32"(i32)
declare i32 @_Unwind_SetIP(i8*, i32)
; Function Attrs: noreturn
define void @__crystal_raise(%"struct.ABI::UnwindException"* %unwind_ex) #0 {
alloca:
%unwind_ex1 = alloca %"struct.ABI::UnwindException"*
%ret = alloca i32
%i = alloca i32
%block_i = alloca i32
%"@buffer$1" = alloca %String**
%block_point = alloca %String*
%"i$1" = alloca i32
%"#temp_1" = alloca i32
br label %entry
entry: ; preds = %alloca
store %"struct.ABI::UnwindException"* %unwind_ex, %"struct.ABI::UnwindException"** %unwind_ex1
%0 = load %"struct.ABI::UnwindException"** %unwind_ex1
%1 = call i32 @_Unwind_RaiseException(%"struct.ABI::UnwindException"* %0)
store i32 %1, i32* %ret
%2 = call i1 @"*puts<main, String>:Nil"(%String* bitcast ({ i32, i32, [16 x i8] }* @str1 to %String*))
%3 = call %"Array(String)"* @"*caller<main>:Array(String)"()
%4 = call i32 @"*Array(String)#length<Array(String)>:Int32"(%"Array(String)"* %3)
%5 = xor i32 %4, %4
store i32 %5, i32* %i
br label %while
exit: ; preds = %exit2
%6 = phi %"Array(String)"* [ %3, %exit2 ]
%7 = load i32* %ret
call void @exit(i32 %7)
unreachable
exit2: ; preds = %exit3
%8 = phi i32 [ %4, %exit3 ]
br label %exit
while: ; preds = %exit4, %entry
%9 = load i32* %i
%10 = icmp slt i32 %9, %4
br i1 %10, label %body, label %exit3
body: ; preds = %while
%11 = load i32* %i
store i32 %11, i32* %block_i
%12 = load i32* %block_i
%13 = getelementptr %"Array(String)"* %3, i32 0, i32 3
%14 = load %String*** %13
store %String** %14, %String*** %"@buffer$1"
%15 = load i32* %block_i
%16 = call %String* @"*String*#[]<String*, Int32>:String"(%String** %14, i32 %15)
store %String* %16, %String** %block_point
%17 = load %String** %block_point
%18 = load %String** %block_point
%19 = call i1 @"*puts<main, String>:Nil"(%String* %18)
br label %exit5
exit3: ; preds = %while
br label %exit2
exit4: ; preds = %exit5
%20 = phi i1 [ %25, %exit5 ]
%21 = load i32* %i
%22 = add i32 %21, 1
store i32 %22, i32* %"i$1"
store i32 %22, i32* %"#temp_1"
%23 = load i32* %"i$1"
store i32 %23, i32* %i
%24 = load i32* %"#temp_1"
br label %while
exit5: ; preds = %body
%25 = phi i1 [ %19, %body ]
br label %exit4
}
declare i32 @_Unwind_RaiseException(%"struct.ABI::UnwindException"*)
define i1 @"*puts<main, String>:Nil"(%String* %obj) {
alloca:
%obj1 = alloca %String*
br label %entry
entry: ; preds = %alloca
store %String* %obj, %String** %obj1
%0 = load %String** %obj1
%1 = call %String* @"*String#to_s<String>:String"(%String* %0)
%2 = call i8* @"*String#cstr<String>:UInt8*"(%String* %1)
%3 = call i32 @puts(i8* %2)
ret i1 false
}
declare %String* @"*String#to_s<String>:String"(%String*)
declare i8* @"*String#cstr<String>:UInt8*"(%String*)
declare i32 @puts(i8*)
define %"Array(String)"* @"*caller<main>:Array(String)"() {
alloca:
%cursor = alloca i32*
%context = alloca i32*
%fname_size = alloca i32
%fname_buffer = alloca i8*
%backtrace = alloca %"Array(String)"*
%"pc$1" = alloca %"Nil | UInt32"
%"offset$2" = alloca %"Nil | UInt32"
%"fname$2" = alloca %String*
%pc = alloca i32
%"offset$1" = alloca %"Nil | UInt32"
%"fname$1" = alloca %String*
%offset = alloca i32
%fname = alloca %String*
%"fname_size$1" = alloca i32
%"fname_buffer$1" = alloca i8*
%"#temp_294" = alloca i8*
%"#temp_295" = alloca %"Array(String)"*
br label %entry
entry: ; preds = %alloca
%0 = load i32* @"Unwind::CURSOR_SIZE"
%1 = call i32* @"*UInt32*::malloc<UInt32*:Class, Int32>:UInt32*"(i32 97, i32 %0)
store i32* %1, i32** %cursor
%2 = load i32* @"Unwind::CONTEXT_SIZE"
%3 = call i32* @"*UInt32*::malloc<UInt32*:Class, Int32>:UInt32*"(i32 97, i32 %2)
store i32* %3, i32** %context
%4 = load i32** %context
%5 = call i32 @getcontext(i32* %4)
%6 = load i32** %cursor
%7 = load i32** %context
%8 = call i32 @_ULx86_init_local(i32* %6, i32* %7)
store i32 64, i32* %fname_size
%9 = load i32* %fname_size
%10 = call i8* @"*UInt8*::malloc<UInt8*:Class, Int32>:UInt8*"(i32 98, i32 %9)
store i8* %10, i8** %fname_buffer
%11 = call %"Array(String)"* @"*Array(String)::new<Array(String):Class>:Array(String)"(i32 99)
store %"Array(String)"* %11, %"Array(String)"** %backtrace
%12 = getelementptr %"Nil | UInt32"* %"pc$1", i32 0, i32 0
store i32 0, i32* %12
%13 = getelementptr %"Nil | UInt32"* %"pc$1", i32 0, i32 1
%14 = bitcast [1 x i32]* %13 to i1*
store i1 false, i1* %14
%15 = getelementptr %"Nil | UInt32"* %"offset$2", i32 0, i32 0
store i32 0, i32* %15
%16 = getelementptr %"Nil | UInt32"* %"offset$2", i32 0, i32 1
%17 = bitcast [1 x i32]* %16 to i1*
store i1 false, i1* %17
store %String* null, %String** %"fname$2"
br label %while
while: ; preds = %exit3, %entry
%18 = load i32** %cursor
%19 = call i32 @_ULx86_step(i32* %18)
%20 = icmp sgt i32 %19, 0
br i1 %20, label %body, label %exit
body: ; preds = %while
%21 = load i32** %cursor
%22 = load i32* @"Unwind::REG_IP"
%23 = call i32 @_ULx86_get_reg(i32* %21, i32 %22, i32* %pc)
%24 = getelementptr %"Nil | UInt32"* %"offset$1", i32 0, i32 0
store i32 0, i32* %24
%25 = getelementptr %"Nil | UInt32"* %"offset$1", i32 0, i32 1
%26 = bitcast [1 x i32]* %25 to i1*
store i1 false, i1* %26
store %String* null, %String** %"fname$1"
br label %while1
exit: ; preds = %while
%27 = load %"Array(String)"** %backtrace
ret %"Array(String)"* %27
while1: ; preds = %exit4, %body
br i1 true, label %body2, label %exit3
body2: ; preds = %while1
%28 = load i32** %cursor
%29 = load i8** %fname_buffer
%30 = load i32* %fname_size
%31 = call i32 @_ULx86_get_proc_name(i32* %28, i8* %29, i32 %30, i32* %offset)
%32 = load i8** %fname_buffer
%33 = call %String* @"*String::new<String:Class, UInt8*>:String"(i32 102, i8* %32)
store %String* %33, %String** %fname
%34 = load %String** %fname
%35 = call i32 @"*String#length<String>:Int32"(%String* %34)
%36 = load i32* %fname_size
%37 = sub i32 %36, 1
%38 = icmp slt i32 %35, %37
br i1 %38, label %then, label %else
exit3: ; preds = %then, %while1
%39 = load %"Array(String)"** %backtrace
%40 = call %StringBuilder* @"*StringBuilder::new<StringBuilder:Class>:StringBuilder"(i32 103)
%41 = load %String** %"fname$1"
%42 = call %StringBuilder* @"*StringBuilder#<<<StringBuilder, String?>:StringBuilder"(%StringBuilder* %40, %String* %41)
%43 = call %StringBuilder* @"*StringBuilder#<<<StringBuilder, String>:StringBuilder"(%StringBuilder* %42, %String* bitcast ({ i32, i32, [3 x i8] }* @str2 to %String*))
%44 = call %StringBuilder* @"*StringBuilder#<<<StringBuilder, Nil | UInt32>:StringBuilder"(%StringBuilder* %43, %"Nil | UInt32"* %"offset$1")
%45 = call %StringBuilder* @"*StringBuilder#<<<StringBuilder, String>:StringBuilder"(%StringBuilder* %44, %String* bitcast ({ i32, i32, [3 x i8] }* @str3 to %String*))
%46 = load i32* %pc
%47 = call %StringBuilder* @"*StringBuilder#<<<StringBuilder, UInt32>:StringBuilder"(%StringBuilder* %45, i32 %46)
%48 = call %StringBuilder* @"*StringBuilder#<<<StringBuilder, String>:StringBuilder"(%StringBuilder* %47, %String* bitcast ({ i32, i32, [2 x i8] }* @str4 to %String*))
%49 = call %String* @"*StringBuilder#to_s<StringBuilder>:String"(%StringBuilder* %48)
%50 = call %"Array(String)"* @"*Array(String)#<<<Array(String), String>:Array(String)"(%"Array(String)"* %39, %String* %49)
store %"Array(String)"* %50, %"Array(String)"** %"#temp_295"
%51 = load i32* %pc
%52 = getelementptr %"Nil | UInt32"* %"pc$1", i32 0, i32 0
store i32 34, i32* %52
%53 = getelementptr %"Nil | UInt32"* %"pc$1", i32 0, i32 1
%54 = bitcast [1 x i32]* %53 to i32*
store i32 %51, i32* %54
%55 = load %"Nil | UInt32"* %"offset$1"
store %"Nil | UInt32" %55, %"Nil | UInt32"* %"offset$2"
%56 = load %String** %"fname$1"
store %String* %56, %String** %"fname$2"
%57 = load %"Array(String)"** %"#temp_295"
br label %while
then: ; preds = %body2
%58 = getelementptr %"Nil | UInt32"* %"offset$1", i32 0, i32 0
store i32 0, i32* %58
%59 = getelementptr %"Nil | UInt32"* %"offset$1", i32 0, i32 1
%60 = bitcast [1 x i32]* %59 to i1*
store i1 false, i1* %60
%61 = load %String** %fname
store %String* %61, %String** %"fname$1"
br label %exit3
else: ; preds = %body2
br label %exit4
exit4: ; preds = %else
%62 = phi i1 [ false, %else ]
%63 = load i32* %fname_size
%64 = add i32 %63, 64
store i32 %64, i32* %"fname_size$1"
%65 = load i8** %fname_buffer
%66 = load i32* %"fname_size$1"
%67 = call i8* @"*UInt8*#realloc<UInt8*, Int32>:UInt8*"(i8* %65, i32 %66)
store i8* %67, i8** %"fname_buffer$1"
store i8* %67, i8** %"#temp_294"
%68 = load i32* %"fname_size$1"
store i32 %68, i32* %fname_size
%69 = load i8** %"fname_buffer$1"
store i8* %69, i8** %fname_buffer
%70 = load i32* %offset
%71 = getelementptr %"Nil | UInt32"* %"offset$1", i32 0, i32 0
store i32 34, i32* %71
%72 = getelementptr %"Nil | UInt32"* %"offset$1", i32 0, i32 1
%73 = bitcast [1 x i32]* %72 to i32*
store i32 %70, i32* %73
%74 = load %String** %fname
store %String* %74, %String** %"fname$1"
%75 = load i8** %"#temp_294"
br label %while1
}
declare i32* @"*UInt32*::malloc<UInt32*:Class, Int32>:UInt32*"(i32, i32)
declare i32 @getcontext(i32*)
declare i32 @_ULx86_init_local(i32*, i32*)
declare i8* @"*UInt8*::malloc<UInt8*:Class, Int32>:UInt8*"(i32, i32)
declare %"Array(String)"* @"*Array(String)::new<Array(String):Class>:Array(String)"(i32)
declare i32 @_ULx86_step(i32*)
declare i32 @_ULx86_get_reg(i32*, i32, i32*)
declare i32 @_ULx86_get_proc_name(i32*, i8*, i32, i32*)
declare i32 @strlen(i8*)
declare %String* @"*String::new<String:Class, UInt8*>:String"(i32, i8*)
declare i32 @"*String#length<String>:Int32"(%String*)
declare i8* @"*UInt8*#realloc<UInt8*, Int32>:UInt8*"(i8*, i32)
declare %StringBuilder* @"*StringBuilder::new<StringBuilder:Class>:StringBuilder"(i32)
declare %StringBuilder* @"*StringBuilder#<<<StringBuilder, String?>:StringBuilder"(%StringBuilder*, %String*)
declare %StringBuilder* @"*StringBuilder#<<<StringBuilder, String>:StringBuilder"(%StringBuilder*, %String*)
declare i32 @sprintf(i8*, i8*, ...)
declare %StringBuilder* @"*StringBuilder#<<<StringBuilder, Nil | UInt32>:StringBuilder"(%StringBuilder*, %"Nil | UInt32"* byval)
declare %StringBuilder* @"*StringBuilder#<<<StringBuilder, UInt32>:StringBuilder"(%StringBuilder*, i32)
declare i8* @strcpy(i8*, i8*)
declare %String* @"*StringBuilder#to_s<StringBuilder>:String"(%StringBuilder*)
declare %"Array(String)"* @"*Array(String)#<<<Array(String), String>:Array(String)"(%"Array(String)"*, %String*)
declare i32 @"*Array(String)#length<Array(String)>:Int32"(%"Array(String)"*)
declare %String* @"*String*#[]<String*, Int32>:String"(%String**, i32)
; Function Attrs: noreturn
declare void @exit(i32) #0
define i64 @__crystal_get_exception(%"struct.ABI::UnwindException"* %unwind_ex) {
alloca:
%unwind_ex1 = alloca %"struct.ABI::UnwindException"*
br label %entry
entry: ; preds = %alloca
store %"struct.ABI::UnwindException"* %unwind_ex, %"struct.ABI::UnwindException"** %unwind_ex1
%0 = load %"struct.ABI::UnwindException"** %unwind_ex1
%1 = getelementptr %"struct.ABI::UnwindException"* %0, i32 0, i32 4
%2 = load i64* %1
ret i64 %2
}
define void @__crystal_raise_string(i8* %message) {
alloca:
%message1 = alloca i8*
br label %entry
entry: ; preds = %alloca
store i8* %message, i8** %message1
%0 = load i8** %message1
%1 = call %String* @"*String::new<String:Class, UInt8*>:String"(i32 102, i8* %0)
call void @"*raise<main, String>:NoReturn"(%String* %1)
unreachable
}
; Function Attrs: noreturn
define void @"*raise<main, String>:NoReturn"(%String* %message) #0 {
alloca:
%message1 = alloca %String*
br label %entry
entry: ; preds = %alloca
store %String* %message, %String** %message1
%0 = load %String** %message1
%1 = call %Exception* @"*Exception::new<Exception:Class, String>:Exception"(i32 104, %String* %0)
call void @"*raise<main, Exception>:NoReturn"(%Exception* %1)
unreachable
}
declare %Exception* @"*Exception::new<Exception:Class, String>:Exception"(i32, %String*)
; Function Attrs: noreturn
define void @"*raise<main, Exception>:NoReturn"(%Exception* %ex) #0 {
alloca:
%ex1 = alloca %Exception*
%unwind_ex = alloca %"struct.ABI::UnwindException"*
br label %entry
entry: ; preds = %alloca
store %Exception* %ex, %Exception** %ex1
%0 = call i8* @__crystal_malloc(i32 ptrtoint (%"struct.ABI::UnwindException"* getelementptr (%"struct.ABI::UnwindException"* null, i32 1) to i32))
%1 = bitcast i8* %0 to %"struct.ABI::UnwindException"*
%2 = bitcast %"struct.ABI::UnwindException"* %1 to i8*
call void @llvm.memset.p0i8.i32(i8* %2, i8 0, i32 ptrtoint (%"struct.ABI::UnwindException"* getelementptr (%"struct.ABI::UnwindException"* null, i32 1) to i32), i32 4, i1 false)
store %"struct.ABI::UnwindException"* %1, %"struct.ABI::UnwindException"** %unwind_ex
%3 = load %"struct.ABI::UnwindException"** %unwind_ex
%4 = getelementptr %"struct.ABI::UnwindException"* %3, i32 0, i32 0
%5 = call i32 @"*Int32#to_sizet<Int32>:UInt32"(i32 0)
store i32 %5, i32* %4
%6 = load %"struct.ABI::UnwindException"** %unwind_ex
%7 = getelementptr %"struct.ABI::UnwindException"* %6, i32 0, i32 1
%8 = call i32 @"*Int32#to_sizet<Int32>:UInt32"(i32 0)
store i32 %8, i32* %7
%9 = load %"struct.ABI::UnwindException"** %unwind_ex
%10 = getelementptr %"struct.ABI::UnwindException"* %9, i32 0, i32 4
%11 = load %Exception** %ex1
%12 = ptrtoint %Exception* %11 to i64
store i64 %12, i64* %10
%13 = load %"struct.ABI::UnwindException"** %unwind_ex
%14 = getelementptr %"struct.ABI::UnwindException"* %13, i32 0, i32 5
%15 = load %Exception** %ex1
store i32 8, i32* %14
%16 = load %"struct.ABI::UnwindException"** %unwind_ex
call void @__crystal_raise(%"struct.ABI::UnwindException"* %16)
unreachable
}
; Function Attrs: nounwind
declare void @llvm.memset.p0i8.i32(i8* nocapture, i8, i32, i32, i1) #1
define i32 @main(i32 %argc, i8** %argv) {
alloca:
%argc1 = alloca i32
%argv2 = alloca i8**
br label %entry
entry: ; preds = %alloca
store i32 %argc, i32* %argc1
store i8** %argv, i8*** %argv2
call void @"*GC::init<GC:Class>:Void"(i32 93)
%0 = load i32* %argc1
%1 = load i8*** %argv2
%2 = invoke %"Int32 | Nil" @__crystal_main(i32 %0, i8** %1)
to label %invoke_out unwind label %catch
catch: ; preds = %entry
%3 = landingpad %landing_pad personality i32 (i32, i32, i64, %"struct.ABI::UnwindException"*, i8*)* @__crystal_personality
cleanup
%4 = extractvalue %landing_pad %3, 0
%5 = extractvalue %landing_pad %3, 1
br label %this_rescue
exit: ; preds = %this_rescue, %invoke_out
%6 = phi i32 [ 0, %invoke_out ], [ 1, %this_rescue ]
%7 = load i1* @"$at_exit_handlers"
br label %exit10
invoke_out: ; preds = %entry
br label %exit
this_rescue: ; preds = %catch
%8 = bitcast i8* %4 to %"struct.ABI::UnwindException"*
%9 = call i64 @__crystal_get_exception(%"struct.ABI::UnwindException"* %8)
%10 = inttoptr i64 %9 to i32*
%11 = call i1 @"*puts<main, Exception+>:Nil"(i32* %10)
br label %exit
next_rescue: ; No predecessors!
%12 = load i1* @"$at_exit_handlers"
br label %exit5
catch3: ; No predecessors!
%13 = landingpad %landing_pad personality i32 (i32, i32, i64, %"struct.ABI::UnwindException"*, i8*)* @__crystal_personality
cleanup
%14 = extractvalue %landing_pad %13, 0
%15 = extractvalue %landing_pad %13, 1
br label %this_rescue6
exit4: ; preds = %this_rescue6, %exit5
%16 = phi i1 [ %18, %exit5 ], [ %26, %this_rescue6 ]
%17 = bitcast i8* %4 to %"struct.ABI::UnwindException"*
call void @__crystal_raise(%"struct.ABI::UnwindException"* %17)
unreachable
exit5: ; preds = %next_rescue
%18 = phi i1 [ %12, %next_rescue ]
br label %exit4
this_rescue6: ; preds = %catch3
%19 = bitcast i8* %14 to %"struct.ABI::UnwindException"*
%20 = call i64 @__crystal_get_exception(%"struct.ABI::UnwindException"* %19)
%21 = inttoptr i64 %20 to i32*
%22 = call %StringBuilder* @"*StringBuilder::new<StringBuilder:Class>:StringBuilder"(i32 103)
%23 = call %StringBuilder* @"*StringBuilder#<<<StringBuilder, String>:StringBuilder"(%StringBuilder* %22, %String* bitcast ({ i32, i32, [32 x i8] }* @str6 to %String*))
%24 = call %StringBuilder* @"*StringBuilder#<<<StringBuilder, Exception+>:StringBuilder"(%StringBuilder* %23, i32* %21)
%25 = call %String* @"*StringBuilder#to_s<StringBuilder>:String"(%StringBuilder* %24)
%26 = call i1 @"*puts<main, String>:Nil"(%String* %25)
br label %exit4
next_rescue7: ; No predecessors!
%27 = bitcast i8* %14 to %"struct.ABI::UnwindException"*
call void @__crystal_raise(%"struct.ABI::UnwindException"* %27)
unreachable
catch8: ; No predecessors!
%28 = landingpad %landing_pad personality i32 (i32, i32, i64, %"struct.ABI::UnwindException"*, i8*)* @__crystal_personality
cleanup
%29 = extractvalue %landing_pad %28, 0
%30 = extractvalue %landing_pad %28, 1
br label %this_rescue11
exit9: ; preds = %this_rescue11, %exit10
%31 = phi i1 [ %32, %exit10 ], [ %40, %this_rescue11 ]
ret i32 %6
exit10: ; preds = %exit
%32 = phi i1 [ %7, %exit ]
br label %exit9
this_rescue11: ; preds = %catch8
%33 = bitcast i8* %29 to %"struct.ABI::UnwindException"*
%34 = call i64 @__crystal_get_exception(%"struct.ABI::UnwindException"* %33)
%35 = inttoptr i64 %34 to i32*
%36 = call %StringBuilder* @"*StringBuilder::new<StringBuilder:Class>:StringBuilder"(i32 103)
%37 = call %StringBuilder* @"*StringBuilder#<<<StringBuilder, String>:StringBuilder"(%StringBuilder* %36, %String* bitcast ({ i32, i32, [32 x i8] }* @str6 to %String*))
%38 = call %StringBuilder* @"*StringBuilder#<<<StringBuilder, Exception+>:StringBuilder"(%StringBuilder* %37, i32* %35)
%39 = call %String* @"*StringBuilder#to_s<StringBuilder>:String"(%StringBuilder* %38)
%40 = call i1 @"*puts<main, String>:Nil"(%String* %39)
br label %exit9
next_rescue12: ; No predecessors!
%41 = bitcast i8* %29 to %"struct.ABI::UnwindException"*
call void @__crystal_raise(%"struct.ABI::UnwindException"* %41)
unreachable
}
declare void @GC_init()
declare void @"*GC::init<GC:Class>:Void"(i32)
define i1 @"*puts<main, Exception+>:Nil"(i32* %obj) {
alloca:
%obj1 = alloca i32*
br label %entry
entry: ; preds = %alloca
store i32* %obj, i32** %obj1
%0 = load i32** %obj1
%1 = call %String* @"*Exception+#to_s<Exception+>:String"(i32* %0)
%2 = call i8* @"*String#cstr<String>:UInt8*"(%String* %1)
%3 = call i32 @puts(i8* %2)
ret i1 false
}
declare i8* @pcre_compile(i8*, i32, i8**, i32*, i8*)
declare i32 @pcre_fullinfo(i8*, i8*, i32, i8*)
declare %Regex* @"*Regex::new<Regex:Class, String, Int32>:Regex"(i32, %String*, i32)
declare i32 @pcre_exec(i8*, i8*, i8*, i32, i32, i32, i32*, i32)
; Function Attrs: noreturn
define void @"*raise<main, IndexOutOfBounds>:NoReturn"(%IndexOutOfBounds* %ex) #0 {
alloca:
%ex1 = alloca %IndexOutOfBounds*
%unwind_ex = alloca %"struct.ABI::UnwindException"*
br label %entry
entry: ; preds = %alloca
store %IndexOutOfBounds* %ex, %IndexOutOfBounds** %ex1
%0 = call i8* @__crystal_malloc(i32 ptrtoint (%"struct.ABI::UnwindException"* getelementptr (%"struct.ABI::UnwindException"* null, i32 1) to i32))
%1 = bitcast i8* %0 to %"struct.ABI::UnwindException"*
%2 = bitcast %"struct.ABI::UnwindException"* %1 to i8*
call void @llvm.memset.p0i8.i32(i8* %2, i8 0, i32 ptrtoint (%"struct.ABI::UnwindException"* getelementptr (%"struct.ABI::UnwindException"* null, i32 1) to i32), i32 4, i1 false)
store %"struct.ABI::UnwindException"* %1, %"struct.ABI::UnwindException"** %unwind_ex
%3 = load %"struct.ABI::UnwindException"** %unwind_ex
%4 = getelementptr %"struct.ABI::UnwindException"* %3, i32 0, i32 0
%5 = call i32 @"*Int32#to_sizet<Int32>:UInt32"(i32 0)
store i32 %5, i32* %4
%6 = load %"struct.ABI::UnwindException"** %unwind_ex
%7 = getelementptr %"struct.ABI::UnwindException"* %6, i32 0, i32 1
%8 = call i32 @"*Int32#to_sizet<Int32>:UInt32"(i32 0)
store i32 %8, i32* %7
%9 = load %"struct.ABI::UnwindException"** %unwind_ex
%10 = getelementptr %"struct.ABI::UnwindException"* %9, i32 0, i32 4
%11 = load %IndexOutOfBounds** %ex1
%12 = ptrtoint %IndexOutOfBounds* %11 to i64
store i64 %12, i64* %10
%13 = load %"struct.ABI::UnwindException"** %unwind_ex
%14 = getelementptr %"struct.ABI::UnwindException"* %13, i32 0, i32 5
%15 = load %IndexOutOfBounds** %ex1
store i32 5, i32* %14
%16 = load %"struct.ABI::UnwindException"** %unwind_ex
call void @__crystal_raise(%"struct.ABI::UnwindException"* %16)
unreachable
}
declare %String* @"*Exception+#to_s<Exception+>:String"(i32*)
declare %StringBuilder* @"*StringBuilder#<<<StringBuilder, Exception+>:StringBuilder"(%StringBuilder*, i32*)
define i32 @"*f<main>:Int32"() {
alloca:
entry: ; No predecessors!
invoke void @"*raise<main, String>:NoReturn"(%String* bitcast ({ i32, i32, [5 x i8] }* @str7 to %String*))
to label %invoke_out unwind label %catch
catch: ; preds = %entry
%0 = landingpad %landing_pad personality i32 (i32, i32, i64, %"struct.ABI::UnwindException"*, i8*)* @__crystal_personality
cleanup
%1 = extractvalue %landing_pad %0, 0
%2 = extractvalue %landing_pad %0, 1
exit: ; No predecessors!
invoke_out: ; preds = %entry
unreachable
}
attributes #0 = { noreturn }
attributes #1 = { nounwind }
Missing hash value: n
*raise<main, String>:NoReturn + [167711616]
*Hash(String, Crystal::CodeGenVisitor::LLVMVar)#[]<Hash(String, Crystal::CodeGenVisitor::LLVMVar), String>:Crystal::CodeGenVisitor::LLVMVar + [167711616]
*Crystal::ASTNode+#accept<Crystal::ASTNode+, Crystal::CodeGenVisitor>:Nil + [167711616]
*Crystal::CodeGenVisitor#visit<Crystal::CodeGenVisitor, Crystal::Call+>:Bool | Nil + [167711616]
*Crystal::ASTNode+#accept<Crystal::ASTNode+, Crystal::CodeGenVisitor>:Nil + [167711616]
*Crystal::ASTNode+#accept<Crystal::ASTNode+, Crystal::CodeGenVisitor>:Nil + [167711616]
*Crystal::CodeGenVisitor#codegen_fun<Crystal::CodeGenVisitor, String, Crystal::Def+, Crystal::Type+, Bool, LLVM::Module, Bool>:LLVM::Function + [167711616]
*Crystal::CodeGenVisitor#target_def_fun<Crystal::CodeGenVisitor, Crystal::Def+, Crystal::Type+>:LLVM::Function + [167711616]
*Crystal::CodeGenVisitor#visit<Crystal::CodeGenVisitor, Crystal::Call+>:Bool | Nil + [167711616]
*Crystal::ASTNode+#accept<Crystal::ASTNode+, Crystal::CodeGenVisitor>:Nil + [167711616]
*Crystal::ASTNode+#accept<Crystal::ASTNode+, Crystal::CodeGenVisitor>:Nil + [167711616]
*Crystal::ASTNode+#accept<Crystal::ASTNode+, Crystal::CodeGenVisitor>:Nil + [167711616]
*Crystal::Program#build<Crystal::Program, Crystal::ASTNode+, Crystal::Program::BuildOptions>:Hash(String, LLVM::Module) + [167711616]
*Crystal::Compiler#compile<Crystal::Compiler>:Nil + [167711616]
__crystal_main + [167711616]
main + [167711616]
__libc_start_main + [167711616]
_start + [167711616]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment