X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=docs%2FWritingAnLLVMBackend.html;h=909432ef453d74f1276a930a963109a4fac90dd6;hb=2a6a6457094e05e5f5ab34f90dbd25c13d61f8b5;hp=abf91feb8a87de0dfd53f889325c8818fa734513;hpb=4937c9db28245bf5a24c07802c1e09365e25347c;p=oota-llvm.git diff --git a/docs/WritingAnLLVMBackend.html b/docs/WritingAnLLVMBackend.html index abf91feb8a8..909432ef453 100644 --- a/docs/WritingAnLLVMBackend.html +++ b/docs/WritingAnLLVMBackend.html @@ -61,28 +61,29 @@ convert the LLVM representation to machine assembly code or other languages.

-

In general, you want to follow the format of X86 or PowerPC (in -lib/Target).

+

In general, you want to follow the format of SPARC, X86 or PowerPC (in +lib/Target). SPARC is the simplest backend, and is RISC, so if +you're working on a RISC target, it is a good one to start with.

To create a static compiler (one that emits text assembly), you need to implement the following:

- -

You also need to write an instruction selector for your platform. The -recommended method is the pattern-matching instruction selector. You can see -examples in other targets: lib/Target/*/*ISelPattern.cpp. The former -method for writing instruction selectors (not recommended) is -encapsulated in lib/Target/*/*ISelSimple.cpp, which are -InstVisitor-based translators, generating code for an LLVM instruction -at a time. Creating an instruction selector is perhaps the most time-consuming -part of creating a back-end.

- -

To create a JIT for your platform:

- +
  • Implement the assembly printer for the architecture. + +
  • +
  • Implement an instruction selector for the architecture. + +
  • +
  • Optionally, add subtarget support. +
  • Optionally, add JIT support. + - -

    Note that lib/target/Skeleton is a clean skeleton for a new target, -so you might want to start with that and adapt it for your target, and if you -are wondering how things are done, peek in the X86 or PowerPC target.

    - -

    The Skeleton target is non-functional but provides the basic building blocks -you will need for your endeavor.

    -
  • @@ -249,7 +251,7 @@ how the C backend is written.

    src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!" /> Misha Brukman
    - The LLVM Compiler Infrastructure + The LLVM Compiler Infrastructure
    Last modified: $Date$