Chromium Code Reviews| Index: src/IceInst.h | 
| diff --git a/src/IceInst.h b/src/IceInst.h | 
| index 10caa8b2012e476172b668f764fd27a319cc5ce0..a2a2cf2af33f2124faac54bec299f94c293eb208 100644 | 
| --- a/src/IceInst.h | 
| +++ b/src/IceInst.h | 
| @@ -177,7 +177,7 @@ public: | 
| } | 
| uint32_t getAlignInBytes() const { return AlignInBytes; } | 
| Operand *getSizeInBytes() const { return getSrc(0); } | 
| - virtual void dump(const Cfg *Func) const; | 
| + void dump(const Cfg *Func) const override; | 
| static bool classof(const Inst *Inst) { return Inst->getKind() == Alloca; } | 
| private: | 
| @@ -185,7 +185,7 @@ private: | 
| Variable *Dest); | 
| InstAlloca(const InstAlloca &) LLVM_DELETED_FUNCTION; | 
| InstAlloca &operator=(const InstAlloca &) LLVM_DELETED_FUNCTION; | 
| - virtual ~InstAlloca() {} | 
| + ~InstAlloca() override {} | 
| const uint32_t AlignInBytes; | 
| }; | 
| @@ -208,7 +208,7 @@ public: | 
| OpKind getOp() const { return Op; } | 
| static const char *getOpName(OpKind Op); | 
| bool isCommutative() const; | 
| - virtual void dump(const Cfg *Func) const; | 
| + void dump(const Cfg *Func) const override; | 
| static bool classof(const Inst *Inst) { | 
| return Inst->getKind() == Arithmetic; | 
| } | 
| @@ -218,7 +218,7 @@ private: | 
| Operand *Source2); | 
| InstArithmetic(const InstArithmetic &) LLVM_DELETED_FUNCTION; | 
| InstArithmetic &operator=(const InstArithmetic &) LLVM_DELETED_FUNCTION; | 
| - virtual ~InstArithmetic() {} | 
| + ~InstArithmetic() override {} | 
| const OpKind Op; | 
| }; | 
| @@ -235,15 +235,15 @@ public: | 
| return new (Func->allocateInst<InstAssign>()) | 
| InstAssign(Func, Dest, Source); | 
| } | 
| - virtual bool isSimpleAssign() const { return true; } | 
| - virtual void dump(const Cfg *Func) const; | 
| + bool isSimpleAssign() const override { return true; } | 
| + void dump(const Cfg *Func) const override; | 
| static bool classof(const Inst *Inst) { return Inst->getKind() == Assign; } | 
| private: | 
| InstAssign(Cfg *Func, Variable *Dest, Operand *Source); | 
| InstAssign(const InstAssign &) LLVM_DELETED_FUNCTION; | 
| InstAssign &operator=(const InstAssign &) LLVM_DELETED_FUNCTION; | 
| - virtual ~InstAssign() {} | 
| + ~InstAssign() override {} | 
| }; | 
| // Branch instruction. This represents both conditional and | 
| @@ -272,8 +272,8 @@ public: | 
| assert(isUnconditional()); | 
| return getTargetFalse(); | 
| } | 
| - virtual NodeList getTerminatorEdges() const; | 
| - virtual void dump(const Cfg *Func) const; | 
| + NodeList getTerminatorEdges() const override; | 
| + void dump(const Cfg *Func) const override; | 
| static bool classof(const Inst *Inst) { return Inst->getKind() == Br; } | 
| private: | 
| @@ -283,7 +283,7 @@ private: | 
| InstBr(Cfg *Func, CfgNode *Target); | 
| InstBr(const InstBr &) LLVM_DELETED_FUNCTION; | 
| InstBr &operator=(const InstBr &) LLVM_DELETED_FUNCTION; | 
| - virtual ~InstBr() {} | 
| + ~InstBr() override {} | 
| CfgNode *const TargetFalse; // Doubles as unconditional branch target | 
| CfgNode *const TargetTrue; // NULL if unconditional branch | 
| @@ -308,7 +308,7 @@ public: | 
| Operand *getArg(SizeT I) const { return getSrc(I + 1); } | 
| SizeT getNumArgs() const { return getSrcSize() - 1; } | 
| bool isTailcall() const { return HasTailCall; } | 
| - virtual void dump(const Cfg *Func) const; | 
| + void dump(const Cfg *Func) const; | 
| static bool classof(const Inst *Inst) { return Inst->getKind() == Call; } | 
| Type getReturnType() const; | 
| @@ -320,7 +320,7 @@ protected: | 
| HasSideEffects = HasSideEff; | 
| addSource(CallTarget); | 
| } | 
| - virtual ~InstCall() {} | 
| + ~InstCall() override {} | 
| private: | 
| bool HasTailCall; | 
| @@ -344,14 +344,14 @@ public: | 
| InstCast(Func, CastKind, Dest, Source); | 
| } | 
| OpKind getCastKind() const { return CastKind; } | 
| - virtual void dump(const Cfg *Func) const; | 
| + void dump(const Cfg *Func) const override; | 
| static bool classof(const Inst *Inst) { return Inst->getKind() == Cast; } | 
| private: | 
| InstCast(Cfg *Func, OpKind CastKind, Variable *Dest, Operand *Source); | 
| InstCast(const InstCast &) LLVM_DELETED_FUNCTION; | 
| InstCast &operator=(const InstCast &) LLVM_DELETED_FUNCTION; | 
| - virtual ~InstCast() {} | 
| + ~InstCast() override {} | 
| const OpKind CastKind; | 
| }; | 
| @@ -364,7 +364,7 @@ public: | 
| InstExtractElement(Func, Dest, Source1, Source2); | 
| } | 
| - virtual void dump(const Cfg *Func) const; | 
| + void dump(const Cfg *Func) const override; | 
| static bool classof(const Inst *Inst) { | 
| return Inst->getKind() == ExtractElement; | 
| } | 
| @@ -375,7 +375,7 @@ private: | 
| InstExtractElement(const InstExtractElement &) LLVM_DELETED_FUNCTION; | 
| InstExtractElement & | 
| operator=(const InstExtractElement &) LLVM_DELETED_FUNCTION; | 
| - virtual ~InstExtractElement() {} | 
| + ~InstExtractElement() override {} | 
| }; | 
| // Floating-point comparison instruction. The source operands are | 
| @@ -395,7 +395,7 @@ public: | 
| InstFcmp(Func, Condition, Dest, Source1, Source2); | 
| } | 
| FCond getCondition() const { return Condition; } | 
| - virtual void dump(const Cfg *Func) const; | 
| + void dump(const Cfg *Func) const override; | 
| static bool classof(const Inst *Inst) { return Inst->getKind() == Fcmp; } | 
| private: | 
| @@ -403,7 +403,7 @@ private: | 
| Operand *Source2); | 
| InstFcmp(const InstFcmp &) LLVM_DELETED_FUNCTION; | 
| InstFcmp &operator=(const InstFcmp &) LLVM_DELETED_FUNCTION; | 
| - virtual ~InstFcmp() {} | 
| + ~InstFcmp() override {} | 
| const FCond Condition; | 
| }; | 
| @@ -424,7 +424,7 @@ public: | 
| InstIcmp(Func, Condition, Dest, Source1, Source2); | 
| } | 
| ICond getCondition() const { return Condition; } | 
| - virtual void dump(const Cfg *Func) const; | 
| + void dump(const Cfg *Func) const override; | 
| static bool classof(const Inst *Inst) { return Inst->getKind() == Icmp; } | 
| private: | 
| @@ -432,7 +432,7 @@ private: | 
| Operand *Source2); | 
| InstIcmp(const InstIcmp &) LLVM_DELETED_FUNCTION; | 
| InstIcmp &operator=(const InstIcmp &) LLVM_DELETED_FUNCTION; | 
| - virtual ~InstIcmp() {} | 
| + ~InstIcmp() override {} | 
| const ICond Condition; | 
| }; | 
| @@ -445,7 +445,7 @@ public: | 
| InstInsertElement(Func, Dest, Source1, Source2, Source3); | 
| } | 
| - virtual void dump(const Cfg *Func) const; | 
| + void dump(const Cfg *Func) const override; | 
| static bool classof(const Inst *Inst) { | 
| return Inst->getKind() == InsertElement; | 
| } | 
| @@ -455,7 +455,7 @@ private: | 
| Operand *Source2, Operand *Source3); | 
| InstInsertElement(const InstInsertElement &) LLVM_DELETED_FUNCTION; | 
| InstInsertElement &operator=(const InstInsertElement &) LLVM_DELETED_FUNCTION; | 
| - virtual ~InstInsertElement() {} | 
| + ~InstInsertElement() override {} | 
| }; | 
| // Call to an intrinsic function. The call target is captured as getSrc(0), | 
| @@ -482,7 +482,7 @@ private: | 
| Info(Info) {} | 
| InstIntrinsicCall(const InstIntrinsicCall &) LLVM_DELETED_FUNCTION; | 
| InstIntrinsicCall &operator=(const InstIntrinsicCall &) LLVM_DELETED_FUNCTION; | 
| - virtual ~InstIntrinsicCall() {} | 
| + ~InstIntrinsicCall() override {} | 
| const Intrinsics::IntrinsicInfo Info; | 
| }; | 
| @@ -497,14 +497,14 @@ public: | 
| InstLoad(Func, Dest, SourceAddr); | 
| } | 
| Operand *getSourceAddress() const { return getSrc(0); } | 
| - virtual void dump(const Cfg *Func) const; | 
| + void dump(const Cfg *Func) const override; | 
| static bool classof(const Inst *Inst) { return Inst->getKind() == Load; } | 
| private: | 
| InstLoad(Cfg *Func, Variable *Dest, Operand *SourceAddr); | 
| InstLoad(const InstLoad &) LLVM_DELETED_FUNCTION; | 
| InstLoad &operator=(const InstLoad &) LLVM_DELETED_FUNCTION; | 
| - virtual ~InstLoad() {} | 
| + ~InstLoad() override {} | 
| }; | 
| // Phi instruction. For incoming edge I, the node is Labels[I] and | 
| @@ -519,18 +519,18 @@ public: | 
| void livenessPhiOperand(llvm::BitVector &Live, CfgNode *Target, | 
| Liveness *Liveness); | 
| Inst *lower(Cfg *Func); | 
| - virtual void dump(const Cfg *Func) const; | 
| + void dump(const Cfg *Func) const override; | 
| static bool classof(const Inst *Inst) { return Inst->getKind() == Phi; } | 
| private: | 
| InstPhi(Cfg *Func, SizeT MaxSrcs, Variable *Dest); | 
| InstPhi(const InstPhi &) LLVM_DELETED_FUNCTION; | 
| InstPhi &operator=(const InstPhi &) LLVM_DELETED_FUNCTION; | 
| - virtual void destroy(Cfg *Func) { | 
| + void destroy(Cfg *Func) override { | 
| Func->deallocateArrayOf<CfgNode *>(Labels); | 
| Inst::destroy(Func); | 
| } | 
| - virtual ~InstPhi() {} | 
| + ~InstPhi() override {} | 
| // Labels[] duplicates the InEdges[] information in the enclosing | 
| // CfgNode, but the Phi instruction is created before InEdges[] | 
| @@ -551,15 +551,15 @@ public: | 
| assert(hasRetValue()); | 
| return getSrc(0); | 
| } | 
| - virtual NodeList getTerminatorEdges() const { return NodeList(); } | 
| - virtual void dump(const Cfg *Func) const; | 
| + NodeList getTerminatorEdges() const override { return NodeList(); } | 
| + void dump(const Cfg *Func) const override; | 
| static bool classof(const Inst *Inst) { return Inst->getKind() == Ret; } | 
| private: | 
| InstRet(Cfg *Func, Operand *RetValue); | 
| InstRet(const InstRet &) LLVM_DELETED_FUNCTION; | 
| InstRet &operator=(const InstRet &) LLVM_DELETED_FUNCTION; | 
| - virtual ~InstRet() {} | 
| + ~InstRet() override {} | 
| }; | 
| // Select instruction. The condition, true, and false operands are captured. | 
| @@ -573,7 +573,7 @@ public: | 
| Operand *getCondition() const { return getSrc(0); } | 
| Operand *getTrueOperand() const { return getSrc(1); } | 
| Operand *getFalseOperand() const { return getSrc(2); } | 
| - virtual void dump(const Cfg *Func) const; | 
| + void dump(const Cfg *Func) const override; | 
| static bool classof(const Inst *Inst) { return Inst->getKind() == Select; } | 
| private: | 
| @@ -581,7 +581,7 @@ private: | 
| Operand *Source2); | 
| InstSelect(const InstSelect &) LLVM_DELETED_FUNCTION; | 
| InstSelect &operator=(const InstSelect &) LLVM_DELETED_FUNCTION; | 
| - virtual ~InstSelect() {} | 
| + ~InstSelect() override {} | 
| }; | 
| // Store instruction. The address operand is captured, along with the | 
| @@ -596,14 +596,14 @@ public: | 
| } | 
| Operand *getAddr() const { return getSrc(1); } | 
| Operand *getData() const { return getSrc(0); } | 
| - virtual void dump(const Cfg *Func) const; | 
| + void dump(const Cfg *Func) const override; | 
| static bool classof(const Inst *Inst) { return Inst->getKind() == Store; } | 
| private: | 
| InstStore(Cfg *Func, Operand *Data, Operand *Addr); | 
| InstStore(const InstStore &) LLVM_DELETED_FUNCTION; | 
| InstStore &operator=(const InstStore &) LLVM_DELETED_FUNCTION; | 
| - virtual ~InstStore() {} | 
| + ~InstStore() override {} | 
| }; | 
| // Switch instruction. The single source operand is captured as | 
| @@ -627,20 +627,20 @@ public: | 
| return Labels[I]; | 
| } | 
| void addBranch(SizeT CaseIndex, uint64_t Value, CfgNode *Label); | 
| - virtual NodeList getTerminatorEdges() const; | 
| - virtual void dump(const Cfg *Func) const; | 
| + NodeList getTerminatorEdges() const override; | 
| + void dump(const Cfg *Func) const override; | 
| static bool classof(const Inst *Inst) { return Inst->getKind() == Switch; } | 
| private: | 
| InstSwitch(Cfg *Func, SizeT NumCases, Operand *Source, CfgNode *LabelDefault); | 
| InstSwitch(const InstSwitch &) LLVM_DELETED_FUNCTION; | 
| InstSwitch &operator=(const InstSwitch &) LLVM_DELETED_FUNCTION; | 
| - virtual void destroy(Cfg *Func) { | 
| + void destroy(Cfg *Func) override { | 
| Func->deallocateArrayOf<uint64_t>(Values); | 
| Func->deallocateArrayOf<CfgNode *>(Labels); | 
| Inst::destroy(Func); | 
| } | 
| - virtual ~InstSwitch() {} | 
| + ~InstSwitch() override {} | 
| CfgNode *LabelDefault; | 
| SizeT NumCases; // not including the default case | 
| @@ -655,8 +655,8 @@ public: | 
| static InstUnreachable *create(Cfg *Func) { | 
| return new (Func->allocateInst<InstUnreachable>()) InstUnreachable(Func); | 
| } | 
| - virtual NodeList getTerminatorEdges() const { return NodeList(); } | 
| - virtual void dump(const Cfg *Func) const; | 
| + NodeList getTerminatorEdges() const override { return NodeList(); } | 
| + void dump(const Cfg *Func) const override; | 
| static bool classof(const Inst *Inst) { | 
| return Inst->getKind() == Unreachable; | 
| } | 
| @@ -665,7 +665,7 @@ private: | 
| InstUnreachable(Cfg *Func); | 
| InstUnreachable(const InstUnreachable &) LLVM_DELETED_FUNCTION; | 
| InstUnreachable &operator=(const InstUnreachable &) LLVM_DELETED_FUNCTION; | 
| - virtual ~InstUnreachable() {} | 
| + ~InstUnreachable() override {} | 
| }; | 
| // FakeDef instruction. This creates a fake definition of a variable, | 
| @@ -685,15 +685,15 @@ public: | 
| static InstFakeDef *create(Cfg *Func, Variable *Dest, Variable *Src = NULL) { | 
| return new (Func->allocateInst<InstFakeDef>()) InstFakeDef(Func, Dest, Src); | 
| } | 
| - virtual void emit(const Cfg *Func) const; | 
| - virtual void dump(const Cfg *Func) const; | 
| + void emit(const Cfg *Func) const override; | 
| + void dump(const Cfg *Func) const override; | 
| static bool classof(const Inst *Inst) { return Inst->getKind() == FakeDef; } | 
| private: | 
| InstFakeDef(Cfg *Func, Variable *Dest, Variable *Src); | 
| InstFakeDef(const InstFakeDef &) LLVM_DELETED_FUNCTION; | 
| InstFakeDef &operator=(const InstFakeDef &) LLVM_DELETED_FUNCTION; | 
| - virtual ~InstFakeDef() {} | 
| + ~InstFakeDef() override {} | 
| }; | 
| // FakeUse instruction. This creates a fake use of a variable, to | 
| @@ -706,15 +706,15 @@ public: | 
| static InstFakeUse *create(Cfg *Func, Variable *Src) { | 
| return new (Func->allocateInst<InstFakeUse>()) InstFakeUse(Func, Src); | 
| } | 
| - virtual void emit(const Cfg *Func) const; | 
| - virtual void dump(const Cfg *Func) const; | 
| + void emit(const Cfg *Func) const override; | 
| + void dump(const Cfg *Func) const override; | 
| static bool classof(const Inst *Inst) { return Inst->getKind() == FakeUse; } | 
| private: | 
| InstFakeUse(Cfg *Func, Variable *Src); | 
| InstFakeUse(const InstFakeUse &) LLVM_DELETED_FUNCTION; | 
| InstFakeUse &operator=(const InstFakeUse &) LLVM_DELETED_FUNCTION; | 
| - virtual ~InstFakeUse() {} | 
| + ~InstFakeUse() override {} | 
| }; | 
| // FakeKill instruction. This "kills" a set of variables by adding a | 
| @@ -734,15 +734,15 @@ public: | 
| InstFakeKill(Func, KilledRegs, Linked); | 
| } | 
| const Inst *getLinked() const { return Linked; } | 
| - virtual void emit(const Cfg *Func) const; | 
| - virtual void dump(const Cfg *Func) const; | 
| + void emit(const Cfg *Func) const override; | 
| + void dump(const Cfg *Func) const override; | 
| static bool classof(const Inst *Inst) { return Inst->getKind() == FakeKill; } | 
| private: | 
| InstFakeKill(Cfg *Func, const VarList &KilledRegs, const Inst *Linked); | 
| InstFakeKill(const InstFakeKill &) LLVM_DELETED_FUNCTION; | 
| InstFakeKill &operator=(const InstFakeKill &) LLVM_DELETED_FUNCTION; | 
| - virtual ~InstFakeKill() {} | 
| + ~InstFakeKill() override {} | 
| // This instruction is ignored if Linked->isDeleted() is true. | 
| const Inst *Linked; | 
| @@ -752,10 +752,10 @@ private: | 
| // instructions. | 
| class InstTarget : public Inst { | 
| public: | 
| - virtual uint32_t getEmitInstCount() const { return 1; } | 
| - virtual void emit(const Cfg *Func) const = 0; | 
| - virtual void dump(const Cfg *Func) const; | 
| - virtual void dumpExtras(const Cfg *Func) const; | 
| + uint32_t getEmitInstCount() const override { return 1; } | 
| + void emit(const Cfg *Func) const override = 0; | 
| 
 
Jim Stichnoth
2014/09/26 05:07:08
"... override = 0" looks weird to me.  What's the
 
JF
2014/09/26 05:42:02
Inst::emit has an implementation that's just llvm_
 
Jim Stichnoth
2014/09/26 13:04:04
I want to make provide a default llvm_unreachable
 
 | 
| + void dump(const Cfg *Func) const override; | 
| + void dumpExtras(const Cfg *Func) const override; | 
| static bool classof(const Inst *Inst) { return Inst->getKind() >= Target; } | 
| protected: | 
| @@ -765,7 +765,7 @@ protected: | 
| } | 
| InstTarget(const InstTarget &) LLVM_DELETED_FUNCTION; | 
| InstTarget &operator=(const InstTarget &) LLVM_DELETED_FUNCTION; | 
| - virtual ~InstTarget() {} | 
| + ~InstTarget() override {} | 
| }; | 
| } // end of namespace Ice |