//===- ProfilingUtils.cpp - Helper functions shared by profilers ----------===//
-//
+//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
-//
+//
//===----------------------------------------------------------------------===//
//
// This files implements a few helper functions which are used by profile
const PointerType *UIntPtr = PointerType::get(Type::UIntTy);
Module &M = *MainFn->getParent();
Function *InitFn = M.getOrInsertFunction(FnName, Type::IntTy, Type::IntTy,
- ArgVTy, UIntPtr, Type::UIntTy, 0);
+ ArgVTy, UIntPtr, Type::UIntTy,
+ (Type *)0);
// This could force argc and argv into programs that wouldn't otherwise have
// them, but instead we just pass null values in.
// pass null.
Args[2] = ConstantPointerNull::get(UIntPtr);
}
- Args[3] = ConstantUInt::get(Type::UIntTy, NumElements);
-
+ Args[3] = ConstantInt::get(Type::UIntTy, NumElements);
+
Instruction *InitCall = new CallInst(InitFn, Args, "newargc", InsertPos);
// If argc or argv are not available in main, just pass null values in.
case 2:
AI = MainFn->arg_begin(); ++AI;
if (AI->getType() != ArgVTy) {
- InitCall->setOperand(2, new CastInst(AI, ArgVTy, "argv.cast", InitCall));
+ InitCall->setOperand(2,
+ CastInst::createInferredCast(AI, ArgVTy, "argv.cast", InitCall));
} else {
InitCall->setOperand(2, AI);
}
// init call instead.
if (AI->getType() != Type::IntTy) {
if (!AI->use_empty())
- AI->replaceAllUsesWith(new CastInst(InitCall, AI->getType(), "",
- InsertPos));
- InitCall->setOperand(1, new CastInst(AI, Type::IntTy, "argc.cast",
- InitCall));
+ AI->replaceAllUsesWith(
+ CastInst::createInferredCast(InitCall, AI->getType(), "", InsertPos));
+ InitCall->setOperand(1,
+ CastInst::createInferredCast(AI, Type::IntTy, "argc.cast", InitCall));
} else {
AI->replaceAllUsesWith(InitCall);
InitCall->setOperand(1, AI);
}
-
+
case 0: break;
}
}
// Create the getelementptr constant expression
std::vector<Constant*> Indices(2);
Indices[0] = Constant::getNullValue(Type::IntTy);
- Indices[1] = ConstantSInt::get(Type::IntTy, CounterNum);
+ Indices[1] = ConstantInt::get(Type::IntTy, CounterNum);
Constant *ElementPtr = ConstantExpr::getGetElementPtr(CounterArray, Indices);
// Load, increment and store the value back.