[LLVMdev] C Support Libraries

Tim Northover t.p.northover at gmail.com
Sun May 5 23:46:56 PDT 2013

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



More information about the llvm-dev mailing list