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
......@@ -30,6 +30,10 @@
namespace Ice {
// Base instruction class for ICE. Inst has two subclasses:
// InstHighLevel and InstTarget. High-level ICE instructions inherit
// from InstHighLevel, and low-level (target-specific) ICE
// instructions inherit from InstTarget.
class Inst {
public:
enum InstKind {
......@@ -103,8 +107,8 @@ public:
// result in any native instructions, and a target-specific
// instruction results in a single native instruction.
virtual uint32_t getEmitInstCount() const { return 0; }
virtual void emit(const Cfg *Func) const;
virtual void emitIAS(const Cfg *Func) const;
virtual void emit(const Cfg *Func) const = 0;
virtual void emitIAS(const Cfg *Func) const = 0;
virtual void dump(const Cfg *Func) const;
virtual void dumpExtras(const Cfg *Func) const;
void dumpDecorated(const Cfg *Func) const;
......@@ -165,10 +169,26 @@ private:
Inst &operator=(const Inst &) LLVM_DELETED_FUNCTION;
};
class InstHighLevel : public Inst {
InstHighLevel(const InstHighLevel &) LLVM_DELETED_FUNCTION;
InstHighLevel &operator=(const InstHighLevel &) LLVM_DELETED_FUNCTION;
protected:
InstHighLevel(Cfg *Func, InstKind Kind, SizeT MaxSrcs, Variable *Dest)
: Inst(Func, Kind, MaxSrcs, Dest) {}
void emit(const Cfg * /*Func*/) const override {
llvm_unreachable("emit() called on a non-lowered instruction");
}
void emitIAS(const Cfg * /*Func*/) const override {
llvm_unreachable("emitIAS() called on a non-lowered instruction");
}
~InstHighLevel() override {}
};
// Alloca instruction. This captures the size in bytes as getSrc(0),
// and the required alignment in bytes. The alignment must be either
// 0 (no alignment required) or a power of 2.
class InstAlloca : public Inst {
class InstAlloca : public InstHighLevel {
public:
static InstAlloca *create(Cfg *Func, Operand *ByteCount,
uint32_t AlignInBytes, Variable *Dest) {
......@@ -177,7 +197,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,13 +205,13 @@ private:
Variable *Dest);
InstAlloca(const InstAlloca &) LLVM_DELETED_FUNCTION;
InstAlloca &operator=(const InstAlloca &) LLVM_DELETED_FUNCTION;
virtual ~InstAlloca() {}
~InstAlloca() override {}
const uint32_t AlignInBytes;
};
// Binary arithmetic instruction. The source operands are captured in
// getSrc(0) and getSrc(1).
class InstArithmetic : public Inst {
class InstArithmetic : public InstHighLevel {
public:
enum OpKind {
#define X(tag, str, commutative) tag,
......@@ -208,7 +228,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 +238,7 @@ private:
Operand *Source2);
InstArithmetic(const InstArithmetic &) LLVM_DELETED_FUNCTION;
InstArithmetic &operator=(const InstArithmetic &) LLVM_DELETED_FUNCTION;
virtual ~InstArithmetic() {}
~InstArithmetic() override {}
const OpKind Op;
};
......@@ -229,26 +249,26 @@ private:
// lowering happens before target lowering, or for representing an
// Inttoptr instruction, or as an intermediate step for lowering a
// Load instruction.
class InstAssign : public Inst {
class InstAssign : public InstHighLevel {
public:
static InstAssign *create(Cfg *Func, Variable *Dest, Operand *Source) {
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
// unconditional branches.
class InstBr : public Inst {
class InstBr : public InstHighLevel {
public:
// Create a conditional branch. If TargetTrue==TargetFalse, it is
// optimized to an unconditional branch.
......@@ -272,8 +292,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 +303,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
......@@ -291,7 +311,7 @@ private:
// Call instruction. The call target is captured as getSrc(0), and
// arg I is captured as getSrc(I+1).
class InstCall : public Inst {
class InstCall : public InstHighLevel {
public:
static InstCall *create(Cfg *Func, SizeT NumArgs, Variable *Dest,
Operand *CallTarget, bool HasTailCall) {
......@@ -308,19 +328,18 @@ 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;
protected:
InstCall(Cfg *Func, SizeT NumArgs, Variable *Dest, Operand *CallTarget,
bool HasTailCall, bool HasSideEff, InstKind Kind)
: Inst(Func, Kind, NumArgs + 1, Dest),
HasTailCall(HasTailCall) {
: InstHighLevel(Func, Kind, NumArgs + 1, Dest), HasTailCall(HasTailCall) {
HasSideEffects = HasSideEff;
addSource(CallTarget);
}
virtual ~InstCall() {}
~InstCall() override {}
private:
bool HasTailCall;
......@@ -329,7 +348,7 @@ private:
};
// Cast instruction (a.k.a. conversion operation).
class InstCast : public Inst {
class InstCast : public InstHighLevel {
public:
enum OpKind {
#define X(tag, str) tag,
......@@ -344,19 +363,19 @@ 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;
};
// ExtractElement instruction.
class InstExtractElement : public Inst {
class InstExtractElement : public InstHighLevel {
public:
static InstExtractElement *create(Cfg *Func, Variable *Dest, Operand *Source1,
Operand *Source2) {
......@@ -364,7 +383,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,12 +394,12 @@ 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
// captured in getSrc(0) and getSrc(1).
class InstFcmp : public Inst {
class InstFcmp : public InstHighLevel {
public:
enum FCond {
#define X(tag, str) tag,
......@@ -395,7 +414,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,13 +422,13 @@ private:
Operand *Source2);
InstFcmp(const InstFcmp &) LLVM_DELETED_FUNCTION;
InstFcmp &operator=(const InstFcmp &) LLVM_DELETED_FUNCTION;
virtual ~InstFcmp() {}
~InstFcmp() override {}
const FCond Condition;
};
// Integer comparison instruction. The source operands are captured
// in getSrc(0) and getSrc(1).
class InstIcmp : public Inst {
class InstIcmp : public InstHighLevel {
public:
enum ICond {
#define X(tag, str) tag,
......@@ -424,7 +443,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,12 +451,12 @@ private:
Operand *Source2);
InstIcmp(const InstIcmp &) LLVM_DELETED_FUNCTION;
InstIcmp &operator=(const InstIcmp &) LLVM_DELETED_FUNCTION;
virtual ~InstIcmp() {}
~InstIcmp() override {}
const ICond Condition;
};
// InsertElement instruction.
class InstInsertElement : public Inst {
class InstInsertElement : public InstHighLevel {
public:
static InstInsertElement *create(Cfg *Func, Variable *Dest, Operand *Source1,
Operand *Source2, Operand *Source3) {
......@@ -445,7 +464,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 +474,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,12 +501,12 @@ private:
Info(Info) {}
InstIntrinsicCall(const InstIntrinsicCall &) LLVM_DELETED_FUNCTION;
InstIntrinsicCall &operator=(const InstIntrinsicCall &) LLVM_DELETED_FUNCTION;
virtual ~InstIntrinsicCall() {}
~InstIntrinsicCall() override {}
const Intrinsics::IntrinsicInfo Info;
};
// Load instruction. The source address is captured in getSrc(0).
class InstLoad : public Inst {
class InstLoad : public InstHighLevel {
public:
static InstLoad *create(Cfg *Func, Variable *Dest, Operand *SourceAddr,
uint32_t align = 1) {
......@@ -497,19 +516,19 @@ 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
// the Phi source operand is getSrc(I).
class InstPhi : public Inst {
class InstPhi : public InstHighLevel {
public:
static InstPhi *create(Cfg *Func, SizeT MaxSrcs, Variable *Dest) {
return new (Func->allocateInst<InstPhi>()) InstPhi(Func, MaxSrcs, Dest);
......@@ -519,18 +538,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[]
......@@ -541,7 +560,7 @@ private:
// Ret instruction. The return value is captured in getSrc(0), but if
// there is no return value (void-type function), then
// getSrcSize()==0 and hasRetValue()==false.
class InstRet : public Inst {
class InstRet : public InstHighLevel {
public:
static InstRet *create(Cfg *Func, Operand *RetValue = NULL) {
return new (Func->allocateInst<InstRet>()) InstRet(Func, RetValue);
......@@ -551,19 +570,19 @@ 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.
class InstSelect : public Inst {
class InstSelect : public InstHighLevel {
public:
static InstSelect *create(Cfg *Func, Variable *Dest, Operand *Condition,
Operand *SourceTrue, Operand *SourceFalse) {
......@@ -573,7 +592,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,12 +600,12 @@ 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
// data operand to be stored into the address.
class InstStore : public Inst {
class InstStore : public InstHighLevel {
public:
static InstStore *create(Cfg *Func, Operand *Data, Operand *Addr,
uint32_t align = 1) {
......@@ -596,19 +615,19 @@ 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
// getSrc(0).
class InstSwitch : public Inst {
class InstSwitch : public InstHighLevel {
public:
static InstSwitch *create(Cfg *Func, SizeT NumCases, Operand *Source,
CfgNode *LabelDefault) {
......@@ -627,20 +646,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
......@@ -650,13 +669,13 @@ private:
// Unreachable instruction. This is a terminator instruction with no
// operands.
class InstUnreachable : public Inst {
class InstUnreachable : public InstHighLevel {
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 +684,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,
......@@ -680,20 +699,21 @@ private:
// dest. Otherwise, the original instruction could be dead-code
// eliminated if its dest operand is unused, and therefore the FakeDef
// dest wouldn't be properly initialized.
class InstFakeDef : public Inst {
class InstFakeDef : public InstHighLevel {
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 emitIAS(const Cfg *Func) const override { emit(Func); }
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
......@@ -701,20 +721,21 @@ private:
// dead-code eliminated. This is useful in a variety of lowering
// situations. The FakeUse instruction has no dest, so it can itself
// never be dead-code eliminated.
class InstFakeUse : public Inst {
class InstFakeUse : public InstHighLevel {
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 emitIAS(const Cfg *Func) const override { emit(Func); }
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
......@@ -726,7 +747,7 @@ private:
// The FakeKill instruction also holds a pointer to the instruction
// that kills the set of variables, so that if that linked instruction
// gets dead-code eliminated, the FakeKill instruction will as well.
class InstFakeKill : public Inst {
class InstFakeKill : public InstHighLevel {
public:
static InstFakeKill *create(Cfg *Func, const VarList &KilledRegs,
const Inst *Linked) {
......@@ -734,15 +755,16 @@ 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 emitIAS(const Cfg *Func) const override { emit(Func); }
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;
......@@ -751,11 +773,12 @@ private:
// The Target instruction is the base class for all target-specific
// instructions.
class InstTarget : public Inst {
InstTarget(const InstTarget &) LLVM_DELETED_FUNCTION;
InstTarget &operator=(const InstTarget &) LLVM_DELETED_FUNCTION;
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 dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return Inst->getKind() >= Target; }
protected:
......@@ -763,9 +786,8 @@ protected:
: Inst(Func, Kind, MaxSrcs, Dest) {
assert(Kind >= Target);
}
InstTarget(const InstTarget &) LLVM_DELETED_FUNCTION;
InstTarget &operator=(const InstTarget &) LLVM_DELETED_FUNCTION;
virtual ~InstTarget() {}
void emitIAS(const Cfg *Func) const override { emit(Func); }
~InstTarget() override {}
};
} // end of namespace Ice
......
......@@ -36,16 +36,15 @@ public:
kMem,
kSplit
};
virtual void emit(const Cfg *Func) const = 0;
using Operand::dump;
virtual void dump(const Cfg *, Ostream &Str) const {
void dump(const Cfg *, Ostream &Str) const override {
Str << "<OperandX8632>";
}
protected:
OperandX8632(OperandKindX8632 Kind, Type Ty)
: Operand(static_cast<OperandKind>(Kind), Ty) {}
virtual ~OperandX8632() {}
~OperandX8632() override {}
private:
OperandX8632(const OperandX8632 &) LLVM_DELETED_FUNCTION;
......@@ -77,9 +76,9 @@ public:
uint16_t getShift() const { return Shift; }
SegmentRegisters getSegmentRegister() const { return SegmentReg; }
x86::Address toAsmAddress(Assembler *Asm) const;
virtual void emit(const Cfg *Func) const;
void emit(const Cfg *Func) const override;
using OperandX8632::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) {
return Operand->getKind() == static_cast<OperandKind>(kMem);
......@@ -90,7 +89,7 @@ private:
Variable *Index, uint16_t Shift, SegmentRegisters SegmentReg);
OperandX8632Mem(const OperandX8632Mem &) LLVM_DELETED_FUNCTION;
OperandX8632Mem &operator=(const OperandX8632Mem &) LLVM_DELETED_FUNCTION;
virtual ~OperandX8632Mem() {}
~OperandX8632Mem() override {}
Variable *Base;
Constant *Offset;
Variable *Index;
......@@ -113,9 +112,9 @@ public:
static VariableSplit *create(Cfg *Func, Variable *Var, Portion Part) {
return new (Func->allocate<VariableSplit>()) VariableSplit(Func, Var, Part);
}
virtual void emit(const Cfg *Func) const;
void emit(const Cfg *Func) const override;
using OperandX8632::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) {
return Operand->getKind() == static_cast<OperandKind>(kSplit);
......@@ -131,7 +130,7 @@ private:
}
VariableSplit(const VariableSplit &) LLVM_DELETED_FUNCTION;
VariableSplit &operator=(const VariableSplit &) LLVM_DELETED_FUNCTION;
virtual ~VariableSplit() { Func->deallocateArrayOf<Variable *>(Vars); }
~VariableSplit() override { Func->deallocateArrayOf<Variable *>(Vars); }
Cfg *Func; // Held only for the destructor.
Variable *Var;
Portion Part;
......@@ -253,13 +252,12 @@ public:
};
static const char *getWidthString(Type Ty);
virtual void emit(const Cfg *Func) const = 0;
virtual void dump(const Cfg *Func) const;
void dump(const Cfg *Func) const override;
protected:
InstX8632(Cfg *Func, InstKindX8632 Kind, SizeT Maxsrcs, Variable *Dest)
: InstTarget(Func, static_cast<InstKind>(Kind), Maxsrcs, Dest) {}
virtual ~InstX8632() {}
~InstX8632() override {}
static bool isClassof(const Inst *Inst, InstKindX8632 MyKind) {
return Inst->getKind() == static_cast<InstKind>(MyKind);
}
......@@ -311,16 +309,16 @@ public:
static InstX8632Label *create(Cfg *Func, TargetX8632 *Target) {
return new (Func->allocate<InstX8632Label>()) InstX8632Label(Func, Target);
}
virtual uint32_t getEmitInstCount() const { return 0; }
uint32_t getEmitInstCount() const override { return 0; }
IceString getName(const Cfg *Func) const;
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;
private:
InstX8632Label(Cfg *Func, TargetX8632 *Target);
InstX8632Label(const InstX8632Label &) LLVM_DELETED_FUNCTION;
InstX8632Label &operator=(const InstX8632Label &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Label() {}
~InstX8632Label() override {}
SizeT Number; // used only for unique label string generation
};
......@@ -363,7 +361,7 @@ public:
const CfgNode *getTargetTrue() const { return TargetTrue; }
const CfgNode *getTargetFalse() const { return TargetFalse; }
bool optimizeBranch(const CfgNode *NextNode);
virtual uint32_t getEmitInstCount() const {
uint32_t getEmitInstCount() const override {
uint32_t Sum = 0;
if (Label)
++Sum;
......@@ -373,8 +371,8 @@ public:
++Sum;
return Sum;
}
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 isClassof(Inst, Br); }
private:
......@@ -382,7 +380,7 @@ private:
const InstX8632Label *Label, CondX86::BrCond Condition);
InstX8632Br(const InstX8632Br &) LLVM_DELETED_FUNCTION;
InstX8632Br &operator=(const InstX8632Br &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Br() {}
~InstX8632Br() override {}
CondX86::BrCond Condition;
const CfgNode *TargetTrue;
const CfgNode *TargetFalse;
......@@ -397,9 +395,9 @@ public:
return new (Func->allocate<InstX8632AdjustStack>())
InstX8632AdjustStack(Func, Amount, Esp);
}
virtual void emit(const Cfg *Func) const;
virtual void emitIAS(const Cfg *Func) const;
virtual void dump(const Cfg *Func) const;
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return isClassof(Inst, Adjuststack); }
private:
......@@ -418,15 +416,15 @@ public:
InstX8632Call(Func, Dest, CallTarget);
}
Operand *getCallTarget() const { return getSrc(0); }
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 isClassof(Inst, Call); }
private:
InstX8632Call(Cfg *Func, Variable *Dest, Operand *CallTarget);
InstX8632Call(const InstX8632Call &) LLVM_DELETED_FUNCTION;
InstX8632Call &operator=(const InstX8632Call &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Call() {}
~InstX8632Call() override {}
};
// Emit a one-operand (GPR) instruction.
......@@ -441,20 +439,20 @@ public:
return new (Func->allocate<InstX8632InplaceopGPR>())
InstX8632InplaceopGPR(Func, SrcDest);
}
virtual void emit(const Cfg *Func) const {
void emit(const Cfg *Func) const override {
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 1);
Str << "\t" << Opcode << "\t";
getSrc(0)->emit(Func);
Str << "\n";
}
virtual void emitIAS(const Cfg *Func) const {
void emitIAS(const Cfg *Func) const override {
assert(getSrcSize() == 1);
const Variable *Var = getDest();
Type Ty = Var->getType();
emitIASVarTyGPR(Func, Ty, Var, Emitter);
}
virtual void dump(const Cfg *Func) const {
void dump(const Cfg *Func) const override {
Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func);
Str << " = " << Opcode << "." << getDest()->getType() << " ";
......@@ -470,7 +468,7 @@ private:
InstX8632InplaceopGPR(const InstX8632InplaceopGPR &) LLVM_DELETED_FUNCTION;
InstX8632InplaceopGPR &
operator=(const InstX8632InplaceopGPR &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632InplaceopGPR() {}
~InstX8632InplaceopGPR() override {}
static const char *Opcode;
static const x86::AssemblerX86::GPREmitterOneOp Emitter;
};
......@@ -489,7 +487,7 @@ public:
return new (Func->allocate<InstX8632UnaryopGPR>())
InstX8632UnaryopGPR(Func, Dest, Src);
}
virtual void emit(const Cfg *Func) const {
void emit(const Cfg *Func) const override {
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 1);
Str << "\t" << Opcode << "\t";
......@@ -498,14 +496,14 @@ public:
getSrc(0)->emit(Func);
Str << "\n";
}
virtual void emitIAS(const Cfg *Func) const {
void emitIAS(const Cfg *Func) const override {
assert(getSrcSize() == 1);
const Variable *Var = getDest();
Type Ty = Var->getType();
const Operand *Src = getSrc(0);
emitIASRegOpTyGPR(Func, Ty, Var, Src, Emitter);
}
virtual void dump(const Cfg *Func) const {
void dump(const Cfg *Func) const override {
Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func);
Str << " = " << Opcode << "." << getDest()->getType() << " ";
......@@ -521,7 +519,7 @@ private:
InstX8632UnaryopGPR(const InstX8632UnaryopGPR &) LLVM_DELETED_FUNCTION;
InstX8632UnaryopGPR &
operator=(const InstX8632UnaryopGPR &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632UnaryopGPR() {}
~InstX8632UnaryopGPR() override {}
static const char *Opcode;
static const x86::AssemblerX86::GPREmitterRegOp Emitter;
};
......@@ -537,7 +535,7 @@ public:
return new (Func->allocate<InstX8632UnaryopXmm>())
InstX8632UnaryopXmm(Func, Dest, Src);
}
virtual void emit(const Cfg *Func) const {
void emit(const Cfg *Func) const override {
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 1);
Str << "\t" << Opcode << "\t";
......@@ -546,12 +544,12 @@ public:
getSrc(0)->emit(Func);
Str << "\n";
}
virtual void emitIAS(const Cfg *Func) const {
void emitIAS(const Cfg *Func) const override {
Type Ty = getDest()->getType();
assert(getSrcSize() == 1);
emitIASVarOperandTyXMM(Func, Ty, getDest(), getSrc(0), Emitter);
}
virtual void dump(const Cfg *Func) const {
void dump(const Cfg *Func) const override {
Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func);
Str << " = " << Opcode << "." << getDest()->getType() << " ";
......@@ -567,7 +565,7 @@ private:
InstX8632UnaryopXmm(const InstX8632UnaryopXmm &) LLVM_DELETED_FUNCTION;
InstX8632UnaryopXmm &
operator=(const InstX8632UnaryopXmm &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632UnaryopXmm() {}
~InstX8632UnaryopXmm() override {}
static const char *Opcode;
static const x86::AssemblerX86::XmmEmitterTwoOps Emitter;
};
......@@ -585,10 +583,10 @@ public:
return new (Func->allocate<InstX8632Binop>())
InstX8632Binop(Func, Dest, Source);
}
virtual void emit(const Cfg *Func) const {
void emit(const Cfg *Func) const override {
emitTwoAddress(Opcode, this, Func, ShiftHack);
}
virtual void dump(const Cfg *Func) const {
void dump(const Cfg *Func) const override {
Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func);
Str << " = " << Opcode << "." << getDest()->getType() << " ";
......@@ -604,7 +602,7 @@ private:
}
InstX8632Binop(const InstX8632Binop &) LLVM_DELETED_FUNCTION;
InstX8632Binop &operator=(const InstX8632Binop &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Binop() {}
~InstX8632Binop() override {}
static const char *Opcode;
};
......@@ -616,18 +614,18 @@ public:
return new (Func->allocate<InstX8632BinopXmm>())
InstX8632BinopXmm(Func, Dest, Source);
}
virtual void emit(const Cfg *Func) const {
void emit(const Cfg *Func) const override {
const bool ShiftHack = false;
emitTwoAddress(Opcode, this, Func, ShiftHack);
}
virtual void emitIAS(const Cfg *Func) const {
void emitIAS(const Cfg *Func) const override {
Type Ty = getDest()->getType();
if (NeedsElementType)
Ty = typeElementType(Ty);
assert(getSrcSize() == 2);
emitIASVarOperandTyXMM(Func, Ty, getDest(), getSrc(1), Emitter);
}
virtual void dump(const Cfg *Func) const {
void dump(const Cfg *Func) const override {
Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func);
Str << " = " << Opcode << "." << getDest()->getType() << " ";
......@@ -643,7 +641,7 @@ private:
}
InstX8632BinopXmm(const InstX8632BinopXmm &) LLVM_DELETED_FUNCTION;
InstX8632BinopXmm &operator=(const InstX8632BinopXmm &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632BinopXmm() {}
~InstX8632BinopXmm() override {}
static const char *Opcode;
static const x86::AssemblerX86::XmmEmitterTwoOps Emitter;
};
......@@ -656,7 +654,7 @@ public:
return new (Func->allocate<InstX8632Ternop>())
InstX8632Ternop(Func, Dest, Source1, Source2);
}
virtual void emit(const Cfg *Func) const {
void emit(const Cfg *Func) const override {
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 3);
Str << "\t" << Opcode << "\t";
......@@ -667,7 +665,7 @@ public:
getSrc(2)->emit(Func);
Str << "\n";
}
virtual void dump(const Cfg *Func) const {
void dump(const Cfg *Func) const override {
Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func);
Str << " = " << Opcode << "." << getDest()->getType() << " ";
......@@ -684,7 +682,7 @@ private:
}
InstX8632Ternop(const InstX8632Ternop &) LLVM_DELETED_FUNCTION;
InstX8632Ternop &operator=(const InstX8632Ternop &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Ternop() {}
~InstX8632Ternop() override {}
static const char *Opcode;
};
......@@ -697,7 +695,7 @@ public:
return new (Func->allocate<InstX8632ThreeAddressop>())
InstX8632ThreeAddressop(Func, Dest, Source0, Source1);
}
virtual void emit(const Cfg *Func) const {
void emit(const Cfg *Func) const override {
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 2);
Str << "\t" << Opcode << "\t";
......@@ -708,7 +706,7 @@ public:
getSrc(1)->emit(Func);
Str << "\n";
}
virtual void dump(const Cfg *Func) const {
void dump(const Cfg *Func) const override {
Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func);
Str << " = " << Opcode << "." << getDest()->getType() << " ";
......@@ -727,7 +725,7 @@ private:
LLVM_DELETED_FUNCTION;
InstX8632ThreeAddressop &
operator=(const InstX8632ThreeAddressop &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632ThreeAddressop() {}
~InstX8632ThreeAddressop() override {}
static const char *Opcode;
};
......@@ -741,12 +739,12 @@ public:
return new (Func->allocate<InstX8632Movlike>())
InstX8632Movlike(Func, Dest, Source);
}
virtual bool isRedundantAssign() const {
bool isRedundantAssign() const override {
return checkForRedundantAssign(getDest(), getSrc(0));
}
virtual bool isSimpleAssign() const { return true; }
virtual void emit(const Cfg *Func) const;
virtual void dump(const Cfg *Func) const {
bool isSimpleAssign() const override { return true; }
void emit(const Cfg *Func) const override;
void dump(const Cfg *Func) const override {
Ostream &Str = Func->getContext()->getStrDump();
Str << Opcode << "." << getDest()->getType() << " ";
dumpDest(Func);
......@@ -762,7 +760,7 @@ private:
}
InstX8632Movlike(const InstX8632Movlike &) LLVM_DELETED_FUNCTION;
InstX8632Movlike &operator=(const InstX8632Movlike &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Movlike() {}
~InstX8632Movlike() override {}
static const char *Opcode;
};
......@@ -844,7 +842,7 @@ protected:
// with optimizations.
HasSideEffects = Locked;
}
virtual ~InstX8632Lockable() {}
~InstX8632Lockable() override {}
private:
InstX8632Lockable(const InstX8632Lockable &) LLVM_DELETED_FUNCTION;
......@@ -859,15 +857,15 @@ public:
return new (Func->allocate<InstX8632Mul>())
InstX8632Mul(Func, Dest, Source1, Source2);
}
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 isClassof(Inst, Mul); }
private:
InstX8632Mul(Cfg *Func, Variable *Dest, Variable *Source1, Operand *Source2);
InstX8632Mul(const InstX8632Mul &) LLVM_DELETED_FUNCTION;
InstX8632Mul &operator=(const InstX8632Mul &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Mul() {}
~InstX8632Mul() override {}
};
// Shld instruction - shift across a pair of operands. TODO: Verify
......@@ -879,8 +877,8 @@ public:
return new (Func->allocate<InstX8632Shld>())
InstX8632Shld(Func, Dest, Source1, Source2);
}
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 isClassof(Inst, Shld); }
private:
......@@ -888,7 +886,7 @@ private:
Variable *Source2);
InstX8632Shld(const InstX8632Shld &) LLVM_DELETED_FUNCTION;
InstX8632Shld &operator=(const InstX8632Shld &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Shld() {}
~InstX8632Shld() override {}
};
// Shrd instruction - shift across a pair of operands. TODO: Verify
......@@ -900,8 +898,8 @@ public:
return new (Func->allocate<InstX8632Shrd>())
InstX8632Shrd(Func, Dest, Source1, Source2);
}
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 isClassof(Inst, Shrd); }
private:
......@@ -909,7 +907,7 @@ private:
Variable *Source2);
InstX8632Shrd(const InstX8632Shrd &) LLVM_DELETED_FUNCTION;
InstX8632Shrd &operator=(const InstX8632Shrd &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Shrd() {}
~InstX8632Shrd() override {}
};
// Conditional move instruction.
......@@ -920,9 +918,9 @@ public:
return new (Func->allocate<InstX8632Cmov>())
InstX8632Cmov(Func, Dest, Source, Cond);
}
virtual void emit(const Cfg *Func) const;
virtual void emitIAS(const Cfg *Func) const;
virtual void dump(const Cfg *Func) const;
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return isClassof(Inst, Cmov); }
private:
......@@ -930,7 +928,7 @@ private:
CondX86::BrCond Cond);
InstX8632Cmov(const InstX8632Cmov &) LLVM_DELETED_FUNCTION;
InstX8632Cmov &operator=(const InstX8632Cmov &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Cmov() {}
~InstX8632Cmov() override {}
CondX86::BrCond Condition;
};
......@@ -944,9 +942,9 @@ public:
return new (Func->allocate<InstX8632Cmpps>())
InstX8632Cmpps(Func, Dest, Source, Condition);
}
virtual void emit(const Cfg *Func) const;
virtual void emitIAS(const Cfg *Func) const;
virtual void dump(const Cfg *Func) const;
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return isClassof(Inst, Cmpps); }
private:
......@@ -954,7 +952,7 @@ private:
CondX86::CmppsCond Cond);
InstX8632Cmpps(const InstX8632Cmpps &) LLVM_DELETED_FUNCTION;
InstX8632Cmpps &operator=(const InstX8632Cmpps &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Cmpps() {}
~InstX8632Cmpps() override {}
CondX86::CmppsCond Condition;
};
......@@ -971,9 +969,9 @@ public:
return new (Func->allocate<InstX8632Cmpxchg>())
InstX8632Cmpxchg(Func, DestOrAddr, Eax, Desired, Locked);
}
virtual void emit(const Cfg *Func) const;
virtual void emitIAS(const Cfg *Func) const;
virtual void dump(const Cfg *Func) const;
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return isClassof(Inst, Cmpxchg); }
private:
......@@ -981,7 +979,7 @@ private:
Variable *Desired, bool Locked);
InstX8632Cmpxchg(const InstX8632Cmpxchg &) LLVM_DELETED_FUNCTION;
InstX8632Cmpxchg &operator=(const InstX8632Cmpxchg &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Cmpxchg() {}
~InstX8632Cmpxchg() override {}
};
// Cmpxchg8b instruction - cmpxchg8b <m64> will compare if <m64>
......@@ -998,9 +996,9 @@ public:
return new (Func->allocate<InstX8632Cmpxchg8b>())
InstX8632Cmpxchg8b(Func, Dest, Edx, Eax, Ecx, Ebx, Locked);
}
virtual void emit(const Cfg *Func) const;
virtual void emitIAS(const Cfg *Func) const;
virtual void dump(const Cfg *Func) const;
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return isClassof(Inst, Cmpxchg8b); }
private:
......@@ -1009,7 +1007,7 @@ private:
InstX8632Cmpxchg8b(const InstX8632Cmpxchg8b &) LLVM_DELETED_FUNCTION;
InstX8632Cmpxchg8b &
operator=(const InstX8632Cmpxchg8b &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Cmpxchg8b() {}
~InstX8632Cmpxchg8b() override {}
};
// Cvt instruction - wrapper for cvtsX2sY where X and Y are in {s,d,i}
......@@ -1023,8 +1021,8 @@ public:
return new (Func->allocate<InstX8632Cvt>())
InstX8632Cvt(Func, Dest, Source, Trunc);
}
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 isClassof(Inst, Cvt); }
private:
......@@ -1032,7 +1030,7 @@ private:
InstX8632Cvt(Cfg *Func, Variable *Dest, Operand *Source, bool Trunc);
InstX8632Cvt(const InstX8632Cvt &) LLVM_DELETED_FUNCTION;
InstX8632Cvt &operator=(const InstX8632Cvt &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Cvt() {}
~InstX8632Cvt() override {}
};
// cmp - Integer compare instruction.
......@@ -1042,15 +1040,15 @@ public:
return new (Func->allocate<InstX8632Icmp>())
InstX8632Icmp(Func, Src1, Src2);
}
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 isClassof(Inst, Icmp); }
private:
InstX8632Icmp(Cfg *Func, Operand *Src1, Operand *Src2);
InstX8632Icmp(const InstX8632Icmp &) LLVM_DELETED_FUNCTION;
InstX8632Icmp &operator=(const InstX8632Icmp &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Icmp() {}
~InstX8632Icmp() override {}
};
// ucomiss/ucomisd - floating-point compare instruction.
......@@ -1060,16 +1058,16 @@ public:
return new (Func->allocate<InstX8632Ucomiss>())
InstX8632Ucomiss(Func, Src1, Src2);
}
virtual void emit(const Cfg *Func) const;
virtual void emitIAS(const Cfg *Func) const;
virtual void dump(const Cfg *Func) const;
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return isClassof(Inst, Ucomiss); }
private:
InstX8632Ucomiss(Cfg *Func, Operand *Src1, Operand *Src2);
InstX8632Ucomiss(const InstX8632Ucomiss &) LLVM_DELETED_FUNCTION;
InstX8632Ucomiss &operator=(const InstX8632Ucomiss &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Ucomiss() {}
~InstX8632Ucomiss() override {}
};
// UD2 instruction.
......@@ -1078,15 +1076,15 @@ public:
static InstX8632UD2 *create(Cfg *Func) {
return new (Func->allocate<InstX8632UD2>()) InstX8632UD2(Func);
}
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 isClassof(Inst, UD2); }
private:
InstX8632UD2(Cfg *Func);
InstX8632UD2(const InstX8632UD2 &) LLVM_DELETED_FUNCTION;
InstX8632UD2 &operator=(const InstX8632UD2 &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632UD2() {}
~InstX8632UD2() override {}
};
// Test instruction.
......@@ -1096,15 +1094,15 @@ public:
return new (Func->allocate<InstX8632Test>())
InstX8632Test(Func, Source1, Source2);
}
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 isClassof(Inst, Test); }
private:
InstX8632Test(Cfg *Func, Operand *Source1, Operand *Source2);
InstX8632Test(const InstX8632Test &) LLVM_DELETED_FUNCTION;
InstX8632Test &operator=(const InstX8632Test &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Test() {}
~InstX8632Test() override {}
};
// Mfence instruction.
......@@ -1113,15 +1111,15 @@ public:
static InstX8632Mfence *create(Cfg *Func) {
return new (Func->allocate<InstX8632Mfence>()) InstX8632Mfence(Func);
}
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 isClassof(Inst, Mfence); }
private:
InstX8632Mfence(Cfg *Func);
InstX8632Mfence(const InstX8632Mfence &) LLVM_DELETED_FUNCTION;
InstX8632Mfence &operator=(const InstX8632Mfence &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Mfence() {}
~InstX8632Mfence() override {}
};
// This is essentially a "mov" instruction with an OperandX8632Mem
......@@ -1133,15 +1131,15 @@ public:
return new (Func->allocate<InstX8632Store>())
InstX8632Store(Func, Value, Mem);
}
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 isClassof(Inst, Store); }
private:
InstX8632Store(Cfg *Func, Operand *Value, OperandX8632 *Mem);
InstX8632Store(const InstX8632Store &) LLVM_DELETED_FUNCTION;
InstX8632Store &operator=(const InstX8632Store &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Store() {}
~InstX8632Store() override {}
};
class InstX8632StoreP : public InstX8632 {
......@@ -1150,15 +1148,15 @@ public:
return new (Func->allocate<InstX8632StoreP>())
InstX8632StoreP(Func, Value, Mem);
}
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 isClassof(Inst, StoreP); }
private:
InstX8632StoreP(Cfg *Func, Operand *Value, OperandX8632 *Mem);
InstX8632StoreP(const InstX8632StoreP &) LLVM_DELETED_FUNCTION;
InstX8632StoreP &operator=(const InstX8632StoreP &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632StoreP() {}
~InstX8632StoreP() override {}
};
// This is essentially a "movq" instruction with an OperandX8632Mem
......@@ -1170,15 +1168,15 @@ public:
return new (Func->allocate<InstX8632StoreQ>())
InstX8632StoreQ(Func, Value, Mem);
}
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 isClassof(Inst, StoreQ); }
private:
InstX8632StoreQ(Cfg *Func, Operand *Value, OperandX8632 *Mem);
InstX8632StoreQ(const InstX8632StoreQ &) LLVM_DELETED_FUNCTION;
InstX8632StoreQ &operator=(const InstX8632StoreQ &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632StoreQ() {}
~InstX8632StoreQ() override {}
};
// Movsx - copy from a narrower integer type to a wider integer
......@@ -1189,15 +1187,15 @@ public:
return new (Func->allocate<InstX8632Movsx>())
InstX8632Movsx(Func, Dest, Source);
}
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 isClassof(Inst, Movsx); }
private:
InstX8632Movsx(Cfg *Func, Variable *Dest, Operand *Source);
InstX8632Movsx(const InstX8632Movsx &) LLVM_DELETED_FUNCTION;
InstX8632Movsx &operator=(const InstX8632Movsx &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Movsx() {}
~InstX8632Movsx() override {}
};
// Movzx - copy from a narrower integer type to a wider integer
......@@ -1208,15 +1206,15 @@ public:
return new (Func->allocate<InstX8632Movzx>())
InstX8632Movzx(Func, Dest, Source);
}
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 isClassof(Inst, Movzx); }
private:
InstX8632Movzx(Cfg *Func, Variable *Dest, Operand *Source);
InstX8632Movzx(const InstX8632Movzx &) LLVM_DELETED_FUNCTION;
InstX8632Movzx &operator=(const InstX8632Movzx &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Movzx() {}
~InstX8632Movzx() override {}
};
// Nop instructions of varying length
......@@ -1228,16 +1226,16 @@ public:
static InstX8632Nop *create(Cfg *Func, NopVariant Variant) {
return new (Func->allocate<InstX8632Nop>()) InstX8632Nop(Func, Variant);
}
virtual void emit(const Cfg *Func) const;
virtual void emitIAS(const Cfg *Func) const;
virtual void dump(const Cfg *Func) const;
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return isClassof(Inst, Nop); }
private:
InstX8632Nop(Cfg *Func, SizeT Length);
InstX8632Nop(const InstX8632Nop &) LLVM_DELETED_FUNCTION;
InstX8632Nop &operator=(const InstX8632Nop &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Nop() {}
~InstX8632Nop() override {}
NopVariant Variant;
};
......@@ -1248,15 +1246,15 @@ public:
static InstX8632Fld *create(Cfg *Func, Operand *Src) {
return new (Func->allocate<InstX8632Fld>()) InstX8632Fld(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 isClassof(Inst, Fld); }
private:
InstX8632Fld(Cfg *Func, Operand *Src);
InstX8632Fld(const InstX8632Fld &) LLVM_DELETED_FUNCTION;
InstX8632Fld &operator=(const InstX8632Fld &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Fld() {}
~InstX8632Fld() override {}
};
// Fstp - store x87 st(0) into memory and pop st(0).
......@@ -1265,15 +1263,15 @@ public:
static InstX8632Fstp *create(Cfg *Func, Variable *Dest) {
return new (Func->allocate<InstX8632Fstp>()) InstX8632Fstp(Func, Dest);
}
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 isClassof(Inst, Fstp); }
private:
InstX8632Fstp(Cfg *Func, Variable *Dest);
InstX8632Fstp(const InstX8632Fstp &) LLVM_DELETED_FUNCTION;
InstX8632Fstp &operator=(const InstX8632Fstp &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Fstp() {}
~InstX8632Fstp() override {}
};
class InstX8632Pop : public InstX8632 {
......@@ -1281,16 +1279,16 @@ public:
static InstX8632Pop *create(Cfg *Func, Variable *Dest) {
return new (Func->allocate<InstX8632Pop>()) InstX8632Pop(Func, Dest);
}
virtual void emit(const Cfg *Func) const;
virtual void emitIAS(const Cfg *Func) const;
virtual void dump(const Cfg *Func) const;
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return isClassof(Inst, Pop); }
private:
InstX8632Pop(Cfg *Func, Variable *Dest);
InstX8632Pop(const InstX8632Pop &) LLVM_DELETED_FUNCTION;
InstX8632Pop &operator=(const InstX8632Pop &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Pop() {}
~InstX8632Pop() override {}
};
class InstX8632Push : public InstX8632 {
......@@ -1300,8 +1298,8 @@ public:
return new (Func->allocate<InstX8632Push>())
InstX8632Push(Func, Source, SuppressStackAdjustment);
}
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 isClassof(Inst, Push); }
private:
......@@ -1309,7 +1307,7 @@ private:
InstX8632Push(const InstX8632Push &) LLVM_DELETED_FUNCTION;
InstX8632Push &operator=(const InstX8632Push &) LLVM_DELETED_FUNCTION;
bool SuppressStackAdjustment;
virtual ~InstX8632Push() {}
~InstX8632Push() override {}
};
// Ret instruction. Currently only supports the "ret" version that
......@@ -1321,16 +1319,16 @@ public:
static InstX8632Ret *create(Cfg *Func, Variable *Source = NULL) {
return new (Func->allocate<InstX8632Ret>()) InstX8632Ret(Func, Source);
}
virtual void emit(const Cfg *Func) const;
virtual void emitIAS(const Cfg *Func) const;
virtual void dump(const Cfg *Func) const;
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return isClassof(Inst, Ret); }
private:
InstX8632Ret(Cfg *Func, Variable *Source);
InstX8632Ret(const InstX8632Ret &) LLVM_DELETED_FUNCTION;
InstX8632Ret &operator=(const InstX8632Ret &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Ret() {}
~InstX8632Ret() override {}
};
// Exchanging Add instruction. Exchanges the first operand (destination
......@@ -1347,16 +1345,16 @@ public:
return new (Func->allocate<InstX8632Xadd>())
InstX8632Xadd(Func, Dest, Source, Locked);
}
virtual void emit(const Cfg *Func) const;
virtual void emitIAS(const Cfg *Func) const;
virtual void dump(const Cfg *Func) const;
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return isClassof(Inst, Xadd); }
private:
InstX8632Xadd(Cfg *Func, Operand *Dest, Variable *Source, bool Locked);
InstX8632Xadd(const InstX8632Xadd &) LLVM_DELETED_FUNCTION;
InstX8632Xadd &operator=(const InstX8632Xadd &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Xadd() {}
~InstX8632Xadd() override {}
};
// Exchange instruction. Exchanges the first operand (destination
......@@ -1371,16 +1369,16 @@ public:
return new (Func->allocate<InstX8632Xchg>())
InstX8632Xchg(Func, Dest, Source);
}
virtual void emit(const Cfg *Func) const;
virtual void emitIAS(const Cfg *Func) const;
virtual void dump(const Cfg *Func) const;
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return isClassof(Inst, Xchg); }
private:
InstX8632Xchg(Cfg *Func, Operand *Dest, Variable *Source);
InstX8632Xchg(const InstX8632Xchg &) LLVM_DELETED_FUNCTION;
InstX8632Xchg &operator=(const InstX8632Xchg &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Xchg() {}
~InstX8632Xchg() override {}
};
// Declare partial template specializations of emit() methods that
......
......@@ -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