Commit b56c8f42 by Jim Stichnoth

Subzero: Use 'override' as appropriate for C++11.

Not necessary for the LLVM 3.5 merge, but nice to have anyway. BUG= https://code.google.com/p/nativeclient/issues/detail?id=3930 R=jfb@chromium.org, jvoung@chromium.org Review URL: https://codereview.chromium.org/605123002
parent 5081c21b
......@@ -470,11 +470,12 @@ void CfgNode::emit(Cfg *Func) const {
}
Str << getAsmName() << ":\n";
for (PhiList::const_iterator I = Phis.begin(), E = Phis.end(); I != E; ++I) {
InstPhi *Inst = *I;
if (Inst->isDeleted())
InstPhi *Phi = *I;
if (Phi->isDeleted())
continue;
// Emitting a Phi instruction should cause an error.
Inst->emit(Func);
Inst *Instr = Phi;
Instr->emit(Func);
}
for (InstList::const_iterator I = Insts.begin(), E = Insts.end(); I != E;
++I) {
......
......@@ -196,7 +196,7 @@ void Inst::liveness(InstNumberT InstNumber, llvm::BitVector &Live,
InstAlloca::InstAlloca(Cfg *Func, Operand *ByteCount, uint32_t AlignInBytes,
Variable *Dest)
: Inst(Func, Inst::Alloca, 1, Dest), AlignInBytes(AlignInBytes) {
: InstHighLevel(Func, Inst::Alloca, 1, Dest), AlignInBytes(AlignInBytes) {
// Verify AlignInBytes is 0 or a power of 2.
assert(AlignInBytes == 0 || llvm::isPowerOf2_32(AlignInBytes));
addSource(ByteCount);
......@@ -204,7 +204,7 @@ InstAlloca::InstAlloca(Cfg *Func, Operand *ByteCount, uint32_t AlignInBytes,
InstArithmetic::InstArithmetic(Cfg *Func, OpKind Op, Variable *Dest,
Operand *Source1, Operand *Source2)
: Inst(Func, Inst::Arithmetic, 2, Dest), Op(Op) {
: InstHighLevel(Func, Inst::Arithmetic, 2, Dest), Op(Op) {
addSource(Source1);
addSource(Source2);
}
......@@ -221,7 +221,7 @@ bool InstArithmetic::isCommutative() const {
}
InstAssign::InstAssign(Cfg *Func, Variable *Dest, Operand *Source)
: Inst(Func, Inst::Assign, 1, Dest) {
: InstHighLevel(Func, Inst::Assign, 1, Dest) {
addSource(Source);
}
......@@ -230,7 +230,7 @@ InstAssign::InstAssign(Cfg *Func, Variable *Dest, Operand *Source)
// semantics, there is at most one edge from one node to another.
InstBr::InstBr(Cfg *Func, Operand *Source, CfgNode *TargetTrue,
CfgNode *TargetFalse)
: Inst(Func, Inst::Br, 1, NULL), TargetFalse(TargetFalse),
: InstHighLevel(Func, Inst::Br, 1, NULL), TargetFalse(TargetFalse),
TargetTrue(TargetTrue) {
if (TargetTrue == TargetFalse) {
TargetTrue = NULL; // turn into unconditional version
......@@ -240,7 +240,8 @@ InstBr::InstBr(Cfg *Func, Operand *Source, CfgNode *TargetTrue,
}
InstBr::InstBr(Cfg *Func, CfgNode *Target)
: Inst(Func, Inst::Br, 0, NULL), TargetFalse(Target), TargetTrue(NULL) {}
: InstHighLevel(Func, Inst::Br, 0, NULL), TargetFalse(Target),
TargetTrue(NULL) {}
NodeList InstBr::getTerminatorEdges() const {
NodeList OutEdges;
......@@ -251,27 +252,27 @@ NodeList InstBr::getTerminatorEdges() const {
}
InstCast::InstCast(Cfg *Func, OpKind CastKind, Variable *Dest, Operand *Source)
: Inst(Func, Inst::Cast, 1, Dest), CastKind(CastKind) {
: InstHighLevel(Func, Inst::Cast, 1, Dest), CastKind(CastKind) {
addSource(Source);
}
InstExtractElement::InstExtractElement(Cfg *Func, Variable *Dest,
Operand *Source1, Operand *Source2)
: Inst(Func, Inst::ExtractElement, 2, Dest) {
: InstHighLevel(Func, Inst::ExtractElement, 2, Dest) {
addSource(Source1);
addSource(Source2);
}
InstFcmp::InstFcmp(Cfg *Func, FCond Condition, Variable *Dest, Operand *Source1,
Operand *Source2)
: Inst(Func, Inst::Fcmp, 2, Dest), Condition(Condition) {
: InstHighLevel(Func, Inst::Fcmp, 2, Dest), Condition(Condition) {
addSource(Source1);
addSource(Source2);
}
InstIcmp::InstIcmp(Cfg *Func, ICond Condition, Variable *Dest, Operand *Source1,
Operand *Source2)
: Inst(Func, Inst::Icmp, 2, Dest), Condition(Condition) {
: InstHighLevel(Func, Inst::Icmp, 2, Dest), Condition(Condition) {
addSource(Source1);
addSource(Source2);
}
......@@ -279,19 +280,19 @@ InstIcmp::InstIcmp(Cfg *Func, ICond Condition, Variable *Dest, Operand *Source1,
InstInsertElement::InstInsertElement(Cfg *Func, Variable *Dest,
Operand *Source1, Operand *Source2,
Operand *Source3)
: Inst(Func, Inst::InsertElement, 3, Dest) {
: InstHighLevel(Func, Inst::InsertElement, 3, Dest) {
addSource(Source1);
addSource(Source2);
addSource(Source3);
}
InstLoad::InstLoad(Cfg *Func, Variable *Dest, Operand *SourceAddr)
: Inst(Func, Inst::Load, 1, Dest) {
: InstHighLevel(Func, Inst::Load, 1, Dest) {
addSource(SourceAddr);
}
InstPhi::InstPhi(Cfg *Func, SizeT MaxSrcs, Variable *Dest)
: Inst(Func, Phi, MaxSrcs, Dest) {
: InstHighLevel(Func, Phi, MaxSrcs, Dest) {
Labels = Func->allocateArrayOf<CfgNode *>(MaxSrcs);
}
......@@ -350,14 +351,14 @@ Inst *InstPhi::lower(Cfg *Func) {
}
InstRet::InstRet(Cfg *Func, Operand *RetValue)
: Inst(Func, Ret, RetValue ? 1 : 0, NULL) {
: InstHighLevel(Func, Ret, RetValue ? 1 : 0, NULL) {
if (RetValue)
addSource(RetValue);
}
InstSelect::InstSelect(Cfg *Func, Variable *Dest, Operand *Condition,
Operand *SourceTrue, Operand *SourceFalse)
: Inst(Func, Inst::Select, 3, Dest) {
: InstHighLevel(Func, Inst::Select, 3, Dest) {
assert(typeElementType(Condition->getType()) == IceType_i1);
addSource(Condition);
addSource(SourceTrue);
......@@ -365,14 +366,14 @@ InstSelect::InstSelect(Cfg *Func, Variable *Dest, Operand *Condition,
}
InstStore::InstStore(Cfg *Func, Operand *Data, Operand *Addr)
: Inst(Func, Inst::Store, 2, NULL) {
: InstHighLevel(Func, Inst::Store, 2, NULL) {
addSource(Data);
addSource(Addr);
}
InstSwitch::InstSwitch(Cfg *Func, SizeT NumCases, Operand *Source,
CfgNode *LabelDefault)
: Inst(Func, Inst::Switch, 1, NULL), LabelDefault(LabelDefault),
: InstHighLevel(Func, Inst::Switch, 1, NULL), LabelDefault(LabelDefault),
NumCases(NumCases) {
addSource(Source);
Values = Func->allocateArrayOf<uint64_t>(NumCases);
......@@ -400,24 +401,25 @@ NodeList InstSwitch::getTerminatorEdges() const {
}
InstUnreachable::InstUnreachable(Cfg *Func)
: Inst(Func, Inst::Unreachable, 0, NULL) {}
: InstHighLevel(Func, Inst::Unreachable, 0, NULL) {}
InstFakeDef::InstFakeDef(Cfg *Func, Variable *Dest, Variable *Src)
: Inst(Func, Inst::FakeDef, Src ? 1 : 0, Dest) {
: InstHighLevel(Func, Inst::FakeDef, Src ? 1 : 0, Dest) {
assert(Dest);
if (Src)
addSource(Src);
}
InstFakeUse::InstFakeUse(Cfg *Func, Variable *Src)
: Inst(Func, Inst::FakeUse, 1, NULL) {
: InstHighLevel(Func, Inst::FakeUse, 1, NULL) {
assert(Src);
addSource(Src);
}
InstFakeKill::InstFakeKill(Cfg *Func, const VarList &KilledRegs,
const Inst *Linked)
: Inst(Func, Inst::FakeKill, KilledRegs.size(), NULL), Linked(Linked) {
: InstHighLevel(Func, Inst::FakeKill, KilledRegs.size(), NULL),
Linked(Linked) {
for (VarList::const_iterator I = KilledRegs.begin(), E = KilledRegs.end();
I != E; ++I) {
Variable *Var = *I;
......@@ -449,12 +451,6 @@ void Inst::dumpDecorated(const Cfg *Func) const {
Str << "\n";
}
void Inst::emit(const Cfg * /*Func*/) const {
llvm_unreachable("emit() called on a non-lowered instruction");
}
void Inst::emitIAS(const Cfg *Func) const { emit(Func); }
void Inst::dump(const Cfg *Func) const {
Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func);
......@@ -754,6 +750,4 @@ void InstTarget::dump(const Cfg *Func) const {
Inst::dump(Func);
}
void InstTarget::dumpExtras(const Cfg *Func) const { Inst::dumpExtras(Func); }
} // end of namespace Ice
......@@ -102,9 +102,9 @@ class Constant : public Operand {
public:
uint32_t getPoolEntryID() const { return PoolEntryID; }
using Operand::dump;
virtual void emit(const Cfg *Func) const { emit(Func->getContext()); }
void emit(const Cfg *Func) const override { emit(Func->getContext()); }
virtual void emit(GlobalContext *Ctx) const = 0;
virtual void dump(const Cfg *Func, Ostream &Str) const = 0;
void dump(const Cfg *Func, Ostream &Str) const = 0;
static bool classof(const Operand *Operand) {
OperandKind Kind = Operand->getKind();
......@@ -117,7 +117,7 @@ protected:
Vars = NULL;
NumVars = 0;
}
virtual ~Constant() {}
~Constant() override {}
// PoolEntryID is an integer that uniquely identifies the constant
// within its constant pool. It is used for building the constant
// pool in the object code and for referencing its entries.
......@@ -141,9 +141,9 @@ public:
using Constant::emit;
// The target needs to implement this for each ConstantPrimitive
// specialization.
virtual void emit(GlobalContext *Ctx) const;
void emit(GlobalContext *Ctx) const override;
using Constant::dump;
virtual void dump(const Cfg *, Ostream &Str) const { Str << getValue(); }
void dump(const Cfg *, Ostream &Str) const override { Str << getValue(); }
static bool classof(const Operand *Operand) {
return Operand->getKind() == K;
......@@ -154,7 +154,7 @@ private:
: Constant(K, Ty, PoolEntryID), Value(Value) {}
ConstantPrimitive(const ConstantPrimitive &) LLVM_DELETED_FUNCTION;
ConstantPrimitive &operator=(const ConstantPrimitive &) LLVM_DELETED_FUNCTION;
virtual ~ConstantPrimitive() {}
~ConstantPrimitive() override {}
const T Value;
};
......@@ -213,8 +213,8 @@ public:
bool getSuppressMangling() const { return SuppressMangling; }
using Constant::emit;
using Constant::dump;
virtual void emit(GlobalContext *Ctx) const;
virtual void dump(const Cfg *Func, Ostream &Str) const;
void emit(GlobalContext *Ctx) const override;
void dump(const Cfg *Func, Ostream &Str) const override;
static bool classof(const Operand *Operand) {
OperandKind Kind = Operand->getKind();
......@@ -229,7 +229,7 @@ private:
ConstantRelocatable(const ConstantRelocatable &) LLVM_DELETED_FUNCTION;
ConstantRelocatable &
operator=(const ConstantRelocatable &) LLVM_DELETED_FUNCTION;
virtual ~ConstantRelocatable() {}
~ConstantRelocatable() override {}
const int64_t Offset; // fixed offset to add
const IceString Name; // optional for debug/dump
bool SuppressMangling;
......@@ -248,8 +248,8 @@ public:
using Constant::emit;
using Constant::dump;
// The target needs to implement this.
virtual void emit(GlobalContext *Ctx) const;
virtual void dump(const Cfg *, Ostream &Str) const { Str << "undef"; }
void emit(GlobalContext *Ctx) const override;
void dump(const Cfg *, Ostream &Str) const override { Str << "undef"; }
static bool classof(const Operand *Operand) {
return Operand->getKind() == kConstUndef;
......@@ -260,7 +260,7 @@ private:
: Constant(kConstUndef, Ty, PoolEntryID) {}
ConstantUndef(const ConstantUndef &) LLVM_DELETED_FUNCTION;
ConstantUndef &operator=(const ConstantUndef &) LLVM_DELETED_FUNCTION;
virtual ~ConstantUndef() {}
~ConstantUndef() override {}
};
// RegWeight is a wrapper for a uint32_t weight value, with a
......@@ -415,9 +415,9 @@ public:
// VarsReal.
Variable asType(Type Ty);
virtual void emit(const Cfg *Func) const;
void emit(const Cfg *Func) const override;
using Operand::dump;
virtual void dump(const Cfg *Func, Ostream &Str) const;
void dump(const Cfg *Func, Ostream &Str) const override;
static bool classof(const Operand *Operand) {
OperandKind Kind = Operand->getKind();
......@@ -425,7 +425,7 @@ public:
}
// The destructor is public because of the asType() method.
virtual ~Variable() {}
~Variable() override {}
protected:
Variable(OperandKind K, Type Ty, SizeT Index, const IceString &Name)
......
......@@ -28,36 +28,36 @@ class TargetX8632 : public TargetLowering {
public:
static TargetX8632 *create(Cfg *Func) { return new TargetX8632(Func); }
virtual void translateOm1();
virtual void translateO2();
virtual bool doBranchOpt(Inst *I, const CfgNode *NextNode);
void translateOm1() override;
void translateO2() override;
bool doBranchOpt(Inst *I, const CfgNode *NextNode) override;
virtual Variable *getPhysicalRegister(SizeT RegNum);
virtual IceString getRegName(SizeT RegNum, Type Ty) const;
virtual llvm::SmallBitVector getRegisterSet(RegSetMask Include,
RegSetMask Exclude) const;
virtual const llvm::SmallBitVector &getRegisterSetForType(Type Ty) const {
Variable *getPhysicalRegister(SizeT RegNum) override;
IceString getRegName(SizeT RegNum, Type Ty) const override;
llvm::SmallBitVector getRegisterSet(RegSetMask Include,
RegSetMask Exclude) const override;
const llvm::SmallBitVector &getRegisterSetForType(Type Ty) const override {
return TypeToRegisterSet[Ty];
}
virtual bool hasFramePointer() const { return IsEbpBasedFrame; }
virtual SizeT getFrameOrStackReg() const {
bool hasFramePointer() const override { return IsEbpBasedFrame; }
SizeT getFrameOrStackReg() const override {
return IsEbpBasedFrame ? RegX8632::Reg_ebp : RegX8632::Reg_esp;
}
virtual size_t typeWidthInBytesOnStack(Type Ty) const {
size_t typeWidthInBytesOnStack(Type Ty) const override {
// Round up to the next multiple of 4 bytes. In particular, i1,
// i8, and i16 are rounded up to 4 bytes.
return (typeWidthInBytes(Ty) + 3) & ~3;
}
virtual SizeT getBundleAlignLog2Bytes() const { return 5; }
virtual llvm::ArrayRef<uint8_t> getNonExecBundlePadding() const {
SizeT getBundleAlignLog2Bytes() const override { return 5; }
llvm::ArrayRef<uint8_t> getNonExecBundlePadding() const override {
static const uint8_t Padding[] = { 0xF4 };
return llvm::ArrayRef<uint8_t>(Padding, 1);
}
virtual void emitVariable(const Variable *Var) const;
virtual void lowerArguments();
virtual void addProlog(CfgNode *Node);
virtual void addEpilog(CfgNode *Node);
virtual void emitConstants() const;
void emitVariable(const Variable *Var) const override;
void lowerArguments() override;
void addProlog(CfgNode *Node) override;
void addEpilog(CfgNode *Node) override;
void emitConstants() const override;
SizeT makeNextLabelNumber() { return NextLabelNumber++; }
// Ensure that a 64-bit Variable has been split into 2 32-bit
// Variables, creating them if necessary. This is needed for all
......@@ -82,29 +82,29 @@ public:
protected:
TargetX8632(Cfg *Func);
virtual void postLower();
void postLower() override;
virtual void lowerAlloca(const InstAlloca *Inst);
virtual void lowerArithmetic(const InstArithmetic *Inst);
virtual void lowerAssign(const InstAssign *Inst);
virtual void lowerBr(const InstBr *Inst);
virtual void lowerCall(const InstCall *Inst);
virtual void lowerCast(const InstCast *Inst);
virtual void lowerExtractElement(const InstExtractElement *Inst);
virtual void lowerFcmp(const InstFcmp *Inst);
virtual void lowerIcmp(const InstIcmp *Inst);
virtual void lowerIntrinsicCall(const InstIntrinsicCall *Inst);
virtual void lowerInsertElement(const InstInsertElement *Inst);
virtual void lowerLoad(const InstLoad *Inst);
virtual void lowerPhi(const InstPhi *Inst);
virtual void lowerRet(const InstRet *Inst);
virtual void lowerSelect(const InstSelect *Inst);
virtual void lowerStore(const InstStore *Inst);
virtual void lowerSwitch(const InstSwitch *Inst);
virtual void lowerUnreachable(const InstUnreachable *Inst);
virtual void doAddressOptLoad();
virtual void doAddressOptStore();
virtual void randomlyInsertNop(float Probability);
void lowerAlloca(const InstAlloca *Inst) override;
void lowerArithmetic(const InstArithmetic *Inst) override;
void lowerAssign(const InstAssign *Inst) override;
void lowerBr(const InstBr *Inst) override;
void lowerCall(const InstCall *Inst) override;
void lowerCast(const InstCast *Inst) override;
void lowerExtractElement(const InstExtractElement *Inst) override;
void lowerFcmp(const InstFcmp *Inst) override;
void lowerIcmp(const InstIcmp *Inst) override;
void lowerIntrinsicCall(const InstIntrinsicCall *Inst) override;
void lowerInsertElement(const InstInsertElement *Inst) override;
void lowerLoad(const InstLoad *Inst) override;
void lowerPhi(const InstPhi *Inst) override;
void lowerRet(const InstRet *Inst) override;
void lowerSelect(const InstSelect *Inst) override;
void lowerStore(const InstStore *Inst) override;
void lowerSwitch(const InstSwitch *Inst) override;
void lowerUnreachable(const InstUnreachable *Inst) override;
void doAddressOptLoad() override;
void doAddressOptStore() override;
void randomlyInsertNop(float Probability) override;
// Naive lowering of cmpxchg.
void lowerAtomicCmpxchg(Variable *DestPrev, Operand *Ptr, Operand *Expected,
......@@ -477,7 +477,7 @@ protected:
private:
TargetX8632(const TargetX8632 &) LLVM_DELETED_FUNCTION;
TargetX8632 &operator=(const TargetX8632 &) LLVM_DELETED_FUNCTION;
virtual ~TargetX8632() {}
~TargetX8632() override {}
template <typename T> void emitConstantPool() const;
};
......@@ -486,9 +486,9 @@ public:
static TargetGlobalInitLowering *create(GlobalContext *Ctx) {
return new TargetGlobalInitX8632(Ctx);
}
virtual void lower(const IceString &Name, SizeT Align, bool IsInternal,
bool IsConst, bool IsZeroInitializer, SizeT Size,
const char *Data, bool DisableTranslation);
void lower(const IceString &Name, SizeT Align, bool IsInternal, bool IsConst,
bool IsZeroInitializer, SizeT Size, const char *Data,
bool DisableTranslation) override;
protected:
TargetGlobalInitX8632(GlobalContext *Ctx);
......@@ -497,7 +497,7 @@ private:
TargetGlobalInitX8632(const TargetGlobalInitX8632 &) LLVM_DELETED_FUNCTION;
TargetGlobalInitX8632 &
operator=(const TargetGlobalInitX8632 &) LLVM_DELETED_FUNCTION;
virtual ~TargetGlobalInitX8632() {}
~TargetGlobalInitX8632() override {}
};
template <> void ConstantInteger32::emit(GlobalContext *Ctx) const;
......
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