From b5f6e2520e3c97328d130b9a7a0b05caf7e4eba9 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 16 Jan 2006 16:31:40 +0000 Subject: [PATCH] Add a couple very minor tweaks git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25359 91177308-0d34-0410-b5e6-96231b3b80d8 --- docs/ExtendingLLVM.html | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/docs/ExtendingLLVM.html b/docs/ExtendingLLVM.html index b86d561794c..419b7c634f2 100644 --- a/docs/ExtendingLLVM.html +++ b/docs/ExtendingLLVM.html @@ -26,7 +26,8 @@

Written by Misha Brukman, - Brad Jones, and Chris Lattner

+ Brad Jones, Nate Begeman, + and Chris Lattner

@@ -123,7 +124,8 @@ Second, if it makes sense to lower the intrinsic to an expanded sequence of C code in all cases, just emit the expansion in visitCallInst in Writer.cpp. If the intrinsic has some way to express it with GCC (or any other compiler) extensions, it can be conditionally supported based on -the compiler compiling the CBE output (see llvm.prefetch for an example). +the compiler compiling the CBE output (see llvm.prefetch for an +example). Third, if the intrinsic really has no way to be lowered, just have the code generator emit code that prints an error message and calls abort if executed. @@ -136,13 +138,14 @@ generator emit code that prints an error message and calls abort if executed. code, you will likely need to add support for your intrinsic there as well. This is usually accomplished by adding a new node, and then teaching the SelectionDAG code how to handle that node. To do this, follow the steps in -the next section, Adding a new SelectionDAG node. +the Adding a new SelectionDAG node section.
Once you have added the new node, add code to SelectionDAG/SelectionDAGISel.cpp to recognize the intrinsic. In most cases, the intrinsic will just be turned into the node you just added. For an -example of this, see how visitIntrinsicCall handles Intrinsic::ctpop +example of this, see how visitIntrinsicCall handles +Intrinsic::ctpop_*.
@@ -182,14 +185,15 @@ complicated behavior in a single node (rotate).

targets supported by the SelectionDAG framework will natively support the new node. In this case, you must also add code in your node's case statement in LegalizeOp to Expand your node into simpler, legal - operations. The case for ISD::UREM for expanding a remainder into a - multiply and a subtract is a good example. + operations. The case for ISD::UREM for expanding a remainder into + a divide, multiply, and a subtract is a good example.
  • lib/CodeGen/SelectionDAG/LegalizeDAG.cpp: If targets may support the new node being added only at certain sizes, you will also need to add code to your node's case statement in LegalizeOp to Promote your node's operands to a larger size, and perform the correct operation. You will also need to add code to - PromoteOp to do this as well. For a good example, see ISD::BSWAP, + PromoteOp to do this as well. For a good example, see + ISD::BSWAP, which promotes its operand to a wider size, performs the byteswap, and then shifts the correct bytes right to emulate the narrower byteswap in the wider type.
  • -- 2.34.1