27 const SmallVectorImpl<int32_t> &ArgPos,
28 ArrayRef<RuntimeConstant> RC) {
29 auto &Ctx = M.getContext();
32 for (
size_t I = 0; I < ArgPos.size(); ++I) {
33 int ArgNo = ArgPos[I];
34 Value *Arg = F.getArg(ArgNo);
35 Type *ArgType = Arg->getType();
36 Constant *C =
nullptr;
37 if (ArgType->isIntegerTy(1)) {
38 C = ConstantInt::get(ArgType, RC[I].Value.BoolVal);
39 }
else if (ArgType->isIntegerTy(8)) {
40 C = ConstantInt::get(ArgType, RC[I].Value.Int8Val);
41 }
else if (ArgType->isIntegerTy(32)) {
43 C = ConstantInt::get(ArgType, RC[I].Value.Int32Val);
44 }
else if (ArgType->isIntegerTy(64)) {
46 C = ConstantInt::get(ArgType, RC[I].Value.Int64Val);
47 }
else if (ArgType->isFloatTy()) {
49 C = ConstantFP::get(ArgType, RC[I].Value.FloatVal);
54 else if (ArgType->isDoubleTy()) {
56 C = ConstantFP::get(ArgType, RC[I].Value.DoubleVal);
57 }
else if (ArgType->isX86_FP80Ty() || ArgType->isPPC_FP128Ty() ||
58 ArgType->isFP128Ty()) {
59 C = ConstantFP::get(ArgType, RC[I].Value.LongDoubleVal);
60 }
else if (ArgType->isPointerTy()) {
62 ConstantInt::get(Type::getInt64Ty(Ctx), RC[I].Value.Int64Val);
63 C = ConstantExpr::getIntToPtr(IntC, ArgType);
65 std::string TypeString;
66 raw_string_ostream TypeOstream(TypeString);
67 ArgType->print(TypeOstream);
73 << F.getName() +
" ArgNo " << ArgNo
74 <<
" with value " << *C <<
"\n");
75 Arg->replaceAllUsesWith(C);