Skip to content

Commit 4cd05ec

Browse files
committed
Update stdoutp(), stderrp(), and stdinp()
1 parent 2b05794 commit 4cd05ec

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

src/llvmio.jl

+48
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,22 @@
263263
ret i64 %jlfp
264264
}
265265
266+
attributes #0 = { alwaysinline nounwind ssp uwtable }
267+
""", "main"), Ptr{FILE}, Tuple{})
268+
end
269+
elseif Sys.iswindows()
270+
@inline function stdoutp()
271+
@assert Int===Int64
272+
Base.llvmcall(("""
273+
declare i8* @__acrt_iob_func(i32 noundef)
274+
275+
define i64 @main() #0 {
276+
entry:
277+
%ptr = call i8* @__acrt_iob_func(i32 noundef 1)
278+
%jlfp = ptrtoint i8* %ptr to i64
279+
ret i64 %jlfp
280+
}
281+
266282
attributes #0 = { alwaysinline nounwind ssp uwtable }
267283
""", "main"), Ptr{FILE}, Tuple{})
268284
end
@@ -316,6 +332,22 @@ end
316332
ret i64 %jlfp
317333
}
318334
335+
attributes #0 = { alwaysinline nounwind ssp uwtable }
336+
""", "main"), Ptr{FILE}, Tuple{})
337+
end
338+
elseif Sys.iswindows()
339+
@inline function stderrp()
340+
@assert Int===Int64
341+
Base.llvmcall(("""
342+
declare i8* @__acrt_iob_func(i32 noundef)
343+
344+
define i64 @main() #0 {
345+
entry:
346+
%ptr = call i8* @__acrt_iob_func(i32 noundef 2)
347+
%jlfp = ptrtoint i8* %ptr to i64
348+
ret i64 %jlfp
349+
}
350+
319351
attributes #0 = { alwaysinline nounwind ssp uwtable }
320352
""", "main"), Ptr{FILE}, Tuple{})
321353
end
@@ -365,6 +397,22 @@ end
365397
ret i64 %jlfp
366398
}
367399
400+
attributes #0 = { alwaysinline nounwind ssp uwtable }
401+
""", "main"), Ptr{FILE}, Tuple{})
402+
end
403+
elseif Sys.iswindows()
404+
@inline function stdinp()
405+
@assert Int===Int64
406+
Base.llvmcall(("""
407+
declare i8* @__acrt_iob_func(i32 noundef)
408+
409+
define i64 @main() #0 {
410+
entry:
411+
%ptr = call i8* @__acrt_iob_func(i32 noundef 0)
412+
%jlfp = ptrtoint i8* %ptr to i64
413+
ret i64 %jlfp
414+
}
415+
368416
attributes #0 = { alwaysinline nounwind ssp uwtable }
369417
""", "main"), Ptr{FILE}, Tuple{})
370418
end

0 commit comments

Comments
 (0)