Supporting RTLIB calls (memset, memcpy, etc)

     Could you please tell me how can I make my new back end (inspired from BPF LLVM back end) select runtime libc calls like memset, etc from LLVM IR intrinsics.
     More exactly, I'm getting the following error:
       LLVM ERROR: Cannot select: t18: ch,glue = ConnexISD::CALL t16, TargetExternalSymbol:i64'memset', Register:i64 %R1, Register:i64 %R2, Register:i64 %R3, t16:1
     This happens after I:
         - edited method ConnexTargetLowering::ConnexTargetLowering() from file lib/Target/Connex/ConnexISelLowering.cpp and registered the RTLIB calls like this:
       // Inspired from lib/Target/ARM/ARMISelLowering.cpp, constructor ARMTargetLowering()
       static const struct {
         const RTLIB::Libcall Op;
         const char *const Name;
         const CallingConv::ID CC;
         const ISD::CondCode Cond;
       } MemOpsLibraryCalls = {
         // Memory operations
         { RTLIB::MEMMOVE, "memmove", CallingConv::C, ISD::SETCC_INVALID },
         { RTLIB::MEMSET, "memset", CallingConv::C, ISD::SETCC_INVALID },

       for (const auto &LC : MemOpsLibraryCalls) {
         setLibcallName(LC.Op, LC.Name);
         setLibcallCallingConv(LC.Op, LC.CC);
         if (LC.Cond != ISD::SETCC_INVALID)
           setCmpLibcallCC(LC.Op, LC.Cond);

         - added files
             lib/Target/Connex/ConnexSelectionDAGInfo.cpp, .h inspiring from lib/Target/ARM/ARMSelectionDAGInfo.* - I can provide, if required, excerpts from these source files.

     Note that I had some success to make opt avoid generating these calls in LLVM IR, which obviously avoids instruction selection also, by following advice from:
         - : "How do I disable that feature? I've tried -fno-builtin and/or -ffreestanding with no success. clang (as well as gcc) requires that freestanding environment provides memcpy, memmove, memset and memcmp."
         - (LLVM intrinsic functions - Stack Overflow "So to prevent (at least the memset) intrinsics in your code don't run instcombine on your IR. However, instcombine is a mighty opt pass that realy shortens the code.")

   Thank you,

It looks like LLVM correctly expanded your operation into a call to a runtime library function. The bug seems to be that your backend is not lowering the call instruction, causing compilation to fail.