8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I want to call printf. When using clang, it emits:
declare i32 @printf(i8*, ...)
How do I make a new function with llir, with ... as the argument?
...
The text was updated successfully, but these errors were encountered:
Hi @Nv7-GitHub,
Glad to see you experimenting with LLVM IR in Go :)
Set the Variadic field of ir.Func.Sig to true.
true
package main import ( "fmt" "github.com/llir/llvm/ir" irtypes "github.com/llir/llvm/ir/types" ) func main() { i32Type := irtypes.I32 i8PtrType := irtypes.NewPointer(irtypes.I8) param := ir.NewParam("format", i8PtrType) printfFunc := ir.NewFunc("printf", i32Type, param) printfFunc.Sig.Variadic = true module := ir.NewModule() module.Funcs = append(module.Funcs, printfFunc) fmt.Println(module) }
Output:
declare i32 @printf(i8* %format, ...)
Cheers, Robin
Sorry, something went wrong.
Closing this issue for now as resolved. Hope it helped. And if not, just write a comment and we can re-open it.
No branches or pull requests
I want to call printf. When using clang, it emits:
How do I make a new function with llir, with
...
as the argument?The text was updated successfully, but these errors were encountered: