+
+ // Check to see if this is an intrinsic function call...
+ if (Function *F = CS.getCalledFunction())
+ switch (F->getIntrinsicID()) {
+ case Intrinsic::va_start: // va_start: implemented by getFirstVarArg()
+ SetValue(CS.getInstruction(), getFirstVarArg(), SF);
+ return;
+ case Intrinsic::va_end: // va_end is a noop for the interpreter
+ return;
+ case Intrinsic::va_copy: // va_copy: dest = src
+ SetValue(CS.getInstruction(), getOperandValue(*CS.arg_begin(), SF), SF);
+ return;
+ default:
+ // If it is an unknown intrinsic function, using the intrinsic lowering
+ // class to transform it into hopefully tasty LLVM code.
+ //
+ Instruction *Prev = CS.getInstruction()->getPrev();
+ BasicBlock *Parent = CS.getInstruction()->getParent();
+ IL->LowerIntrinsicCall(cast<CallInst>(CS.getInstruction()));
+
+ // Restore the CurInst pointer to the first instruction newly inserted, if
+ // any.
+ if (!Prev) {
+ SF.CurInst = Parent->begin();
+ } else {
+ SF.CurInst = Prev;
+ ++SF.CurInst;
+ }
+ }
+