[LLVMdev] Lowering intrinsics in Codegen.

Sanjiv Gupta sanjiv.gupta at microchip.com
Wed Jul 29 04:56:06 PDT 2009


For lowering llvm.memcpy.* etc SelectionDAG::getMemcpy  generates a 
libcall to "memcpy" as a last resort. See the code snippets below.


// FIXME: pass in DebugLoc
  std::pair<SDValue,SDValue> CallResult =
    TLI.LowerCallTo(Chain, Type::VoidTy,
                    false, false, false, false, 0, CallingConv::C, false,
                    getExternalSymbol("memcpy", TLI.getPointerTy()),
                    Args, *this, dl);
  return CallResult.second;

I have two questions here:

1. Is it okay to allow the targets to choose the name, similar to 
RTLIB:: enum way for other calls. ?

2. Why a prototype for "memcpy" isn't being added?

Could we have done this intrinsic lowering using the IntrinsicLowering 
class?

- Sanjiv




More information about the llvm-dev mailing list