Skip to content

Commit 69d636a

Browse files
committed
Remove legacy LLCallBasePtr
1 parent 5d3ded9 commit 69d636a

File tree

6 files changed

+26
-28
lines changed

6 files changed

+26
-28
lines changed

gen/funcgenstate.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,10 @@ FuncGenState::FuncGenState(IrFunction &irFunc, IRState &irs)
103103
: irFunc(irFunc), scopes(irs), localVariableLifetimeAnnotator(irs),
104104
jumpTargets(scopes), switchTargets(), irs(irs) {}
105105

106-
LLCallBasePtr FuncGenState::callOrInvoke(llvm::Value *callee,
107-
llvm::FunctionType *calleeType,
108-
llvm::ArrayRef<llvm::Value *> args,
109-
const char *name, bool isNothrow) {
106+
llvm::CallBase *FuncGenState::callOrInvoke(llvm::Value *callee,
107+
llvm::FunctionType *calleeType,
108+
llvm::ArrayRef<llvm::Value *> args,
109+
const char *name, bool isNothrow) {
110110
// If this is a direct call, we might be able to use the callee attributes
111111
// to our advantage.
112112
llvm::Function *calleeFn = llvm::dyn_cast<llvm::Function>(callee);

gen/funcgenstate.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,10 @@ class FuncGenState {
202202

203203
/// Emits a call or invoke to the given callee, depending on whether there
204204
/// are catches/cleanups active or not.
205-
LLCallBasePtr callOrInvoke(llvm::Value *callee,
206-
llvm::FunctionType *calleeType,
207-
llvm::ArrayRef<llvm::Value *> args,
208-
const char *name = "", bool isNothrow = false);
205+
llvm::CallBase *callOrInvoke(llvm::Value *callee,
206+
llvm::FunctionType *calleeType,
207+
llvm::ArrayRef<llvm::Value *> args,
208+
const char *name = "", bool isNothrow = false);
209209

210210
private:
211211
IRState &irs;

gen/llvm.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,3 @@ using llvm::IRBuilder;
6060
#define LLConstantFP llvm::ConstantFP
6161

6262
#define LLSmallVector llvm::SmallVector
63-
64-
using LLCallBasePtr = llvm::CallBase *;

gen/passes/GarbageCollect2Stack.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ static void EmitMemZero(IRBuilder<> &B, Value *Dst, Value *Len,
9191

9292
//namespace {
9393

94-
Value* FunctionInfo::promote(LLCallBasePtr CB, IRBuilder<> &B, const G2StackAnalysis &A) {
94+
Value* FunctionInfo::promote(CallBase *CB, IRBuilder<> &B, const G2StackAnalysis &A) {
9595
NumGcToStack++;
9696

9797
auto &BB = CB->getCaller()->getEntryBlock();
@@ -128,7 +128,7 @@ static bool isKnownLessThan(Value *Val, uint64_t Limit, const G2StackAnalysis &A
128128
return true;
129129
}
130130

131-
bool TypeInfoFI::analyze(LLCallBasePtr CB, const G2StackAnalysis &A) {
131+
bool TypeInfoFI::analyze(CallBase *CB, const G2StackAnalysis &A) {
132132
Value *TypeInfo = CB->getArgOperand(TypeInfoArgNr);
133133
Ty = A.getTypeFor(TypeInfo, 0);
134134
if (!Ty) {
@@ -137,7 +137,7 @@ bool TypeInfoFI::analyze(LLCallBasePtr CB, const G2StackAnalysis &A) {
137137
return A.DL.getTypeAllocSize(Ty) < SizeLimit;
138138
}
139139

140-
bool ArrayFI::analyze(LLCallBasePtr CB, const G2StackAnalysis &A) {
140+
bool ArrayFI::analyze(CallBase *CB, const G2StackAnalysis &A) {
141141
if (!TypeInfoFI::analyze(CB, A)) {
142142
return false;
143143
}
@@ -160,7 +160,7 @@ bool ArrayFI::analyze(LLCallBasePtr CB, const G2StackAnalysis &A) {
160160
return true;
161161
}
162162

163-
Value* ArrayFI::promote(LLCallBasePtr CB, IRBuilder<> &B, const G2StackAnalysis &A) {
163+
Value* ArrayFI::promote(CallBase *CB, IRBuilder<> &B, const G2StackAnalysis &A) {
164164
// If the allocation is of constant size it's best to put it in the
165165
// entry block, so do so if we're not already there.
166166
// For dynamically-sized allocations it's best to avoid the overhead
@@ -203,7 +203,7 @@ Value* ArrayFI::promote(LLCallBasePtr CB, IRBuilder<> &B, const G2StackAnalysis
203203

204204
return alloca;
205205
}
206-
bool AllocClassFI::analyze(LLCallBasePtr CB, const G2StackAnalysis &A) {
206+
bool AllocClassFI::analyze(CallBase *CB, const G2StackAnalysis &A) {
207207
if (CB->arg_size() != 1) {
208208
return false;
209209
}
@@ -238,7 +238,7 @@ bool AllocClassFI::analyze(LLCallBasePtr CB, const G2StackAnalysis &A) {
238238
->getType();
239239
return A.DL.getTypeAllocSize(Ty) < SizeLimit;
240240
}
241-
bool UntypedMemoryFI::analyze(LLCallBasePtr CB, const G2StackAnalysis &A) {
241+
bool UntypedMemoryFI::analyze(CallBase *CB, const G2StackAnalysis &A) {
242242
if (CB->arg_size() < SizeArgNr + 1) {
243243
return false;
244244
}
@@ -260,7 +260,7 @@ bool UntypedMemoryFI::analyze(LLCallBasePtr CB, const G2StackAnalysis &A) {
260260
Ty = llvm::Type::getInt8Ty(CB->getContext());
261261
return true;
262262
}
263-
Value* UntypedMemoryFI::promote(LLCallBasePtr CB, IRBuilder<> &B, const G2StackAnalysis &A) {
263+
Value* UntypedMemoryFI::promote(CallBase *CB, IRBuilder<> &B, const G2StackAnalysis &A) {
264264
// If the allocation is of constant size it's best to put it in the
265265
// entry block, so do so if we're not already there.
266266
// For dynamically-sized allocations it's best to avoid the overhead
@@ -341,7 +341,7 @@ GarbageCollect2Stack::GarbageCollect2Stack()
341341
NewArrayT(ReturnType::Array, 0, 1, true), AllocMemory(0) {
342342
}
343343

344-
static void RemoveCall(LLCallBasePtr CB, const G2StackAnalysis &A) {
344+
static void RemoveCall(CallBase *CB, const G2StackAnalysis &A) {
345345
// For an invoke instruction, we insert a branch to the normal target BB
346346
// immediately before it. Ideally, we would find a way to not invalidate
347347
// the dominator tree here.

gen/passes/GarbageCollect2Stack.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ class FunctionInfo {
2727

2828
// Analyze the current call, filling in some fields. Returns true if
2929
// this is an allocation we can stack-allocate.
30-
virtual bool analyze(LLCallBasePtr CB, const G2StackAnalysis &A) = 0;
30+
virtual bool analyze(llvm::CallBase *CB, const G2StackAnalysis &A) = 0;
3131

3232
// Returns the alloca to replace this call.
3333
// It will always be inserted before the call.
34-
virtual llvm::Value *promote(LLCallBasePtr CB, IRBuilder<> &B, const G2StackAnalysis &A);
34+
virtual llvm::Value *promote(llvm::CallBase *CB, IRBuilder<> &B, const G2StackAnalysis &A);
3535

3636
explicit FunctionInfo(ReturnType::Type returnType) : ReturnType(returnType) {}
3737
virtual ~FunctionInfo() = default;
@@ -43,7 +43,7 @@ class TypeInfoFI : public FunctionInfo {
4343
TypeInfoFI(ReturnType::Type returnType, unsigned tiArgNr)
4444
: FunctionInfo(returnType), TypeInfoArgNr(tiArgNr) {}
4545

46-
bool analyze(LLCallBasePtr CB, const G2StackAnalysis &A) override;
46+
bool analyze(llvm::CallBase *CB, const G2StackAnalysis &A) override;
4747
};
4848
class ArrayFI : public TypeInfoFI {
4949
int ArrSizeArgNr;
@@ -56,15 +56,15 @@ class ArrayFI : public TypeInfoFI {
5656
: TypeInfoFI(returnType, tiArgNr), ArrSizeArgNr(arrSizeArgNr),
5757
Initialized(initialized) {}
5858

59-
bool analyze(LLCallBasePtr CB, const G2StackAnalysis &A) override;
59+
bool analyze(llvm::CallBase *CB, const G2StackAnalysis &A) override;
6060

61-
llvm::Value *promote(LLCallBasePtr CB, IRBuilder<> &B, const G2StackAnalysis &A) override;
61+
llvm::Value *promote(llvm::CallBase *CB, IRBuilder<> &B, const G2StackAnalysis &A) override;
6262

6363
};
6464
// FunctionInfo for _d_allocclass
6565
class AllocClassFI : public FunctionInfo {
6666
public:
67-
bool analyze(LLCallBasePtr CB, const G2StackAnalysis &A) override;
67+
bool analyze(llvm::CallBase *CB, const G2StackAnalysis &A) override;
6868

6969
// The default promote() should be fine.
7070

@@ -77,9 +77,9 @@ class UntypedMemoryFI : public FunctionInfo {
7777
llvm::Value *SizeArg;
7878

7979
public:
80-
bool analyze(LLCallBasePtr CB, const G2StackAnalysis &A) override;
80+
bool analyze(llvm::CallBase *CB, const G2StackAnalysis &A) override;
8181

82-
llvm::Value *promote(LLCallBasePtr CB, IRBuilder<> &B, const G2StackAnalysis &A) override;
82+
llvm::Value *promote(llvm::CallBase *CB, IRBuilder<> &B, const G2StackAnalysis &A) override;
8383

8484
explicit UntypedMemoryFI(unsigned sizeArgNr)
8585
: FunctionInfo(ReturnType::Pointer), SizeArgNr(sizeArgNr) {}

gen/tocall.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -916,8 +916,8 @@ DValue *DtoCallFunction(const Loc &loc, Type *resulttype, DValue *fnval,
916916
}
917917

918918
// call the function
919-
LLCallBasePtr call = gIR->funcGen().callOrInvoke(callable, callableTy, args,
920-
"", tf->isnothrow());
919+
llvm::CallBase *call = gIR->funcGen().callOrInvoke(callable, callableTy, args,
920+
"", tf->isnothrow());
921921

922922
// PGO: Insert instrumentation or attach profile metadata at indirect call
923923
// sites.

0 commit comments

Comments
 (0)