Skip to content

Commit 8799cae

Browse files
committed
[opaque pointer types] Trivial changes towards CallInst requiring
explicit function types. llvm-svn: 353009
1 parent 1002ab3 commit 8799cae

10 files changed

+112
-109
lines changed

clang/lib/CodeGen/CGBuiltin.cpp

+92-89
Large diffs are not rendered by default.

clang/lib/CodeGen/CGCall.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -3368,7 +3368,7 @@ void CallArgList::allocateArgumentMemory(CodeGenFunction &CGF) {
33683368
void CallArgList::freeArgumentMemory(CodeGenFunction &CGF) const {
33693369
if (StackBase) {
33703370
// Restore the stack after the call.
3371-
llvm::Value *F = CGF.CGM.getIntrinsic(llvm::Intrinsic::stackrestore);
3371+
llvm::Function *F = CGF.CGM.getIntrinsic(llvm::Intrinsic::stackrestore);
33723372
CGF.Builder.CreateCall(F, StackBase);
33733373
}
33743374
}

clang/lib/CodeGen/CGCoroutine.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ RValue CodeGenFunction::EmitCoroutineIntrinsic(const CallExpr *E,
735735
for (const Expr *Arg : E->arguments())
736736
Args.push_back(EmitScalarExpr(Arg));
737737

738-
llvm::Value *F = CGM.getIntrinsic(IID);
738+
llvm::Function *F = CGM.getIntrinsic(IID);
739739
llvm::CallInst *Call = Builder.CreateCall(F, Args);
740740

741741
// Note: The following code is to enable to emit coro.id and coro.begin by

clang/lib/CodeGen/CGDecl.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ namespace {
537537
CallStackRestore(Address Stack) : Stack(Stack) {}
538538
void Emit(CodeGenFunction &CGF, Flags flags) override {
539539
llvm::Value *V = CGF.Builder.CreateLoad(Stack);
540-
llvm::Value *F = CGF.CGM.getIntrinsic(llvm::Intrinsic::stackrestore);
540+
llvm::Function *F = CGF.CGM.getIntrinsic(llvm::Intrinsic::stackrestore);
541541
CGF.Builder.CreateCall(F, V);
542542
}
543543
};
@@ -1453,7 +1453,7 @@ CodeGenFunction::EmitAutoVarAlloca(const VarDecl &D) {
14531453
Address Stack =
14541454
CreateTempAlloca(Int8PtrTy, getPointerAlign(), "saved_stack");
14551455

1456-
llvm::Value *F = CGM.getIntrinsic(llvm::Intrinsic::stacksave);
1456+
llvm::Function *F = CGM.getIntrinsic(llvm::Intrinsic::stacksave);
14571457
llvm::Value *V = Builder.CreateCall(F);
14581458
Builder.CreateStore(V, Stack);
14591459

clang/lib/CodeGen/CGDeclCXX.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ void CodeGenFunction::EmitInvariantStart(llvm::Constant *Addr, CharUnits Size) {
149149
llvm::Intrinsic::ID InvStartID = llvm::Intrinsic::invariant_start;
150150
// Overloaded address space type.
151151
llvm::Type *ObjectPtr[1] = {Int8PtrTy};
152-
llvm::Constant *InvariantStart = CGM.getIntrinsic(InvStartID, ObjectPtr);
152+
llvm::Function *InvariantStart = CGM.getIntrinsic(InvStartID, ObjectPtr);
153153

154154
// Emit a call with the size in bytes of the object.
155155
uint64_t Width = Size.getQuantity();

clang/lib/CodeGen/CGException.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -975,15 +975,15 @@ static void emitWasmCatchPadBlock(CodeGenFunction &CGF,
975975
// Create calls to wasm.get.exception and wasm.get.ehselector intrinsics.
976976
// Before they are lowered appropriately later, they provide values for the
977977
// exception and selector.
978-
llvm::Value *GetExnFn =
978+
llvm::Function *GetExnFn =
979979
CGF.CGM.getIntrinsic(llvm::Intrinsic::wasm_get_exception);
980-
llvm::Value *GetSelectorFn =
980+
llvm::Function *GetSelectorFn =
981981
CGF.CGM.getIntrinsic(llvm::Intrinsic::wasm_get_ehselector);
982982
llvm::CallInst *Exn = CGF.Builder.CreateCall(GetExnFn, CPI);
983983
CGF.Builder.CreateStore(Exn, CGF.getExceptionSlot());
984984
llvm::CallInst *Selector = CGF.Builder.CreateCall(GetSelectorFn, CPI);
985985

986-
llvm::Value *TypeIDFn = CGF.CGM.getIntrinsic(llvm::Intrinsic::eh_typeid_for);
986+
llvm::Function *TypeIDFn = CGF.CGM.getIntrinsic(llvm::Intrinsic::eh_typeid_for);
987987

988988
// If there's only a single catch-all, branch directly to its handler.
989989
if (CatchScope.getNumHandlers() == 1 &&
@@ -1067,7 +1067,7 @@ static void emitCatchDispatchBlock(CodeGenFunction &CGF,
10671067
CGF.EmitBlockAfterUses(dispatchBlock);
10681068

10691069
// Select the right handler.
1070-
llvm::Value *llvm_eh_typeid_for =
1070+
llvm::Function *llvm_eh_typeid_for =
10711071
CGF.CGM.getIntrinsic(llvm::Intrinsic::eh_typeid_for);
10721072

10731073
// Load the selector value.
@@ -1543,7 +1543,7 @@ llvm::BasicBlock *CodeGenFunction::getTerminateFunclet() {
15431543
// __clang_call_terminate function.
15441544
if (getLangOpts().CPlusPlus &&
15451545
EHPersonality::get(*this).isWasmPersonality()) {
1546-
llvm::Value *GetExnFn =
1546+
llvm::Function *GetExnFn =
15471547
CGM.getIntrinsic(llvm::Intrinsic::wasm_get_exception);
15481548
Exn = Builder.CreateCall(GetExnFn, CurrentFuncletPad);
15491549
}
@@ -1630,7 +1630,7 @@ struct PerformSEHFinally final : EHScopeStack::Cleanup {
16301630
if (CGF.IsOutlinedSEHHelper) {
16311631
FP = &CGF.CurFn->arg_begin()[1];
16321632
} else {
1633-
llvm::Value *LocalAddrFn =
1633+
llvm::Function *LocalAddrFn =
16341634
CGM.getIntrinsic(llvm::Intrinsic::localaddress);
16351635
FP = CGF.Builder.CreateCall(LocalAddrFn);
16361636
}

clang/lib/CodeGen/CGExpr.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ void CodeGenFunction::EmitTypeCheck(TypeCheckKind TCK, SourceLocation Loc,
724724
// to check this.
725725
// FIXME: Get object address space
726726
llvm::Type *Tys[2] = { IntPtrTy, Int8PtrTy };
727-
llvm::Value *F = CGM.getIntrinsic(llvm::Intrinsic::objectsize, Tys);
727+
llvm::Function *F = CGM.getIntrinsic(llvm::Intrinsic::objectsize, Tys);
728728
llvm::Value *Min = Builder.getFalse();
729729
llvm::Value *NullIsUnknown = Builder.getFalse();
730730
llvm::Value *Dynamic = Builder.getFalse();
@@ -1904,7 +1904,7 @@ RValue CodeGenFunction::EmitLoadOfGlobalRegLValue(LValue LV) {
19041904
Ty = CGM.getTypes().getDataLayout().getIntPtrType(OrigTy);
19051905
llvm::Type *Types[] = { Ty };
19061906

1907-
llvm::Value *F = CGM.getIntrinsic(llvm::Intrinsic::read_register, Types);
1907+
llvm::Function *F = CGM.getIntrinsic(llvm::Intrinsic::read_register, Types);
19081908
llvm::Value *Call = Builder.CreateCall(
19091909
F, llvm::MetadataAsValue::get(Ty->getContext(), RegName));
19101910
if (OrigTy->isPointerTy())
@@ -2165,7 +2165,7 @@ void CodeGenFunction::EmitStoreThroughGlobalRegLValue(RValue Src, LValue Dst) {
21652165
Ty = CGM.getTypes().getDataLayout().getIntPtrType(OrigTy);
21662166
llvm::Type *Types[] = { Ty };
21672167

2168-
llvm::Value *F = CGM.getIntrinsic(llvm::Intrinsic::write_register, Types);
2168+
llvm::Function *F = CGM.getIntrinsic(llvm::Intrinsic::write_register, Types);
21692169
llvm::Value *Value = Src.getScalarVal();
21702170
if (OrigTy->isPointerTy())
21712171
Value = Builder.CreatePtrToInt(Value, Ty);

clang/lib/CodeGen/CGExprCXX.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,7 @@ static llvm::Value *EmitCXXNewAllocSize(CodeGenFunction &CGF,
863863
// can be ignored because the result shouldn't be used if
864864
// allocation fails.
865865
if (typeSizeMultiplier != 1) {
866-
llvm::Value *umul_with_overflow
866+
llvm::Function *umul_with_overflow
867867
= CGF.CGM.getIntrinsic(llvm::Intrinsic::umul_with_overflow, CGF.SizeTy);
868868

869869
llvm::Value *tsmV =
@@ -903,7 +903,7 @@ static llvm::Value *EmitCXXNewAllocSize(CodeGenFunction &CGF,
903903
if (cookieSize != 0) {
904904
sizeWithoutCookie = size;
905905

906-
llvm::Value *uadd_with_overflow
906+
llvm::Function *uadd_with_overflow
907907
= CGF.CGM.getIntrinsic(llvm::Intrinsic::uadd_with_overflow, CGF.SizeTy);
908908

909909
llvm::Value *cookieSizeV = llvm::ConstantInt::get(CGF.SizeTy, cookieSize);

clang/lib/CodeGen/CodeGenFunction.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -2249,7 +2249,7 @@ void CodeGenFunction::EmitAlignmentAssumption(llvm::Value *PtrValue,
22492249
OffsetValue);
22502250
}
22512251

2252-
llvm::Value *CodeGenFunction::EmitAnnotationCall(llvm::Value *AnnotationFn,
2252+
llvm::Value *CodeGenFunction::EmitAnnotationCall(llvm::Function *AnnotationFn,
22532253
llvm::Value *AnnotatedVal,
22542254
StringRef AnnotationStr,
22552255
SourceLocation Location) {
@@ -2277,7 +2277,7 @@ Address CodeGenFunction::EmitFieldAnnotations(const FieldDecl *D,
22772277
assert(D->hasAttr<AnnotateAttr>() && "no annotate attribute");
22782278
llvm::Value *V = Addr.getPointer();
22792279
llvm::Type *VTy = V->getType();
2280-
llvm::Value *F = CGM.getIntrinsic(llvm::Intrinsic::ptr_annotation,
2280+
llvm::Function *F = CGM.getIntrinsic(llvm::Intrinsic::ptr_annotation,
22812281
CGM.Int8PtrTy);
22822282

22832283
for (const auto *I : D->specific_attrs<AnnotateAttr>()) {

clang/lib/CodeGen/CodeGenFunction.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -3990,8 +3990,8 @@ class CodeGenFunction : public CodeGenTypeCache {
39903990
// Annotations Emission
39913991
//===--------------------------------------------------------------------===//
39923992

3993-
/// Emit an annotation call (intrinsic or builtin).
3994-
llvm::Value *EmitAnnotationCall(llvm::Value *AnnotationFn,
3993+
/// Emit an annotation call (intrinsic).
3994+
llvm::Value *EmitAnnotationCall(llvm::Function *AnnotationFn,
39953995
llvm::Value *AnnotatedVal,
39963996
StringRef AnnotationStr,
39973997
SourceLocation Location);

0 commit comments

Comments
 (0)