diff --git a/src/llvmio.jl b/src/llvmio.jl index dd48162..dfb45a8 100644 --- a/src/llvmio.jl +++ b/src/llvmio.jl @@ -263,6 +263,22 @@ ret i64 %jlfp } + attributes #0 = { alwaysinline nounwind ssp uwtable } + """, "main"), Ptr{FILE}, Tuple{}) + end +elseif Sys.iswindows() + @inline function stdoutp() + @assert Int===Int64 + Base.llvmcall((""" + declare i8* @__acrt_iob_func(i32 noundef) + + define i64 @main() #0 { + entry: + %ptr = call i8* @__acrt_iob_func(i32 noundef 1) + %jlfp = ptrtoint i8* %ptr to i64 + ret i64 %jlfp + } + attributes #0 = { alwaysinline nounwind ssp uwtable } """, "main"), Ptr{FILE}, Tuple{}) end @@ -316,6 +332,22 @@ end ret i64 %jlfp } + attributes #0 = { alwaysinline nounwind ssp uwtable } + """, "main"), Ptr{FILE}, Tuple{}) + end +elseif Sys.iswindows() + @inline function stderrp() + @assert Int===Int64 + Base.llvmcall((""" + declare i8* @__acrt_iob_func(i32 noundef) + + define i64 @main() #0 { + entry: + %ptr = call i8* @__acrt_iob_func(i32 noundef 2) + %jlfp = ptrtoint i8* %ptr to i64 + ret i64 %jlfp + } + attributes #0 = { alwaysinline nounwind ssp uwtable } """, "main"), Ptr{FILE}, Tuple{}) end @@ -365,6 +397,22 @@ end ret i64 %jlfp } + attributes #0 = { alwaysinline nounwind ssp uwtable } + """, "main"), Ptr{FILE}, Tuple{}) + end +elseif Sys.iswindows() + @inline function stdinp() + @assert Int===Int64 + Base.llvmcall((""" + declare i8* @__acrt_iob_func(i32 noundef) + + define i64 @main() #0 { + entry: + %ptr = call i8* @__acrt_iob_func(i32 noundef 0) + %jlfp = ptrtoint i8* %ptr to i64 + ret i64 %jlfp + } + attributes #0 = { alwaysinline nounwind ssp uwtable } """, "main"), Ptr{FILE}, Tuple{}) end