Commit 8cfeb69e by Jim Stichnoth

Subzero: Cleanup Inst==>Instr.

In the beginning, Ice::Inst was called IceInst, and patterns like "IceInst *Inst = ..." made perfect sense. After the Ice:: name change, "Inst *Inst = ..." continued to compile, mostly. However, shadowing a type name is clumsy and newer code tends to use "Inst *Instr", so we might as well switch all the instances over. Some are still called "I" and those are left alone. BUG= none R=kschimpf@google.com Review URL: https://codereview.chromium.org/1665423002 .
parent 282d7afd
...@@ -898,13 +898,13 @@ bool Cfg::validateLiveness() const { ...@@ -898,13 +898,13 @@ bool Cfg::validateLiveness() const {
Ostream &Str = Ctx->getStrDump(); Ostream &Str = Ctx->getStrDump();
for (CfgNode *Node : Nodes) { for (CfgNode *Node : Nodes) {
Inst *FirstInst = nullptr; Inst *FirstInst = nullptr;
for (Inst &Inst : Node->getInsts()) { for (Inst &Instr : Node->getInsts()) {
if (Inst.isDeleted()) if (Instr.isDeleted())
continue; continue;
if (FirstInst == nullptr) if (FirstInst == nullptr)
FirstInst = &Inst; FirstInst = &Instr;
InstNumberT InstNumber = Inst.getNumber(); InstNumberT InstNumber = Instr.getNumber();
if (Variable *Dest = Inst.getDest()) { if (Variable *Dest = Instr.getDest()) {
if (!Dest->getIgnoreLiveness()) { if (!Dest->getIgnoreLiveness()) {
bool Invalid = false; bool Invalid = false;
constexpr bool IsDest = true; constexpr bool IsDest = true;
...@@ -916,24 +916,24 @@ bool Cfg::validateLiveness() const { ...@@ -916,24 +916,24 @@ bool Cfg::validateLiveness() const {
// of the block, because a Phi temporary may be live at the end of // of the block, because a Phi temporary may be live at the end of
// the previous block, and if it is also assigned in the first // the previous block, and if it is also assigned in the first
// instruction of this block, the adjacent live ranges get merged. // instruction of this block, the adjacent live ranges get merged.
if (static_cast<class Inst *>(&Inst) != FirstInst && if (static_cast<class Inst *>(&Instr) != FirstInst &&
!Inst.isDestRedefined() && !Instr.isDestRedefined() &&
Dest->getLiveRange().containsValue(InstNumber - 1, IsDest)) Dest->getLiveRange().containsValue(InstNumber - 1, IsDest))
Invalid = true; Invalid = true;
if (Invalid) { if (Invalid) {
Valid = false; Valid = false;
Str << "Liveness error: inst " << Inst.getNumber() << " dest "; Str << "Liveness error: inst " << Instr.getNumber() << " dest ";
Dest->dump(this); Dest->dump(this);
Str << " live range " << Dest->getLiveRange() << "\n"; Str << " live range " << Dest->getLiveRange() << "\n";
} }
} }
} }
FOREACH_VAR_IN_INST(Var, Inst) { FOREACH_VAR_IN_INST(Var, Instr) {
static constexpr bool IsDest = false; static constexpr bool IsDest = false;
if (!Var->getIgnoreLiveness() && if (!Var->getIgnoreLiveness() &&
!Var->getLiveRange().containsValue(InstNumber, IsDest)) { !Var->getLiveRange().containsValue(InstNumber, IsDest)) {
Valid = false; Valid = false;
Str << "Liveness error: inst " << Inst.getNumber() << " var "; Str << "Liveness error: inst " << Instr.getNumber() << " var ";
Var->dump(this); Var->dump(this);
Str << " live range " << Var->getLiveRange() << "\n"; Str << " live range " << Var->getLiveRange() << "\n";
} }
......
...@@ -39,16 +39,16 @@ IceString CfgNode::getName() const { ...@@ -39,16 +39,16 @@ IceString CfgNode::getName() const {
// Adds an instruction to either the Phi list or the regular instruction list. // Adds an instruction to either the Phi list or the regular instruction list.
// Validates that all Phis are added before all regular instructions. // Validates that all Phis are added before all regular instructions.
void CfgNode::appendInst(Inst *Inst) { void CfgNode::appendInst(Inst *Instr) {
++InstCountEstimate; ++InstCountEstimate;
if (auto *Phi = llvm::dyn_cast<InstPhi>(Inst)) { if (auto *Phi = llvm::dyn_cast<InstPhi>(Instr)) {
if (!Insts.empty()) { if (!Insts.empty()) {
Func->setError("Phi instruction added to the middle of a block"); Func->setError("Phi instruction added to the middle of a block");
return; return;
} }
Phis.push_back(Phi); Phis.push_back(Phi);
} else { } else {
Insts.push_back(Inst); Insts.push_back(Instr);
} }
} }
...@@ -1429,13 +1429,13 @@ void CfgNode::profileExecutionCount(VariableDeclaration *Var) { ...@@ -1429,13 +1429,13 @@ void CfgNode::profileExecutionCount(VariableDeclaration *Var) {
Constant *OrderAcquireRelease = Constant *OrderAcquireRelease =
Context->getConstantInt32(Intrinsics::MemoryOrderAcquireRelease); Context->getConstantInt32(Intrinsics::MemoryOrderAcquireRelease);
auto *Inst = InstIntrinsicCall::create( auto *Instr = InstIntrinsicCall::create(
Func, 5, Func->makeVariable(IceType_i64), RMWI64Name, Info->Info); Func, 5, Func->makeVariable(IceType_i64), RMWI64Name, Info->Info);
Inst->addArg(AtomicRMWOp); Instr->addArg(AtomicRMWOp);
Inst->addArg(Counter); Instr->addArg(Counter);
Inst->addArg(One); Instr->addArg(One);
Inst->addArg(OrderAcquireRelease); Instr->addArg(OrderAcquireRelease);
Insts.push_front(Inst); Insts.push_front(Instr);
} }
} // end of namespace Ice } // end of namespace Ice
...@@ -72,7 +72,7 @@ public: ...@@ -72,7 +72,7 @@ public:
/// @{ /// @{
InstList &getInsts() { return Insts; } InstList &getInsts() { return Insts; }
PhiList &getPhis() { return Phis; } PhiList &getPhis() { return Phis; }
void appendInst(Inst *Inst); void appendInst(Inst *Instr);
void renumberInstructions(); void renumberInstructions();
/// Rough and generally conservative estimate of the number of instructions in /// Rough and generally conservative estimate of the number of instructions in
/// the block. It is updated when an instruction is added, but not when /// the block. It is updated when an instruction is added, but not when
......
...@@ -258,7 +258,7 @@ public: ...@@ -258,7 +258,7 @@ public:
bool getKnownFrameOffset() const { return KnownFrameOffset; } bool getKnownFrameOffset() const { return KnownFrameOffset; }
void setKnownFrameOffset() { KnownFrameOffset = true; } void setKnownFrameOffset() { KnownFrameOffset = true; }
void dump(const Cfg *Func) const override; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return Inst->getKind() == Alloca; } static bool classof(const Inst *Instr) { return Instr->getKind() == Alloca; }
private: private:
InstAlloca(Cfg *Func, Variable *Dest, Operand *ByteCount, InstAlloca(Cfg *Func, Variable *Dest, Operand *ByteCount,
...@@ -295,8 +295,8 @@ public: ...@@ -295,8 +295,8 @@ public:
static const char *getOpName(OpKind Op); static const char *getOpName(OpKind Op);
bool isCommutative() const; bool isCommutative() const;
void dump(const Cfg *Func) const override; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { static bool classof(const Inst *Instr) {
return Inst->getKind() == Arithmetic; return Instr->getKind() == Arithmetic;
} }
private: private:
...@@ -322,7 +322,7 @@ public: ...@@ -322,7 +322,7 @@ public:
} }
bool isVarAssign() const override; bool isVarAssign() const override;
void dump(const Cfg *Func) const override; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return Inst->getKind() == Assign; } static bool classof(const Inst *Instr) { return Instr->getKind() == Assign; }
private: private:
InstAssign(Cfg *Func, Variable *Dest, Operand *Source); InstAssign(Cfg *Func, Variable *Dest, Operand *Source);
...@@ -362,7 +362,7 @@ public: ...@@ -362,7 +362,7 @@ public:
bool isUnconditionalBranch() const override { return isUnconditional(); } bool isUnconditionalBranch() const override { return isUnconditional(); }
bool repointEdges(CfgNode *OldNode, CfgNode *NewNode) override; bool repointEdges(CfgNode *OldNode, CfgNode *NewNode) override;
void dump(const Cfg *Func) const override; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return Inst->getKind() == Br; } static bool classof(const Inst *Instr) { return Instr->getKind() == Br; }
private: private:
/// Conditional branch /// Conditional branch
...@@ -401,7 +401,7 @@ public: ...@@ -401,7 +401,7 @@ public:
bool isTailcall() const { return HasTailCall; } bool isTailcall() const { return HasTailCall; }
bool isTargetHelperCall() const { return IsTargetHelperCall; } bool isTargetHelperCall() const { return IsTargetHelperCall; }
void dump(const Cfg *Func) const override; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return Inst->getKind() == Call; } static bool classof(const Inst *Instr) { return Instr->getKind() == Call; }
Type getReturnType() const; Type getReturnType() const;
protected: protected:
...@@ -442,7 +442,7 @@ public: ...@@ -442,7 +442,7 @@ public:
} }
OpKind getCastKind() const { return CastKind; } OpKind getCastKind() const { return CastKind; }
void dump(const Cfg *Func) const override; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return Inst->getKind() == Cast; } static bool classof(const Inst *Instr) { return Instr->getKind() == Cast; }
private: private:
InstCast(Cfg *Func, OpKind CastKind, Variable *Dest, Operand *Source); InstCast(Cfg *Func, OpKind CastKind, Variable *Dest, Operand *Source);
...@@ -464,8 +464,8 @@ public: ...@@ -464,8 +464,8 @@ public:
} }
void dump(const Cfg *Func) const override; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { static bool classof(const Inst *Instr) {
return Inst->getKind() == ExtractElement; return Instr->getKind() == ExtractElement;
} }
private: private:
...@@ -495,7 +495,7 @@ public: ...@@ -495,7 +495,7 @@ public:
} }
FCond getCondition() const { return Condition; } FCond getCondition() const { return Condition; }
void dump(const Cfg *Func) const override; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return Inst->getKind() == Fcmp; } static bool classof(const Inst *Instr) { return Instr->getKind() == Fcmp; }
private: private:
InstFcmp(Cfg *Func, FCond Condition, Variable *Dest, Operand *Source1, InstFcmp(Cfg *Func, FCond Condition, Variable *Dest, Operand *Source1,
...@@ -526,7 +526,7 @@ public: ...@@ -526,7 +526,7 @@ public:
} }
ICond getCondition() const { return Condition; } ICond getCondition() const { return Condition; }
void dump(const Cfg *Func) const override; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return Inst->getKind() == Icmp; } static bool classof(const Inst *Instr) { return Instr->getKind() == Icmp; }
private: private:
InstIcmp(Cfg *Func, ICond Condition, Variable *Dest, Operand *Source1, InstIcmp(Cfg *Func, ICond Condition, Variable *Dest, Operand *Source1,
...@@ -549,8 +549,8 @@ public: ...@@ -549,8 +549,8 @@ public:
} }
void dump(const Cfg *Func) const override; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { static bool classof(const Inst *Instr) {
return Inst->getKind() == InsertElement; return Instr->getKind() == InsertElement;
} }
private: private:
...@@ -572,8 +572,8 @@ public: ...@@ -572,8 +572,8 @@ public:
return new (Func->allocate<InstIntrinsicCall>()) return new (Func->allocate<InstIntrinsicCall>())
InstIntrinsicCall(Func, NumArgs, Dest, CallTarget, Info); InstIntrinsicCall(Func, NumArgs, Dest, CallTarget, Info);
} }
static bool classof(const Inst *Inst) { static bool classof(const Inst *Instr) {
return Inst->getKind() == IntrinsicCall; return Instr->getKind() == IntrinsicCall;
} }
Intrinsics::IntrinsicInfo getIntrinsicInfo() const { return Info; } Intrinsics::IntrinsicInfo getIntrinsicInfo() const { return Info; }
...@@ -603,7 +603,7 @@ public: ...@@ -603,7 +603,7 @@ public:
} }
Operand *getSourceAddress() const { return getSrc(0); } Operand *getSourceAddress() const { return getSrc(0); }
void dump(const Cfg *Func) const override; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return Inst->getKind() == Load; } static bool classof(const Inst *Instr) { return Instr->getKind() == Load; }
private: private:
InstLoad(Cfg *Func, Variable *Dest, Operand *SourceAddr); InstLoad(Cfg *Func, Variable *Dest, Operand *SourceAddr);
...@@ -627,7 +627,7 @@ public: ...@@ -627,7 +627,7 @@ public:
Liveness *Liveness); Liveness *Liveness);
Inst *lower(Cfg *Func); Inst *lower(Cfg *Func);
void dump(const Cfg *Func) const override; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return Inst->getKind() == Phi; } static bool classof(const Inst *Instr) { return Instr->getKind() == Phi; }
private: private:
InstPhi(Cfg *Func, SizeT MaxSrcs, Variable *Dest); InstPhi(Cfg *Func, SizeT MaxSrcs, Variable *Dest);
...@@ -661,7 +661,7 @@ public: ...@@ -661,7 +661,7 @@ public:
} }
NodeList getTerminatorEdges() const override { return NodeList(); } NodeList getTerminatorEdges() const override { return NodeList(); }
void dump(const Cfg *Func) const override; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return Inst->getKind() == Ret; } static bool classof(const Inst *Instr) { return Instr->getKind() == Ret; }
private: private:
InstRet(Cfg *Func, Operand *RetValue); InstRet(Cfg *Func, Operand *RetValue);
...@@ -683,7 +683,7 @@ public: ...@@ -683,7 +683,7 @@ public:
Operand *getTrueOperand() const { return getSrc(1); } Operand *getTrueOperand() const { return getSrc(1); }
Operand *getFalseOperand() const { return getSrc(2); } Operand *getFalseOperand() const { return getSrc(2); }
void dump(const Cfg *Func) const override; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return Inst->getKind() == Select; } static bool classof(const Inst *Instr) { return Instr->getKind() == Select; }
private: private:
InstSelect(Cfg *Func, Variable *Dest, Operand *Condition, Operand *Source1, InstSelect(Cfg *Func, Variable *Dest, Operand *Condition, Operand *Source1,
...@@ -709,7 +709,7 @@ public: ...@@ -709,7 +709,7 @@ public:
Variable *getRmwBeacon() const; Variable *getRmwBeacon() const;
void setRmwBeacon(Variable *Beacon); void setRmwBeacon(Variable *Beacon);
void dump(const Cfg *Func) const override; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return Inst->getKind() == Store; } static bool classof(const Inst *Instr) { return Instr->getKind() == Store; }
private: private:
InstStore(Cfg *Func, Operand *Data, Operand *Addr); InstStore(Cfg *Func, Operand *Data, Operand *Addr);
...@@ -742,7 +742,7 @@ public: ...@@ -742,7 +742,7 @@ public:
NodeList getTerminatorEdges() const override; NodeList getTerminatorEdges() const override;
bool repointEdges(CfgNode *OldNode, CfgNode *NewNode) override; bool repointEdges(CfgNode *OldNode, CfgNode *NewNode) override;
void dump(const Cfg *Func) const override; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return Inst->getKind() == Switch; } static bool classof(const Inst *Instr) { return Instr->getKind() == Switch; }
private: private:
InstSwitch(Cfg *Func, SizeT NumCases, Operand *Source, CfgNode *LabelDefault); InstSwitch(Cfg *Func, SizeT NumCases, Operand *Source, CfgNode *LabelDefault);
...@@ -770,8 +770,8 @@ public: ...@@ -770,8 +770,8 @@ public:
} }
NodeList getTerminatorEdges() const override { return NodeList(); } NodeList getTerminatorEdges() const override { return NodeList(); }
void dump(const Cfg *Func) const override; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { static bool classof(const Inst *Instr) {
return Inst->getKind() == Unreachable; return Instr->getKind() == Unreachable;
} }
private: private:
...@@ -795,8 +795,8 @@ public: ...@@ -795,8 +795,8 @@ public:
void emitIAS(const Cfg * /* Func */) const override {} void emitIAS(const Cfg * /* Func */) const override {}
void dump(const Cfg *Func) const override; void dump(const Cfg *Func) const override;
Option getOption() const { return BundleOption; } Option getOption() const { return BundleOption; }
static bool classof(const Inst *Inst) { static bool classof(const Inst *Instr) {
return Inst->getKind() == BundleLock; return Instr->getKind() == BundleLock;
} }
private: private:
...@@ -817,8 +817,8 @@ public: ...@@ -817,8 +817,8 @@ public:
void emit(const Cfg *Func) const override; void emit(const Cfg *Func) const override;
void emitIAS(const Cfg * /* Func */) const override {} void emitIAS(const Cfg * /* Func */) const override {}
void dump(const Cfg *Func) const override; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { static bool classof(const Inst *Instr) {
return Inst->getKind() == BundleUnlock; return Instr->getKind() == BundleUnlock;
} }
private: private:
...@@ -849,7 +849,7 @@ public: ...@@ -849,7 +849,7 @@ public:
void emit(const Cfg *Func) const override; void emit(const Cfg *Func) const override;
void emitIAS(const Cfg * /* Func */) const override {} void emitIAS(const Cfg * /* Func */) const override {}
void dump(const Cfg *Func) const override; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return Inst->getKind() == FakeDef; } static bool classof(const Inst *Instr) { return Instr->getKind() == FakeDef; }
private: private:
InstFakeDef(Cfg *Func, Variable *Dest, Variable *Src); InstFakeDef(Cfg *Func, Variable *Dest, Variable *Src);
...@@ -874,7 +874,7 @@ public: ...@@ -874,7 +874,7 @@ public:
void emit(const Cfg *Func) const override; void emit(const Cfg *Func) const override;
void emitIAS(const Cfg * /* Func */) const override {} void emitIAS(const Cfg * /* Func */) const override {}
void dump(const Cfg *Func) const override; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return Inst->getKind() == FakeUse; } static bool classof(const Inst *Instr) { return Instr->getKind() == FakeUse; }
private: private:
InstFakeUse(Cfg *Func, Variable *Src, uint32_t Weight); InstFakeUse(Cfg *Func, Variable *Src, uint32_t Weight);
...@@ -902,7 +902,9 @@ public: ...@@ -902,7 +902,9 @@ public:
void emit(const Cfg *Func) const override; void emit(const Cfg *Func) const override;
void emitIAS(const Cfg * /* Func */) const override {} void emitIAS(const Cfg * /* Func */) const override {}
void dump(const Cfg *Func) const override; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return Inst->getKind() == FakeKill; } static bool classof(const Inst *Instr) {
return Instr->getKind() == FakeKill;
}
private: private:
InstFakeKill(Cfg *Func, const Inst *Linked); InstFakeKill(Cfg *Func, const Inst *Linked);
...@@ -936,7 +938,9 @@ public: ...@@ -936,7 +938,9 @@ public:
return Targets[I]; return Targets[I];
} }
void dump(const Cfg *Func) const override; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return Inst->getKind() == JumpTable; } static bool classof(const Inst *Instr) {
return Instr->getKind() == JumpTable;
}
static IceString makeName(const IceString &FuncName, SizeT Id) { static IceString makeName(const IceString &FuncName, SizeT Id) {
return ".L" + FuncName + "$jumptable$__" + std::to_string(Id); return ".L" + FuncName + "$jumptable$__" + std::to_string(Id);
...@@ -964,7 +968,7 @@ class InstTarget : public Inst { ...@@ -964,7 +968,7 @@ class InstTarget : public Inst {
public: public:
uint32_t getEmitInstCount() const override { return 1; } uint32_t getEmitInstCount() const override { return 1; }
void dump(const Cfg *Func) const override; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return Inst->getKind() >= Target; } static bool classof(const Inst *Instr) { return Instr->getKind() >= Target; }
protected: protected:
InstTarget(Cfg *Func, InstKind Kind, SizeT MaxSrcs, Variable *Dest) InstTarget(Cfg *Func, InstKind Kind, SizeT MaxSrcs, Variable *Dest)
......
...@@ -135,106 +135,107 @@ void InstARM32::emitUsingTextFixup(const Cfg *Func) const { ...@@ -135,106 +135,107 @@ void InstARM32::emitUsingTextFixup(const Cfg *Func) const {
void InstARM32::emitIAS(const Cfg *Func) const { emitUsingTextFixup(Func); } void InstARM32::emitIAS(const Cfg *Func) const { emitUsingTextFixup(Func); }
void InstARM32Pred::emitUnaryopGPR(const char *Opcode, void InstARM32Pred::emitUnaryopGPR(const char *Opcode,
const InstARM32Pred *Inst, const Cfg *Func, const InstARM32Pred *Instr, const Cfg *Func,
bool NeedsWidthSuffix) { bool NeedsWidthSuffix) {
Ostream &Str = Func->getContext()->getStrEmit(); Ostream &Str = Func->getContext()->getStrEmit();
assert(Inst->getSrcSize() == 1); assert(Instr->getSrcSize() == 1);
Type SrcTy = Inst->getSrc(0)->getType(); Type SrcTy = Instr->getSrc(0)->getType();
Str << "\t" << Opcode; Str << "\t" << Opcode;
if (NeedsWidthSuffix) if (NeedsWidthSuffix)
Str << getWidthString(SrcTy); Str << getWidthString(SrcTy);
Str << Inst->getPredicate() << "\t"; Str << Instr->getPredicate() << "\t";
Inst->getDest()->emit(Func); Instr->getDest()->emit(Func);
Str << ", "; Str << ", ";
Inst->getSrc(0)->emit(Func); Instr->getSrc(0)->emit(Func);
} }
void InstARM32Pred::emitUnaryopFP(const char *Opcode, const InstARM32Pred *Inst, void InstARM32Pred::emitUnaryopFP(const char *Opcode,
const Cfg *Func) { const InstARM32Pred *Instr, const Cfg *Func) {
Ostream &Str = Func->getContext()->getStrEmit(); Ostream &Str = Func->getContext()->getStrEmit();
assert(Inst->getSrcSize() == 1); assert(Instr->getSrcSize() == 1);
Type SrcTy = Inst->getSrc(0)->getType(); Type SrcTy = Instr->getSrc(0)->getType();
Str << "\t" << Opcode << Inst->getPredicate() << getVecWidthString(SrcTy) Str << "\t" << Opcode << Instr->getPredicate() << getVecWidthString(SrcTy)
<< "\t"; << "\t";
Inst->getDest()->emit(Func); Instr->getDest()->emit(Func);
Str << ", "; Str << ", ";
Inst->getSrc(0)->emit(Func); Instr->getSrc(0)->emit(Func);
} }
void InstARM32Pred::emitTwoAddr(const char *Opcode, const InstARM32Pred *Inst, void InstARM32Pred::emitTwoAddr(const char *Opcode, const InstARM32Pred *Instr,
const Cfg *Func) { const Cfg *Func) {
if (!BuildDefs::dump()) if (!BuildDefs::dump())
return; return;
Ostream &Str = Func->getContext()->getStrEmit(); Ostream &Str = Func->getContext()->getStrEmit();
assert(Inst->getSrcSize() == 2); assert(Instr->getSrcSize() == 2);
Variable *Dest = Inst->getDest(); Variable *Dest = Instr->getDest();
assert(Dest == Inst->getSrc(0)); assert(Dest == Instr->getSrc(0));
Str << "\t" << Opcode << Inst->getPredicate() << "\t"; Str << "\t" << Opcode << Instr->getPredicate() << "\t";
Dest->emit(Func); Dest->emit(Func);
Str << ", "; Str << ", ";
Inst->getSrc(1)->emit(Func); Instr->getSrc(1)->emit(Func);
} }
void InstARM32Pred::emitThreeAddr(const char *Opcode, const InstARM32Pred *Inst, void InstARM32Pred::emitThreeAddr(const char *Opcode,
const Cfg *Func, bool SetFlags) { const InstARM32Pred *Instr, const Cfg *Func,
bool SetFlags) {
if (!BuildDefs::dump()) if (!BuildDefs::dump())
return; return;
Ostream &Str = Func->getContext()->getStrEmit(); Ostream &Str = Func->getContext()->getStrEmit();
assert(Inst->getSrcSize() == 2); assert(Instr->getSrcSize() == 2);
Str << "\t" << Opcode << (SetFlags ? "s" : "") << Inst->getPredicate() Str << "\t" << Opcode << (SetFlags ? "s" : "") << Instr->getPredicate()
<< "\t"; << "\t";
Inst->getDest()->emit(Func); Instr->getDest()->emit(Func);
Str << ", "; Str << ", ";
Inst->getSrc(0)->emit(Func); Instr->getSrc(0)->emit(Func);
Str << ", "; Str << ", ";
Inst->getSrc(1)->emit(Func); Instr->getSrc(1)->emit(Func);
} }
void InstARM32::emitThreeAddrFP(const char *Opcode, const InstARM32 *Inst, void InstARM32::emitThreeAddrFP(const char *Opcode, const InstARM32 *Instr,
const Cfg *Func) { const Cfg *Func) {
if (!BuildDefs::dump()) if (!BuildDefs::dump())
return; return;
Ostream &Str = Func->getContext()->getStrEmit(); Ostream &Str = Func->getContext()->getStrEmit();
assert(Inst->getSrcSize() == 2); assert(Instr->getSrcSize() == 2);
Str << "\t" << Opcode << getVecWidthString(Inst->getDest()->getType()) Str << "\t" << Opcode << getVecWidthString(Instr->getDest()->getType())
<< "\t"; << "\t";
Inst->getDest()->emit(Func); Instr->getDest()->emit(Func);
Str << ", "; Str << ", ";
Inst->getSrc(0)->emit(Func); Instr->getSrc(0)->emit(Func);
Str << ", "; Str << ", ";
Inst->getSrc(1)->emit(Func); Instr->getSrc(1)->emit(Func);
} }
void InstARM32::emitFourAddrFP(const char *Opcode, const InstARM32 *Inst, void InstARM32::emitFourAddrFP(const char *Opcode, const InstARM32 *Instr,
const Cfg *Func) { const Cfg *Func) {
if (!BuildDefs::dump()) if (!BuildDefs::dump())
return; return;
Ostream &Str = Func->getContext()->getStrEmit(); Ostream &Str = Func->getContext()->getStrEmit();
assert(Inst->getSrcSize() == 3); assert(Instr->getSrcSize() == 3);
assert(Inst->getSrc(0) == Inst->getDest()); assert(Instr->getSrc(0) == Instr->getDest());
Str << "\t" << Opcode << getVecWidthString(Inst->getDest()->getType()) Str << "\t" << Opcode << getVecWidthString(Instr->getDest()->getType())
<< "\t"; << "\t";
Inst->getDest()->emit(Func); Instr->getDest()->emit(Func);
Str << ", "; Str << ", ";
Inst->getSrc(1)->emit(Func); Instr->getSrc(1)->emit(Func);
Str << ", "; Str << ", ";
Inst->getSrc(2)->emit(Func); Instr->getSrc(2)->emit(Func);
} }
void InstARM32Pred::emitFourAddr(const char *Opcode, const InstARM32Pred *Inst, void InstARM32Pred::emitFourAddr(const char *Opcode, const InstARM32Pred *Instr,
const Cfg *Func) { const Cfg *Func) {
if (!BuildDefs::dump()) if (!BuildDefs::dump())
return; return;
Ostream &Str = Func->getContext()->getStrEmit(); Ostream &Str = Func->getContext()->getStrEmit();
assert(Inst->getSrcSize() == 3); assert(Instr->getSrcSize() == 3);
Str << "\t" << Opcode << Inst->getPredicate() << "\t"; Str << "\t" << Opcode << Instr->getPredicate() << "\t";
Inst->getDest()->emit(Func); Instr->getDest()->emit(Func);
Str << ", "; Str << ", ";
Inst->getSrc(0)->emit(Func); Instr->getSrc(0)->emit(Func);
Str << ", "; Str << ", ";
Inst->getSrc(1)->emit(Func); Instr->getSrc(1)->emit(Func);
Str << ", "; Str << ", ";
Inst->getSrc(2)->emit(Func); Instr->getSrc(2)->emit(Func);
} }
template <InstARM32::InstKindARM32 K> template <InstARM32::InstKindARM32 K>
...@@ -268,16 +269,16 @@ template <> void InstARM32Mls::emitIAS(const Cfg *Func) const { ...@@ -268,16 +269,16 @@ template <> void InstARM32Mls::emitIAS(const Cfg *Func) const {
emitUsingTextFixup(Func); emitUsingTextFixup(Func);
} }
void InstARM32Pred::emitCmpLike(const char *Opcode, const InstARM32Pred *Inst, void InstARM32Pred::emitCmpLike(const char *Opcode, const InstARM32Pred *Instr,
const Cfg *Func) { const Cfg *Func) {
if (!BuildDefs::dump()) if (!BuildDefs::dump())
return; return;
Ostream &Str = Func->getContext()->getStrEmit(); Ostream &Str = Func->getContext()->getStrEmit();
assert(Inst->getSrcSize() == 2); assert(Instr->getSrcSize() == 2);
Str << "\t" << Opcode << Inst->getPredicate() << "\t"; Str << "\t" << Opcode << Instr->getPredicate() << "\t";
Inst->getSrc(0)->emit(Func); Instr->getSrc(0)->emit(Func);
Str << ", "; Str << ", ";
Inst->getSrc(1)->emit(Func); Instr->getSrc(1)->emit(Func);
} }
OperandARM32Mem::OperandARM32Mem(Cfg * /* Func */, Type Ty, Variable *Base, OperandARM32Mem::OperandARM32Mem(Cfg * /* Func */, Type Ty, Variable *Base,
......
...@@ -1034,28 +1034,28 @@ void InstImpl<TraitsType>::InstX86Idiv::emitIAS(const Cfg *Func) const { ...@@ -1034,28 +1034,28 @@ void InstImpl<TraitsType>::InstX86Idiv::emitIAS(const Cfg *Func) const {
// pblendvb and blendvps take xmm0 as a final implicit argument. // pblendvb and blendvps take xmm0 as a final implicit argument.
template <typename TraitsType> template <typename TraitsType>
void InstImpl<TraitsType>::emitVariableBlendInst(const char *Opcode, void InstImpl<TraitsType>::emitVariableBlendInst(const char *Opcode,
const Inst *Inst, const Inst *Instr,
const Cfg *Func) { const Cfg *Func) {
if (!BuildDefs::dump()) if (!BuildDefs::dump())
return; return;
Ostream &Str = Func->getContext()->getStrEmit(); Ostream &Str = Func->getContext()->getStrEmit();
assert(Inst->getSrcSize() == 3); assert(Instr->getSrcSize() == 3);
assert(llvm::cast<Variable>(Inst->getSrc(2))->getRegNum() == assert(llvm::cast<Variable>(Instr->getSrc(2))->getRegNum() ==
RegisterSet::Reg_xmm0); RegisterSet::Reg_xmm0);
Str << "\t" << Opcode << "\t"; Str << "\t" << Opcode << "\t";
Inst->getSrc(1)->emit(Func); Instr->getSrc(1)->emit(Func);
Str << ", "; Str << ", ";
Inst->getDest()->emit(Func); Instr->getDest()->emit(Func);
} }
template <typename TraitsType> template <typename TraitsType>
void InstImpl<TraitsType>::emitIASVariableBlendInst( void InstImpl<TraitsType>::emitIASVariableBlendInst(
const Inst *Inst, const Cfg *Func, const XmmEmitterRegOp &Emitter) { const Inst *Instr, const Cfg *Func, const XmmEmitterRegOp &Emitter) {
assert(Inst->getSrcSize() == 3); assert(Instr->getSrcSize() == 3);
assert(llvm::cast<Variable>(Inst->getSrc(2))->getRegNum() == assert(llvm::cast<Variable>(Instr->getSrc(2))->getRegNum() ==
RegisterSet::Reg_xmm0); RegisterSet::Reg_xmm0);
const Variable *Dest = Inst->getDest(); const Variable *Dest = Instr->getDest();
const Operand *Src = Inst->getSrc(1); const Operand *Src = Instr->getSrc(1);
emitIASRegOpTyXMM(Func, Dest->getType(), Dest, Src, Emitter); emitIASRegOpTyXMM(Func, Dest->getType(), Dest, Src, Emitter);
} }
......
...@@ -214,26 +214,26 @@ void LinearScan::initForInfOnly() { ...@@ -214,26 +214,26 @@ void LinearScan::initForInfOnly() {
CfgVector<InstNumberT> LREnd(Vars.size(), Inst::NumberSentinel); CfgVector<InstNumberT> LREnd(Vars.size(), Inst::NumberSentinel);
DefUseErrorList DefsWithoutUses, UsesBeforeDefs; DefUseErrorList DefsWithoutUses, UsesBeforeDefs;
for (CfgNode *Node : Func->getNodes()) { for (CfgNode *Node : Func->getNodes()) {
for (Inst &Inst : Node->getInsts()) { for (Inst &Instr : Node->getInsts()) {
if (Inst.isDeleted()) if (Instr.isDeleted())
continue; continue;
FOREACH_VAR_IN_INST(Var, Inst) { FOREACH_VAR_IN_INST(Var, Instr) {
if (Var->isRematerializable()) if (Var->isRematerializable())
continue; continue;
if (Var->getIgnoreLiveness()) if (Var->getIgnoreLiveness())
continue; continue;
if (Var->hasReg() || Var->mustHaveReg()) { if (Var->hasReg() || Var->mustHaveReg()) {
SizeT VarNum = Var->getIndex(); SizeT VarNum = Var->getIndex();
LREnd[VarNum] = Inst.getNumber(); LREnd[VarNum] = Instr.getNumber();
if (!Var->getIsArg() && LRBegin[VarNum] == Inst::NumberSentinel) if (!Var->getIsArg() && LRBegin[VarNum] == Inst::NumberSentinel)
UsesBeforeDefs.push_back(VarNum); UsesBeforeDefs.push_back(VarNum);
} }
} }
if (const Variable *Var = Inst.getDest()) { if (const Variable *Var = Instr.getDest()) {
if (!Var->isRematerializable() && !Var->getIgnoreLiveness() && if (!Var->isRematerializable() && !Var->getIgnoreLiveness() &&
(Var->hasReg() || Var->mustHaveReg())) { (Var->hasReg() || Var->mustHaveReg())) {
if (LRBegin[Var->getIndex()] == Inst::NumberSentinel) { if (LRBegin[Var->getIndex()] == Inst::NumberSentinel) {
LRBegin[Var->getIndex()] = Inst.getNumber(); LRBegin[Var->getIndex()] = Instr.getNumber();
++NumVars; ++NumVars;
} }
} }
......
...@@ -22,14 +22,14 @@ ...@@ -22,14 +22,14 @@
namespace Ice { namespace Ice {
CaseClusterArray CaseCluster::clusterizeSwitch(Cfg *Func, CaseClusterArray CaseCluster::clusterizeSwitch(Cfg *Func,
const InstSwitch *Inst) { const InstSwitch *Instr) {
CaseClusterArray CaseClusters; CaseClusterArray CaseClusters;
// Load the cases // Load the cases
SizeT NumCases = Inst->getNumCases(); SizeT NumCases = Instr->getNumCases();
CaseClusters.reserve(NumCases); CaseClusters.reserve(NumCases);
for (SizeT I = 0; I < NumCases; ++I) for (SizeT I = 0; I < NumCases; ++I)
CaseClusters.emplace_back(Inst->getValue(I), Inst->getLabel(I)); CaseClusters.emplace_back(Instr->getValue(I), Instr->getLabel(I));
// Sort the cases // Sort the cases
std::sort(CaseClusters.begin(), CaseClusters.end(), std::sort(CaseClusters.begin(), CaseClusters.end(),
...@@ -75,7 +75,7 @@ CaseClusterArray CaseCluster::clusterizeSwitch(Cfg *Func, ...@@ -75,7 +75,7 @@ CaseClusterArray CaseCluster::clusterizeSwitch(Cfg *Func,
// Replace everything with a jump table // Replace everything with a jump table
InstJumpTable *JumpTable = InstJumpTable *JumpTable =
InstJumpTable::create(Func, TotalRange, Inst->getLabelDefault()); InstJumpTable::create(Func, TotalRange, Instr->getLabelDefault());
for (const CaseCluster &Case : CaseClusters) { for (const CaseCluster &Case : CaseClusters) {
// Case.High could be UINT64_MAX which makes the loop awkward. Unwrap the // Case.High could be UINT64_MAX which makes the loop awkward. Unwrap the
// last iteration to avoid wrap around problems. // last iteration to avoid wrap around problems.
......
...@@ -60,7 +60,7 @@ public: ...@@ -60,7 +60,7 @@ public:
/// Discover cases which can be clustered together and return the clusters /// Discover cases which can be clustered together and return the clusters
/// ordered by case value. /// ordered by case value.
static CaseClusterArray clusterizeSwitch(Cfg *Func, const InstSwitch *Inst); static CaseClusterArray clusterizeSwitch(Cfg *Func, const InstSwitch *Instr);
private: private:
CaseClusterKind Kind; CaseClusterKind Kind;
......
...@@ -70,9 +70,9 @@ void LoweringContext::rewind() { ...@@ -70,9 +70,9 @@ void LoweringContext::rewind() {
availabilityReset(); availabilityReset();
} }
void LoweringContext::insert(Inst *Inst) { void LoweringContext::insert(Inst *Instr) {
getNode()->getInsts().insert(Next, Inst); getNode()->getInsts().insert(Next, Instr);
LastInserted = Inst; LastInserted = Instr;
} }
void LoweringContext::skipDeleted(InstList::iterator &I) const { void LoweringContext::skipDeleted(InstList::iterator &I) const {
...@@ -350,76 +350,76 @@ void TargetLowering::doNopInsertion(RandomNumberGenerator &RNG) { ...@@ -350,76 +350,76 @@ void TargetLowering::doNopInsertion(RandomNumberGenerator &RNG) {
// should delete any additional instructions it consumes. // should delete any additional instructions it consumes.
void TargetLowering::lower() { void TargetLowering::lower() {
assert(!Context.atEnd()); assert(!Context.atEnd());
Inst *Inst = Context.getCur(); Inst *Instr = Context.getCur();
Inst->deleteIfDead(); Instr->deleteIfDead();
if (!Inst->isDeleted() && !llvm::isa<InstFakeDef>(Inst) && if (!Instr->isDeleted() && !llvm::isa<InstFakeDef>(Instr) &&
!llvm::isa<InstFakeUse>(Inst)) { !llvm::isa<InstFakeUse>(Instr)) {
// Mark the current instruction as deleted before lowering, otherwise the // Mark the current instruction as deleted before lowering, otherwise the
// Dest variable will likely get marked as non-SSA. See // Dest variable will likely get marked as non-SSA. See
// Variable::setDefinition(). However, just pass-through FakeDef and // Variable::setDefinition(). However, just pass-through FakeDef and
// FakeUse instructions that might have been inserted prior to lowering. // FakeUse instructions that might have been inserted prior to lowering.
Inst->setDeleted(); Instr->setDeleted();
switch (Inst->getKind()) { switch (Instr->getKind()) {
case Inst::Alloca: case Inst::Alloca:
lowerAlloca(llvm::cast<InstAlloca>(Inst)); lowerAlloca(llvm::cast<InstAlloca>(Instr));
break; break;
case Inst::Arithmetic: case Inst::Arithmetic:
lowerArithmetic(llvm::cast<InstArithmetic>(Inst)); lowerArithmetic(llvm::cast<InstArithmetic>(Instr));
break; break;
case Inst::Assign: case Inst::Assign:
lowerAssign(llvm::cast<InstAssign>(Inst)); lowerAssign(llvm::cast<InstAssign>(Instr));
break; break;
case Inst::Br: case Inst::Br:
lowerBr(llvm::cast<InstBr>(Inst)); lowerBr(llvm::cast<InstBr>(Instr));
break; break;
case Inst::Call: case Inst::Call:
lowerCall(llvm::cast<InstCall>(Inst)); lowerCall(llvm::cast<InstCall>(Instr));
break; break;
case Inst::Cast: case Inst::Cast:
lowerCast(llvm::cast<InstCast>(Inst)); lowerCast(llvm::cast<InstCast>(Instr));
break; break;
case Inst::ExtractElement: case Inst::ExtractElement:
lowerExtractElement(llvm::cast<InstExtractElement>(Inst)); lowerExtractElement(llvm::cast<InstExtractElement>(Instr));
break; break;
case Inst::Fcmp: case Inst::Fcmp:
lowerFcmp(llvm::cast<InstFcmp>(Inst)); lowerFcmp(llvm::cast<InstFcmp>(Instr));
break; break;
case Inst::Icmp: case Inst::Icmp:
lowerIcmp(llvm::cast<InstIcmp>(Inst)); lowerIcmp(llvm::cast<InstIcmp>(Instr));
break; break;
case Inst::InsertElement: case Inst::InsertElement:
lowerInsertElement(llvm::cast<InstInsertElement>(Inst)); lowerInsertElement(llvm::cast<InstInsertElement>(Instr));
break; break;
case Inst::IntrinsicCall: { case Inst::IntrinsicCall: {
auto *Call = llvm::cast<InstIntrinsicCall>(Inst); auto *Call = llvm::cast<InstIntrinsicCall>(Instr);
if (Call->getIntrinsicInfo().ReturnsTwice) if (Call->getIntrinsicInfo().ReturnsTwice)
setCallsReturnsTwice(true); setCallsReturnsTwice(true);
lowerIntrinsicCall(Call); lowerIntrinsicCall(Call);
break; break;
} }
case Inst::Load: case Inst::Load:
lowerLoad(llvm::cast<InstLoad>(Inst)); lowerLoad(llvm::cast<InstLoad>(Instr));
break; break;
case Inst::Phi: case Inst::Phi:
lowerPhi(llvm::cast<InstPhi>(Inst)); lowerPhi(llvm::cast<InstPhi>(Instr));
break; break;
case Inst::Ret: case Inst::Ret:
lowerRet(llvm::cast<InstRet>(Inst)); lowerRet(llvm::cast<InstRet>(Instr));
break; break;
case Inst::Select: case Inst::Select:
lowerSelect(llvm::cast<InstSelect>(Inst)); lowerSelect(llvm::cast<InstSelect>(Instr));
break; break;
case Inst::Store: case Inst::Store:
lowerStore(llvm::cast<InstStore>(Inst)); lowerStore(llvm::cast<InstStore>(Instr));
break; break;
case Inst::Switch: case Inst::Switch:
lowerSwitch(llvm::cast<InstSwitch>(Inst)); lowerSwitch(llvm::cast<InstSwitch>(Instr));
break; break;
case Inst::Unreachable: case Inst::Unreachable:
lowerUnreachable(llvm::cast<InstUnreachable>(Inst)); lowerUnreachable(llvm::cast<InstUnreachable>(Instr));
break; break;
default: default:
lowerOther(Inst); lowerOther(Instr);
break; break;
} }
...@@ -482,15 +482,16 @@ void TargetLowering::markRedefinitions() { ...@@ -482,15 +482,16 @@ void TargetLowering::markRedefinitions() {
// Find (non-SSA) instructions where the Dest variable appears in some source // Find (non-SSA) instructions where the Dest variable appears in some source
// operand, and set the IsDestRedefined flag to keep liveness analysis // operand, and set the IsDestRedefined flag to keep liveness analysis
// consistent. // consistent.
for (auto Inst = Context.getCur(), E = Context.getNext(); Inst != E; ++Inst) { for (auto Instr = Context.getCur(), E = Context.getNext(); Instr != E;
if (Inst->isDeleted()) ++Instr) {
if (Instr->isDeleted())
continue; continue;
Variable *Dest = Inst->getDest(); Variable *Dest = Instr->getDest();
if (Dest == nullptr) if (Dest == nullptr)
continue; continue;
FOREACH_VAR_IN_INST(Var, *Inst) { FOREACH_VAR_IN_INST(Var, *Instr) {
if (Var == Dest) { if (Var == Dest) {
Inst->setDestRedefined(); Instr->setDestRedefined();
break; break;
} }
} }
...@@ -537,12 +538,12 @@ void TargetLowering::getVarStackSlotParams( ...@@ -537,12 +538,12 @@ void TargetLowering::getVarStackSlotParams(
const VariablesMetadata *VMetadata = Func->getVMetadata(); const VariablesMetadata *VMetadata = Func->getVMetadata();
llvm::BitVector IsVarReferenced(Func->getNumVariables()); llvm::BitVector IsVarReferenced(Func->getNumVariables());
for (CfgNode *Node : Func->getNodes()) { for (CfgNode *Node : Func->getNodes()) {
for (Inst &Inst : Node->getInsts()) { for (Inst &Instr : Node->getInsts()) {
if (Inst.isDeleted()) if (Instr.isDeleted())
continue; continue;
if (const Variable *Var = Inst.getDest()) if (const Variable *Var = Instr.getDest())
IsVarReferenced[Var->getIndex()] = true; IsVarReferenced[Var->getIndex()] = true;
FOREACH_VAR_IN_INST(Var, Inst) { FOREACH_VAR_IN_INST(Var, Instr) {
IsVarReferenced[Var->getIndex()] = true; IsVarReferenced[Var->getIndex()] = true;
} }
} }
......
...@@ -90,7 +90,7 @@ public: ...@@ -90,7 +90,7 @@ public:
InstList::iterator getCur() const { return Cur; } InstList::iterator getCur() const { return Cur; }
InstList::iterator getNext() const { return Next; } InstList::iterator getNext() const { return Next; }
InstList::iterator getEnd() const { return End; } InstList::iterator getEnd() const { return End; }
void insert(Inst *Inst); void insert(Inst *Instr);
template <typename Inst, typename... Args> Inst *insert(Args &&... A) { template <typename Inst, typename... Args> Inst *insert(Args &&... A) {
auto *New = Inst::create(Node->getCfg(), std::forward<Args>(A)...); auto *New = Inst::create(Node->getCfg(), std::forward<Args>(A)...);
insert(New); insert(New);
...@@ -365,24 +365,24 @@ protected: ...@@ -365,24 +365,24 @@ protected:
size_t TypeToRegisterSetSize, size_t TypeToRegisterSetSize,
std::function<IceString(int32_t)> getRegName, std::function<IceString(int32_t)> getRegName,
std::function<IceString(RegClass)> getRegClassName); std::function<IceString(RegClass)> getRegClassName);
virtual void lowerAlloca(const InstAlloca *Inst) = 0; virtual void lowerAlloca(const InstAlloca *Instr) = 0;
virtual void lowerArithmetic(const InstArithmetic *Inst) = 0; virtual void lowerArithmetic(const InstArithmetic *Instr) = 0;
virtual void lowerAssign(const InstAssign *Inst) = 0; virtual void lowerAssign(const InstAssign *Instr) = 0;
virtual void lowerBr(const InstBr *Inst) = 0; virtual void lowerBr(const InstBr *Instr) = 0;
virtual void lowerCall(const InstCall *Inst) = 0; virtual void lowerCall(const InstCall *Instr) = 0;
virtual void lowerCast(const InstCast *Inst) = 0; virtual void lowerCast(const InstCast *Instr) = 0;
virtual void lowerFcmp(const InstFcmp *Inst) = 0; virtual void lowerFcmp(const InstFcmp *Instr) = 0;
virtual void lowerExtractElement(const InstExtractElement *Inst) = 0; virtual void lowerExtractElement(const InstExtractElement *Instr) = 0;
virtual void lowerIcmp(const InstIcmp *Inst) = 0; virtual void lowerIcmp(const InstIcmp *Instr) = 0;
virtual void lowerInsertElement(const InstInsertElement *Inst) = 0; virtual void lowerInsertElement(const InstInsertElement *Instr) = 0;
virtual void lowerIntrinsicCall(const InstIntrinsicCall *Inst) = 0; virtual void lowerIntrinsicCall(const InstIntrinsicCall *Instr) = 0;
virtual void lowerLoad(const InstLoad *Inst) = 0; virtual void lowerLoad(const InstLoad *Instr) = 0;
virtual void lowerPhi(const InstPhi *Inst) = 0; virtual void lowerPhi(const InstPhi *Instr) = 0;
virtual void lowerRet(const InstRet *Inst) = 0; virtual void lowerRet(const InstRet *Instr) = 0;
virtual void lowerSelect(const InstSelect *Inst) = 0; virtual void lowerSelect(const InstSelect *Instr) = 0;
virtual void lowerStore(const InstStore *Inst) = 0; virtual void lowerStore(const InstStore *Instr) = 0;
virtual void lowerSwitch(const InstSwitch *Inst) = 0; virtual void lowerSwitch(const InstSwitch *Instr) = 0;
virtual void lowerUnreachable(const InstUnreachable *Inst) = 0; virtual void lowerUnreachable(const InstUnreachable *Instr) = 0;
virtual void lowerOther(const Inst *Instr); virtual void lowerOther(const Inst *Instr);
virtual void genTargetHelperCallFor(Inst *Instr) = 0; virtual void genTargetHelperCallFor(Inst *Instr) = 0;
......
...@@ -188,16 +188,16 @@ protected: ...@@ -188,16 +188,16 @@ protected:
SBC_Yes, SBC_Yes,
}; };
void lowerAlloca(const InstAlloca *Inst) override; void lowerAlloca(const InstAlloca *Instr) override;
SafeBoolChain lowerInt1Arithmetic(const InstArithmetic *Inst); SafeBoolChain lowerInt1Arithmetic(const InstArithmetic *Instr);
void lowerInt64Arithmetic(InstArithmetic::OpKind Op, Variable *Dest, void lowerInt64Arithmetic(InstArithmetic::OpKind Op, Variable *Dest,
Operand *Src0, Operand *Src1); Operand *Src0, Operand *Src1);
void lowerArithmetic(const InstArithmetic *Inst) override; void lowerArithmetic(const InstArithmetic *Instr) override;
void lowerAssign(const InstAssign *Inst) override; void lowerAssign(const InstAssign *Instr) override;
void lowerBr(const InstBr *Inst) override; void lowerBr(const InstBr *Instr) override;
void lowerCall(const InstCall *Inst) override; void lowerCall(const InstCall *Instr) override;
void lowerCast(const InstCast *Inst) override; void lowerCast(const InstCast *Instr) override;
void lowerExtractElement(const InstExtractElement *Inst) override; void lowerExtractElement(const InstExtractElement *Instr) override;
/// CondWhenTrue is a helper type returned by every method in the lowering /// CondWhenTrue is a helper type returned by every method in the lowering
/// that emits code to set the condition codes. /// that emits code to set the condition codes.
...@@ -240,15 +240,15 @@ protected: ...@@ -240,15 +240,15 @@ protected:
void lowerIcmp(const InstIcmp *Instr) override; void lowerIcmp(const InstIcmp *Instr) override;
void lowerAtomicRMW(Variable *Dest, uint32_t Operation, Operand *Ptr, void lowerAtomicRMW(Variable *Dest, uint32_t Operation, Operand *Ptr,
Operand *Val); Operand *Val);
void lowerIntrinsicCall(const InstIntrinsicCall *Inst) override; void lowerIntrinsicCall(const InstIntrinsicCall *Instr) override;
void lowerInsertElement(const InstInsertElement *Inst) override; void lowerInsertElement(const InstInsertElement *Instr) override;
void lowerLoad(const InstLoad *Inst) override; void lowerLoad(const InstLoad *Instr) override;
void lowerPhi(const InstPhi *Inst) override; void lowerPhi(const InstPhi *Instr) override;
void lowerRet(const InstRet *Inst) override; void lowerRet(const InstRet *Instr) override;
void lowerSelect(const InstSelect *Inst) override; void lowerSelect(const InstSelect *Instr) override;
void lowerStore(const InstStore *Inst) override; void lowerStore(const InstStore *Instr) override;
void lowerSwitch(const InstSwitch *Inst) override; void lowerSwitch(const InstSwitch *Instr) override;
void lowerUnreachable(const InstUnreachable *Inst) override; void lowerUnreachable(const InstUnreachable *Instr) override;
void prelowerPhis() override; void prelowerPhis() override;
uint32_t getCallStackArgumentsSizeBytes(const InstCall *Instr) override; uint32_t getCallStackArgumentsSizeBytes(const InstCall *Instr) override;
void genTargetHelperCallFor(Inst *Instr) override; void genTargetHelperCallFor(Inst *Instr) override;
...@@ -1086,9 +1086,9 @@ private: ...@@ -1086,9 +1086,9 @@ private:
void postambleCtpop64(const InstCall *Instr); void postambleCtpop64(const InstCall *Instr);
void preambleDivRem(const InstCall *Instr); void preambleDivRem(const InstCall *Instr);
std::unordered_map<Operand *, void (TargetARM32::*)(const InstCall *Inst)> std::unordered_map<Operand *, void (TargetARM32::*)(const InstCall *Instr)>
ARM32HelpersPreamble; ARM32HelpersPreamble;
std::unordered_map<Operand *, void (TargetARM32::*)(const InstCall *Inst)> std::unordered_map<Operand *, void (TargetARM32::*)(const InstCall *Instr)>
ARM32HelpersPostamble; ARM32HelpersPostamble;
class ComputationTracker { class ComputationTracker {
......
...@@ -241,26 +241,26 @@ protected: ...@@ -241,26 +241,26 @@ protected:
dispatchToConcrete(&Traits::ConcreteTarget::initSandbox); dispatchToConcrete(&Traits::ConcreteTarget::initSandbox);
} }
void lowerAlloca(const InstAlloca *Inst) override; void lowerAlloca(const InstAlloca *Instr) override;
void lowerArguments() override; void lowerArguments() override;
void lowerArithmetic(const InstArithmetic *Inst) override; void lowerArithmetic(const InstArithmetic *Instr) override;
void lowerAssign(const InstAssign *Inst) override; void lowerAssign(const InstAssign *Instr) override;
void lowerBr(const InstBr *Inst) override; void lowerBr(const InstBr *Instr) override;
void lowerCall(const InstCall *Inst) override; void lowerCall(const InstCall *Instr) override;
void lowerCast(const InstCast *Inst) override; void lowerCast(const InstCast *Instr) override;
void lowerExtractElement(const InstExtractElement *Inst) override; void lowerExtractElement(const InstExtractElement *Instr) override;
void lowerFcmp(const InstFcmp *Inst) override; void lowerFcmp(const InstFcmp *Instr) override;
void lowerIcmp(const InstIcmp *Inst) override; void lowerIcmp(const InstIcmp *Instr) override;
void lowerIntrinsicCall(const InstIntrinsicCall *Inst) override; void lowerIntrinsicCall(const InstIntrinsicCall *Instr) override;
void lowerInsertElement(const InstInsertElement *Inst) override; void lowerInsertElement(const InstInsertElement *Instr) override;
void lowerLoad(const InstLoad *Inst) override; void lowerLoad(const InstLoad *Instr) override;
void lowerPhi(const InstPhi *Inst) override; void lowerPhi(const InstPhi *Instr) override;
void lowerRet(const InstRet *Inst) override; void lowerRet(const InstRet *Instr) override;
void lowerSelect(const InstSelect *Inst) override; void lowerSelect(const InstSelect *Instr) override;
void lowerStore(const InstStore *Inst) override; void lowerStore(const InstStore *Instr) override;
void lowerSwitch(const InstSwitch *Inst) override; void lowerSwitch(const InstSwitch *Instr) override;
void lowerUnreachable(const InstUnreachable *Inst) override; void lowerUnreachable(const InstUnreachable *Instr) override;
void lowerOther(const Inst *Instr) override; void lowerOther(const Inst *Instr) override;
void lowerRMW(const InstX86FakeRMW *RMW); void lowerRMW(const InstX86FakeRMW *RMW);
void prelowerPhis() override; void prelowerPhis() override;
...@@ -1053,7 +1053,7 @@ private: ...@@ -1053,7 +1053,7 @@ private:
/// Emit the code for instructions with a vector type. /// Emit the code for instructions with a vector type.
void lowerIcmpVector(const InstIcmp *Icmp); void lowerIcmpVector(const InstIcmp *Icmp);
void lowerFcmpVector(const InstFcmp *Icmp); void lowerFcmpVector(const InstFcmp *Icmp);
void lowerSelectVector(const InstSelect *Inst); void lowerSelectVector(const InstSelect *Instr);
/// Helpers for select lowering. /// Helpers for select lowering.
void lowerSelectMove(Variable *Dest, BrCond Cond, Operand *SrcT, void lowerSelectMove(Variable *Dest, BrCond Cond, Operand *SrcT,
......
...@@ -2743,17 +2743,17 @@ void FunctionParser::ProcessRecord() { ...@@ -2743,17 +2743,17 @@ void FunctionParser::ProcessRecord() {
Ice::Variable *Dest = (ReturnType == Ice::IceType_void) Ice::Variable *Dest = (ReturnType == Ice::IceType_void)
? nullptr ? nullptr
: getNextInstVar(ReturnType); : getNextInstVar(ReturnType);
std::unique_ptr<Ice::InstCall> Inst; std::unique_ptr<Ice::InstCall> Instr;
if (IntrinsicInfo) { if (IntrinsicInfo) {
Inst.reset(Ice::InstIntrinsicCall::create(Func.get(), Params.size(), Dest, Instr.reset(Ice::InstIntrinsicCall::create(
Callee, IntrinsicInfo->Info)); Func.get(), Params.size(), Dest, Callee, IntrinsicInfo->Info));
} else { } else {
Inst.reset(Ice::InstCall::create(Func.get(), Params.size(), Dest, Callee, Instr.reset(Ice::InstCall::create(Func.get(), Params.size(), Dest, Callee,
IsTailCall)); IsTailCall));
} }
for (Ice::Operand *Param : Params) for (Ice::Operand *Param : Params)
Inst->addArg(Param); Instr->addArg(Param);
CurrentNode->appendInst(Inst.release()); CurrentNode->appendInst(Instr.release());
return; return;
} }
case naclbitc::FUNC_CODE_INST_FORWARDTYPEREF: { case naclbitc::FUNC_CODE_INST_FORWARDTYPEREF: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment