From c3b05403b753996f6b1db4914df586e4b6b54d3a Mon Sep 17 00:00:00 2001
From: Chris Lattner
Date: Sun, 16 Oct 2005 17:03:22 +0000
Subject: [PATCH] Update this significantly, mention subtarget and isel
generation support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23760 91177308-0d34-0410-b5e6-96231b3b80d8
---
docs/WritingAnLLVMBackend.html | 65 +++++++++++++++++-----------------
1 file changed, 32 insertions(+), 33 deletions(-)
diff --git a/docs/WritingAnLLVMBackend.html b/docs/WritingAnLLVMBackend.html
index c215fc62a3f..ea5cd9c3da5 100644
--- a/docs/WritingAnLLVMBackend.html
+++ b/docs/WritingAnLLVMBackend.html
@@ -68,21 +68,21 @@ convert the LLVM representation to machine assembly code or other languages.
implement the following:
-- Describe the register set
+
- Describe the register set.
- Create a TableGen description of
the register set and register classes
- Implement a subclass of MRegisterInfo
-- Describe the instruction set
+
- Describe the instruction set.
-- Describe the target machine
+
- Describe the target machine.
- Create a TableGen description of
the target that describes the pointer size and references the instruction
@@ -104,38 +104,37 @@ RegisterTarget<MyTargetMachine> M("short_name", " Target name");
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
-step can be almost automated.
-
-
-You also need to write an instruction selector for your platform. The
-recommended method is the pattern-matching instruction selector,
-examples of which you can see in other targets:
-lib/Target/*/*ISelPattern.cpp. The former method for writing
-instruction selectors (not recommended for new targets) is evident 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.
+
+ - Define all of the assembly strings for your target, adding them to the
+ instructions in your *InstrInfo.td file.
+ - Implement the llvm::AsmPrinter interface.
+
+
+Implement an instruction selector for the architecture.
+
+ - The recommended method is the
+ pattern-matching DAG-to-DAG instruction selector (for example, see
+ the PowerPC backend in PPCISelDAGtoDAG.cpp). Parts of instruction
+ selector creation can be performed by adding patterns to the instructions
+ in your .td file.
+
+
+Optionally, add subtarget support.
-- Create a subclass of TargetJITInfo
-- Create a machine code emitter that will be used to emit binary code
- directly into memory, given MachineInstrs
+ - If your target has multiple subtargets (e.g. variants with different
+ capabilities), implement the llvm::TargetSubtarget interface
+ for your architecture. This allows you to add -mcpu= and
+ -mattr= options.
+
+Optionally, add JIT support.
+
+ - Create a subclass of TargetJITInfo
+ - Create a machine code emitter that will be used to emit binary code
+ directly into memory, given MachineInstrs
+
-
-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.
-