本文整理汇总了C++中IRBuilder::CreateGlobalStringPtr方法的典型用法代码示例。如果您正苦于以下问题:C++ IRBuilder::CreateGlobalStringPtr方法的具体用法?C++ IRBuilder::CreateGlobalStringPtr怎么用?C++ IRBuilder::CreateGlobalStringPtr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRBuilder
的用法示例。
在下文中一共展示了IRBuilder::CreateGlobalStringPtr方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateCrossCheck
void DataChecks::CreateCrossCheck(IRBuilder<> &Builder, Value *V) {
IntegerType *PtrIntTy = Builder.getIntPtrTy(*DL);
// Cast the value to IntPtrType
auto *VTy = V->getType();
if (VTy->isPointerTy())
V = Builder.CreatePtrToInt(V, PtrIntTy);
else
V = Builder.CreateZExtOrTrunc(V, PtrIntTy);
// Call the check function.
// TODO: Optimize by inlining the call?
if (XCheckLog) {
DebugLoc Loc = Builder.GetInsertPoint()->getDebugLoc();
Value *caller = Builder.CreateGlobalStringPtr(Builder.GetInsertBlock()->getParent()->getName());
Value *line, *col, *file;
if (Loc) {
line = Builder.getInt32(Loc.getLine());
col = Builder.getInt32(Loc.getCol());
file = Builder.CreateGlobalStringPtr(Loc->getFilename());
} else {
line = Builder.getInt32(-1);
col = Builder.getInt32(-1);
file = Builder.CreateGlobalStringPtr("unknown");
}
Builder.CreateCall(CheckFnTy, CheckFn, { caller, file, line, col, V });
} else {
Builder.CreateCall(CheckFnTy, CheckFn, {V});
}
NumCrossChecks++;
}