Skip to content

Instantly share code, notes, and snippets.

@zmaril
Created December 24, 2011 06:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zmaril/1516537 to your computer and use it in GitHub Desktop.
Save zmaril/1516537 to your computer and use it in GitHub Desktop.
Readable hello_world
; ModuleID = 'tests/hello_world.f'
target datalayout = "e-p:64:64:64-S128-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-f128:128:128-n8:16:32:64"
target triple = "x86_64-apple-darwin11"
%struct.__st_parameter_dt = type { %struct.__st_parameter_common, i64, i64*, i64*, i8*, i8*, i32, i32, i8*, i8*, i32, i32, i8*, [256 x i8], i32*, i64, i8*, i32, i32, i8*, i8*, i32, i32, i8*, i8*, i32, i32, i8*, i8*, i32, [4 x i8] }
%struct.__st_parameter_common = type { i32, i32, i8*, i32, i32, i8*, i32* }
@.cst = linker_private constant [20 x i8] c"tests/hello_world.f\00", align 8
@.cst1 = linker_private constant [12 x i8] c"Hello World!", align 8
@options.1.1541 = internal constant [8 x i32] [i32 68, i32 511, i32 0, i32 0, i32 0, i32 1, i32 0, i32 1], align 32
define internal void @MAIN__() nounwind uwtable {
entry:
%memtmp = alloca %struct.__st_parameter_dt
%"alloca point" = bitcast i32 0 to i32
%"ssa point" = bitcast i32 0 to i32
br label %"2"
"2": ; preds = %entry
%0 = getelementptr inbounds %struct.__st_parameter_dt* %memtmp, i32 0, i32 0
%1 = getelementptr inbounds %struct.__st_parameter_common* %0, i32 0, i32 2
store i8* getelementptr inbounds ([20 x i8]* @.cst, i64 0, i64 0), i8** %1, align 8
%2 = getelementptr inbounds %struct.__st_parameter_dt* %memtmp, i32 0, i32 0
%3 = getelementptr inbounds %struct.__st_parameter_common* %2, i32 0, i32 3
store i32 2, i32* %3, align 4
%4 = getelementptr inbounds %struct.__st_parameter_dt* %memtmp, i32 0, i32 0
%5 = getelementptr inbounds %struct.__st_parameter_common* %4, i32 0, i32 0
store i32 128, i32* %5, align 4
%6 = getelementptr inbounds %struct.__st_parameter_dt* %memtmp, i32 0, i32 0
%7 = getelementptr inbounds %struct.__st_parameter_common* %6, i32 0, i32 1
store i32 6, i32* %7, align 4
call void @_gfortran_st_write(%struct.__st_parameter_dt* %memtmp) nounwind
call void @_gfortran_transfer_character_write(%struct.__st_parameter_dt* %memtmp, i8* getelementptr inbounds ([12 x i8]* @.cst1, i64 0, i64 0), i32 12) nounwind
call void @_gfortran_st_write_done(%struct.__st_parameter_dt* %memtmp) nounwind
br label %return
return: ; preds = %"2"
ret void
}
declare void @_gfortran_st_write(%struct.__st_parameter_dt*)
declare void @_gfortran_transfer_character_write(%struct.__st_parameter_dt*, i8*, i32)
declare void @_gfortran_st_write_done(%struct.__st_parameter_dt*)
define i32 @main(i32 %argc, i8** %argv) nounwind uwtable {
entry:
%argc_addr = alloca i32, align 4
%argv_addr = alloca i8**, align 8
%memtmp = alloca i32
%"alloca point" = bitcast i32 0 to i32
store i32 %argc, i32* %argc_addr
store i8** %argv, i8*** %argv_addr
%0 = load i32* %argc_addr, align 32
%1 = load i8*** %argv_addr, align 64
%"ssa point" = bitcast i32 0 to i32
br label %"2"
"2": ; preds = %entry
call void @_gfortran_set_args(i32 %0, i8** %1) nounwind
call void @_gfortran_set_options(i32 8, i32* getelementptr inbounds ([8 x i32]* @options.1.1541, i64 0, i64 0)) nounwind
call void @MAIN__() nounwind uwtable
store i32 0, i32* %memtmp, align 1
br label %return
return: ; preds = %"2"
%retval = load i32* %memtmp
ret i32 %retval
}
declare void @_gfortran_set_args(i32, i8**)
declare void @_gfortran_set_options(i32, i32*)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment