diff options
Diffstat (limited to 'docs/CodeGenerator.rst')
-rw-r--r-- | docs/CodeGenerator.rst | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/docs/CodeGenerator.rst b/docs/CodeGenerator.rst index 10ca307b78699..c87a628672710 100644 --- a/docs/CodeGenerator.rst +++ b/docs/CodeGenerator.rst @@ -636,6 +636,18 @@ file (MCObjectStreamer). MCAsmStreamer is a straight-forward implementation that prints out a directive for each method (e.g. ``EmitValue -> .byte``), but MCObjectStreamer implements a full assembler. +For target specific directives, the MCStreamer has a MCTargetStreamer instance. +Each target that needs it defines a class that inherits from it and is a lot +like MCStreamer itself: It has one method per directive and two classes that +inherit from it, a target object streamer and a target asm streamer. The target +asm streamer just prints it (``emitFnStart -> .fnstrart``), and the object +streamer implement the assembler logic for it. + +To make llvm use these classes, the target initialization must call +TargetRegistry::RegisterAsmStreamer and TargetRegistry::RegisterMCObjectStreamer +passing callbacks that allocate the corresponding target streamer and pass it +to createAsmStreamer or to the appropriate object streamer constructor. + The ``MCContext`` class ----------------------- @@ -1614,7 +1626,7 @@ Implementing a Native Assembler =============================== Though you're probably reading this because you want to write or maintain a -compiler backend, LLVM also fully supports building a native assemblers too. +compiler backend, LLVM also fully supports building a native assembler. We've tried hard to automate the generation of the assembler from the .td files (in particular the instruction syntax and encodings), which means that a large part of the manual and repetitive data entry can be factored and shared with the @@ -1788,7 +1800,6 @@ Here is the table: :raw-html:`<th>Feature</th>` :raw-html:`<th>ARM</th>` :raw-html:`<th>Hexagon</th>` -:raw-html:`<th>MBlaze</th>` :raw-html:`<th>MSP430</th>` :raw-html:`<th>Mips</th>` :raw-html:`<th>NVPTX</th>` @@ -1803,7 +1814,6 @@ Here is the table: :raw-html:`<td><a href="#feat_reliable">is generally reliable</a></td>` :raw-html:`<td class="yes"></td> <!-- ARM -->` :raw-html:`<td class="yes"></td> <!-- Hexagon -->` -:raw-html:`<td class="no"></td> <!-- MBlaze -->` :raw-html:`<td class="unknown"></td> <!-- MSP430 -->` :raw-html:`<td class="yes"></td> <!-- Mips -->` :raw-html:`<td class="yes"></td> <!-- NVPTX -->` @@ -1818,7 +1828,6 @@ Here is the table: :raw-html:`<td><a href="#feat_asmparser">assembly parser</a></td>` :raw-html:`<td class="no"></td> <!-- ARM -->` :raw-html:`<td class="no"></td> <!-- Hexagon -->` -:raw-html:`<td class="yes"></td> <!-- MBlaze -->` :raw-html:`<td class="no"></td> <!-- MSP430 -->` :raw-html:`<td class="no"></td> <!-- Mips -->` :raw-html:`<td class="no"></td> <!-- NVPTX -->` @@ -1833,12 +1842,11 @@ Here is the table: :raw-html:`<td><a href="#feat_disassembler">disassembler</a></td>` :raw-html:`<td class="yes"></td> <!-- ARM -->` :raw-html:`<td class="no"></td> <!-- Hexagon -->` -:raw-html:`<td class="yes"></td> <!-- MBlaze -->` :raw-html:`<td class="no"></td> <!-- MSP430 -->` :raw-html:`<td class="no"></td> <!-- Mips -->` :raw-html:`<td class="na"></td> <!-- NVPTX -->` :raw-html:`<td class="no"></td> <!-- PowerPC -->` -:raw-html:`<td class="no"></td> <!-- SystemZ -->` +:raw-html:`<td class="yes"></td> <!-- SystemZ -->` :raw-html:`<td class="no"></td> <!-- Sparc -->` :raw-html:`<td class="yes"></td> <!-- X86 -->` :raw-html:`<td class="yes"></td> <!-- XCore -->` @@ -1848,7 +1856,6 @@ Here is the table: :raw-html:`<td><a href="#feat_inlineasm">inline asm</a></td>` :raw-html:`<td class="yes"></td> <!-- ARM -->` :raw-html:`<td class="yes"></td> <!-- Hexagon -->` -:raw-html:`<td class="yes"></td> <!-- MBlaze -->` :raw-html:`<td class="unknown"></td> <!-- MSP430 -->` :raw-html:`<td class="no"></td> <!-- Mips -->` :raw-html:`<td class="yes"></td> <!-- NVPTX -->` @@ -1863,7 +1870,6 @@ Here is the table: :raw-html:`<td><a href="#feat_jit">jit</a></td>` :raw-html:`<td class="partial"><a href="#feat_jit_arm">*</a></td> <!-- ARM -->` :raw-html:`<td class="no"></td> <!-- Hexagon -->` -:raw-html:`<td class="no"></td> <!-- MBlaze -->` :raw-html:`<td class="unknown"></td> <!-- MSP430 -->` :raw-html:`<td class="yes"></td> <!-- Mips -->` :raw-html:`<td class="na"></td> <!-- NVPTX -->` @@ -1878,7 +1884,6 @@ Here is the table: :raw-html:`<td><a href="#feat_objectwrite">.o file writing</a></td>` :raw-html:`<td class="no"></td> <!-- ARM -->` :raw-html:`<td class="no"></td> <!-- Hexagon -->` -:raw-html:`<td class="yes"></td> <!-- MBlaze -->` :raw-html:`<td class="no"></td> <!-- MSP430 -->` :raw-html:`<td class="no"></td> <!-- Mips -->` :raw-html:`<td class="na"></td> <!-- NVPTX -->` @@ -1893,7 +1898,6 @@ Here is the table: :raw-html:`<td><a hr:raw-html:`ef="#feat_tailcall">tail calls</a></td>` :raw-html:`<td class="yes"></td> <!-- ARM -->` :raw-html:`<td class="yes"></td> <!-- Hexagon -->` -:raw-html:`<td class="no"></td> <!-- MBlaze -->` :raw-html:`<td class="unknown"></td> <!-- MSP430 -->` :raw-html:`<td class="no"></td> <!-- Mips -->` :raw-html:`<td class="no"></td> <!-- NVPTX -->` @@ -1908,7 +1912,6 @@ Here is the table: :raw-html:`<td><a href="#feat_segstacks">segmented stacks</a></td>` :raw-html:`<td class="no"></td> <!-- ARM -->` :raw-html:`<td class="no"></td> <!-- Hexagon -->` -:raw-html:`<td class="no"></td> <!-- MBlaze -->` :raw-html:`<td class="no"></td> <!-- MSP430 -->` :raw-html:`<td class="no"></td> <!-- Mips -->` :raw-html:`<td class="no"></td> <!-- NVPTX -->` |