ssarangi
ssarangi

Reputation: 612

using an llvm backend (Mips, Sparc etc)

I am trying to find some code examples which allow me to hook up a llvm backend for code generation. For example, hooking up the IR to either the Mips or Sparc backend. However, I haven't been able to find any such examples. The only closest thing I could find is the use of the AMD IL & GPU backend, currently in the mesa tree but not yet merged into the llvm backend. I have read the Writing an LLVM Backend tutorial but its not really obvious to me as to how to hook up the backend. I am sure I am missing something from the examples so could someone point me to some examples for this ? I already have code to generate the IR. Thanks

Upvotes: 2

Views: 945

Answers (2)

lei_z
lei_z

Reputation: 1107

The llc command would compile LLVM IR to target machine assembly. With argument "march=[your target]", you can get assembly for different targets, "march=mips" for Mips, for example.

Upvotes: 1

Richard Pennington
Richard Pennington

Reputation: 19965

You might want to look at the LLVM llc command. It reads a bitcode IR file and calls any of the backends on it.

Upvotes: 1

Related Questions