Skip to content

Instantly share code, notes, and snippets.

@rhysd
Created March 23, 2015 16:08
Show Gist options
  • Save rhysd/91f95010f87b72c50f18 to your computer and use it in GitHub Desktop.
Save rhysd/91f95010f87b72c50f18 to your computer and use it in GitHub Desktop.
; ModuleID = 'bug.dcs'
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-darwin13.4.0"
%class.X = type { %class.Y** }
%class.Y = type {}
@unit = private unnamed_addr constant {} zeroinitializer
; Function Attrs: inlinehint nounwind
define {}* @dachs.main() #0 {
entry:
%0 = alloca %class.X
%1 = bitcast %class.X* %0 to i8*
call void @llvm.memset.p0i8.i64(i8* %1, i8 0, i64 8, i32 8, i1 false)
%2 = call {}* @"func dachs.init(class X(pointer(class Y))): ()"(%class.X* %0)
ret {}* @unit
}
; Function Attrs: inlinehint nounwind
define {}* @"func dachs.init(class Y): ()"(%class.Y* %self) #0 {
entry:
ret {}* @unit
}
; Function Attrs: inlinehint nounwind
define {}* @"func dachs.init(class X(pointer(class Y))): ()"(%class.X* %self) #0 {
entry:
%malloccall = tail call i8* @malloc(i64 0)
%0 = bitcast i8* %malloccall to %class.Y*
%1 = getelementptr inbounds %class.X* %self, i32 0, i32 0
%"@a" = load %class.Y*** %1
store %class.Y* %0, %class.Y** %"@a"
ret {}* @unit
}
; Function Attrs: nounwind
declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i32, i1) #1
; Function Attrs: nounwind
define i64 @main(i32, i8**) #1 {
entry:
%main_ret = call {}* @dachs.main()
ret i64 0
}
declare noalias i8* @malloc(i64)
attributes #0 = { inlinehint nounwind }
attributes #1 = { nounwind }
; class Element
; end
;
; class Container
; a
;
; init
; @a := new pointer(Element){3u}
; end
; end
;
; func main
; new Container
; end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment