X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=docs%2FWritingAnLLVMBackend.html;h=dcea204e47cd02d7f322004a1e4aa9c693f1a1d7;hb=39865c052dd161134c7ae5610424c8eb3f6a1be3;hp=1fb88a363321c1186205a25cdbc5276335046981;hpb=8eb6719b1c13eadcb76d2249f2fcc5ff18de22e3;p=oota-llvm.git diff --git a/docs/WritingAnLLVMBackend.html b/docs/WritingAnLLVMBackend.html index 1fb88a36332..dcea204e47c 100644 --- a/docs/WritingAnLLVMBackend.html +++ b/docs/WritingAnLLVMBackend.html @@ -16,12 +16,11 @@
  • Introduction
  • Writing a backend
      -
    1. Machine backends
    2. +
    3. Machine backends
      1. Outline
      2. Implementation details
    4. -
    5. Machine backends
    6. Language backends
  • Related reading material @@ -92,6 +91,18 @@ implement the following:

    href="CodeGenerator.html#targetmachine">TargetMachine, which configures TargetData correctly
  • +
  • Register your new target using the RegisterTarget + template:

    +
    +RegisterTarget<MyTargetMachine> M("short_name", "  Target name");
    +
    +
    Here, MyTargetMachine is the name of your implemented + subclass of TargetMachine, + short_name is the option that will be active following + -march= to select a target in llc and lli, and the last string + is the description of your target to appear in -help + listing.
  • Implement the assembly printer for the architecture. Usually, if you have described the instruction set with the assembly printer generator in mind, that @@ -148,15 +159,15 @@ architected registers.

     // class Register is defined in Target.td
    -class TargetReg : Register {
    +class TargetReg<string name> : Register<name> {
       let Namespace = "Target";
     }
     
    -class IntReg<bits<5> num> : TargetReg {
    +class IntReg<bits<5> num, string name> : TargetReg<name> {
       field bits<5> Num = num;
     }
     
    -def R0 : IntReg<0>;
    +def R0 : IntReg<0, "%R0">;
     ...
     
     // class RegisterClass is defined in Target.td