Skip to content

Commit e1434a8

Browse files
authored
[SandboxIR] Switch more Instruction::create() functions to InsertPosition (#111075)
1 parent 83e3779 commit e1434a8

File tree

4 files changed

+77
-236
lines changed

4 files changed

+77
-236
lines changed

llvm/include/llvm/SandboxIR/Instruction.h

Lines changed: 24 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -502,10 +502,8 @@ class ExtractElementInst final
502502
// create*()
503503

504504
public:
505-
static Value *create(Value *Vec, Value *Idx, Instruction *InsertBefore,
506-
Context &Ctx, const Twine &Name = "");
507-
static Value *create(Value *Vec, Value *Idx, BasicBlock *InsertAtEnd,
508-
Context &Ctx, const Twine &Name = "");
505+
static Value *create(Value *Vec, Value *Idx, InsertPosition Pos, Context &Ctx,
506+
const Twine &Name = "");
509507
static bool classof(const Value *From) {
510508
return From->getSubclassID() == ClassID::ExtractElement;
511509
}
@@ -529,17 +527,10 @@ class ShuffleVectorInst final
529527
friend class Context; // For accessing the constructor in create*()
530528

531529
public:
532-
static Value *create(Value *V1, Value *V2, Value *Mask,
533-
Instruction *InsertBefore, Context &Ctx,
534-
const Twine &Name = "");
535-
static Value *create(Value *V1, Value *V2, Value *Mask,
536-
BasicBlock *InsertAtEnd, Context &Ctx,
537-
const Twine &Name = "");
538-
static Value *create(Value *V1, Value *V2, ArrayRef<int> Mask,
539-
Instruction *InsertBefore, Context &Ctx,
540-
const Twine &Name = "");
530+
static Value *create(Value *V1, Value *V2, Value *Mask, InsertPosition Pos,
531+
Context &Ctx, const Twine &Name = "");
541532
static Value *create(Value *V1, Value *V2, ArrayRef<int> Mask,
542-
BasicBlock *InsertAtEnd, Context &Ctx,
533+
InsertPosition Pos, Context &Ctx,
543534
const Twine &Name = "");
544535
static bool classof(const Value *From) {
545536
return From->getSubclassID() == ClassID::ShuffleVector;
@@ -974,7 +965,7 @@ class InsertValueInst
974965

975966
public:
976967
static Value *create(Value *Agg, Value *Val, ArrayRef<unsigned> Idxs,
977-
BBIterator WhereIt, BasicBlock *WhereBB, Context &Ctx,
968+
InsertPosition Pos, Context &Ctx,
978969
const Twine &Name = "");
979970

980971
static bool classof(const Value *From) {
@@ -1032,15 +1023,10 @@ class BranchInst : public SingleLLVMInstructionImpl<llvm::BranchInst> {
10321023
friend Context; // for BranchInst()
10331024

10341025
public:
1035-
static BranchInst *create(BasicBlock *IfTrue, Instruction *InsertBefore,
1036-
Context &Ctx);
1037-
static BranchInst *create(BasicBlock *IfTrue, BasicBlock *InsertAtEnd,
1038-
Context &Ctx);
1039-
static BranchInst *create(BasicBlock *IfTrue, BasicBlock *IfFalse,
1040-
Value *Cond, Instruction *InsertBefore,
1026+
static BranchInst *create(BasicBlock *IfTrue, InsertPosition Pos,
10411027
Context &Ctx);
10421028
static BranchInst *create(BasicBlock *IfTrue, BasicBlock *IfFalse,
1043-
Value *Cond, BasicBlock *InsertAtEnd, Context &Ctx);
1029+
Value *Cond, InsertPosition Pos, Context &Ctx);
10441030
/// For isa/dyn_cast.
10451031
static bool classof(const Value *From);
10461032
bool isUnconditional() const {
@@ -1122,9 +1108,8 @@ class ExtractValueInst : public UnaryInstruction {
11221108
friend Context; // for ExtractValueInst()
11231109

11241110
public:
1125-
static Value *create(Value *Agg, ArrayRef<unsigned> Idxs, BBIterator WhereIt,
1126-
BasicBlock *WhereBB, Context &Ctx,
1127-
const Twine &Name = "");
1111+
static Value *create(Value *Agg, ArrayRef<unsigned> Idxs, InsertPosition Pos,
1112+
Context &Ctx, const Twine &Name = "");
11281113

11291114
static bool classof(const Value *From) {
11301115
return From->getSubclassID() == ClassID::ExtractValue;
@@ -1177,9 +1162,8 @@ class VAArgInst : public UnaryInstruction {
11771162
friend Context; // For constructor;
11781163

11791164
public:
1180-
static VAArgInst *create(Value *List, Type *Ty, BBIterator WhereIt,
1181-
BasicBlock *WhereBB, Context &Ctx,
1182-
const Twine &Name = "");
1165+
static VAArgInst *create(Value *List, Type *Ty, InsertPosition Pos,
1166+
Context &Ctx, const Twine &Name = "");
11831167
Value *getPointerOperand();
11841168
const Value *getPointerOperand() const {
11851169
return const_cast<VAArgInst *>(this)->getPointerOperand();
@@ -1198,8 +1182,8 @@ class FreezeInst : public UnaryInstruction {
11981182
friend Context; // For constructor;
11991183

12001184
public:
1201-
static FreezeInst *create(Value *V, BBIterator WhereIt, BasicBlock *WhereBB,
1202-
Context &Ctx, const Twine &Name = "");
1185+
static FreezeInst *create(Value *V, InsertPosition Pos, Context &Ctx,
1186+
const Twine &Name = "");
12031187
static bool classof(const Value *From) {
12041188
return From->getSubclassID() == ClassID::Freeze;
12051189
}
@@ -1218,17 +1202,13 @@ class LoadInst final : public UnaryInstruction {
12181202
void setVolatile(bool V);
12191203

12201204
static LoadInst *create(Type *Ty, Value *Ptr, MaybeAlign Align,
1221-
Instruction *InsertBefore, Context &Ctx,
1205+
InsertPosition Pos, bool IsVolatile, Context &Ctx,
12221206
const Twine &Name = "");
12231207
static LoadInst *create(Type *Ty, Value *Ptr, MaybeAlign Align,
1224-
Instruction *InsertBefore, bool IsVolatile,
1225-
Context &Ctx, const Twine &Name = "");
1226-
static LoadInst *create(Type *Ty, Value *Ptr, MaybeAlign Align,
1227-
BasicBlock *InsertAtEnd, Context &Ctx,
1228-
const Twine &Name = "");
1229-
static LoadInst *create(Type *Ty, Value *Ptr, MaybeAlign Align,
1230-
BasicBlock *InsertAtEnd, bool IsVolatile,
1231-
Context &Ctx, const Twine &Name = "");
1208+
InsertPosition Pos, Context &Ctx,
1209+
const Twine &Name = "") {
1210+
return create(Ty, Ptr, Align, Pos, /*IsVolatile=*/false, Ctx, Name);
1211+
}
12321212

12331213
/// For isa/dyn_cast.
12341214
static bool classof(const Value *From);
@@ -1251,15 +1231,12 @@ class StoreInst final : public SingleLLVMInstructionImpl<llvm::StoreInst> {
12511231
void setVolatile(bool V);
12521232

12531233
static StoreInst *create(Value *V, Value *Ptr, MaybeAlign Align,
1254-
Instruction *InsertBefore, Context &Ctx);
1255-
static StoreInst *create(Value *V, Value *Ptr, MaybeAlign Align,
1256-
Instruction *InsertBefore, bool IsVolatile,
1257-
Context &Ctx);
1234+
InsertPosition Pos, bool IsVolatile, Context &Ctx);
12581235
static StoreInst *create(Value *V, Value *Ptr, MaybeAlign Align,
1259-
BasicBlock *InsertAtEnd, Context &Ctx);
1260-
static StoreInst *create(Value *V, Value *Ptr, MaybeAlign Align,
1261-
BasicBlock *InsertAtEnd, bool IsVolatile,
1262-
Context &Ctx);
1236+
InsertPosition Pos, Context &Ctx) {
1237+
return create(V, Ptr, Align, Pos, /*IsVolatile=*/false, Ctx);
1238+
}
1239+
12631240
/// For isa/dyn_cast.
12641241
static bool classof(const Value *From);
12651242
Value *getValueOperand() const;

0 commit comments

Comments
 (0)