大佬教程收集整理的这篇文章主要介绍了如何仅使用一个 arg 调用 LLVM IR arg?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
在 LLVM IR 中,如果我将 printf 定义为单个 arg func,我就可以使用它。但是,如果我将其定义为 vararg,则会出现错误:
@msg = constant [13 x i8] c"Hello world\0A\00"
declare i32 @printf(i8*) ; works
;declare i32 @printf(i8*,...) ; error: '@printf' defined with type 'i32 (i8*,...)*'
; call i32 @printf(i8* %msg)
define i32 @main () {
%msg = getelementptr [13 x i8]* @msg,i64 0,i64 0
call i32 @printf(i8* %msg)
ret i32 0
}
我如何告诉 LLVM IR printf
是可变参数,但只用一个参数调用它?
注意 description of the call
instruction in the LLVM Language Reference 中的这段话(强调我的):
因此,如果函数是可变参数,则您确实需要在调用指令中提供函数类型。
以上是大佬教程为你收集整理的如何仅使用一个 arg 调用 LLVM IR arg?全部内容,希望文章能够帮你解决如何仅使用一个 arg 调用 LLVM IR arg?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。