Hi, I'm writing a Scheme compiler in C++ with the LLVM library. The dynamic type system is hard to tackle with direct LLVM from the C++ lib, so I'd like to throw the work off into a C support library I could link the compiled Scheme with. How can I generate code that depends on/calls external symbols? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130506/ff2e6297/attachment.html>
Hi Tyler,> How can I generate code that depends on/calls external symbols?You should be able to just declare and use them in the LLVM IR you produce: @global_var = global i32 0 declare i32 @get_another() define i32 @foo() { %lhs = load i32* @global_var %rhs = call i32 @get_another() %result = add i32 %lhs, %rhs ret i32 %result } To see some C++ that could implement this, try running llc with the "cpp" backend $ llc -march=cpp something.ll Cheers. Tim.