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 { ...@@ -470,11 +470,12 @@ void CfgNode::emit(Cfg *Func) const {
} }
Str << getAsmName() << ":\n"; Str << getAsmName() << ":\n";
for (PhiList::const_iterator I = Phis.begin(), E = Phis.end(); I != E; ++I) { for (PhiList::const_iterator I = Phis.begin(), E = Phis.end(); I != E; ++I) {
InstPhi *Inst = *I; InstPhi *Phi = *I;
if (Inst->isDeleted()) if (Phi->isDeleted())
continue; continue;
// Emitting a Phi instruction should cause an error. // 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; for (InstList::const_iterator I = Insts.begin(), E = Insts.end(); I != E;
++I) { ++I) {
......
...@@ -196,7 +196,7 @@ void Inst::liveness(InstNumberT InstNumber, llvm::BitVector &Live, ...@@ -196,7 +196,7 @@ void Inst::liveness(InstNumberT InstNumber, llvm::BitVector &Live,
InstAlloca::InstAlloca(Cfg *Func, Operand *ByteCount, uint32_t AlignInBytes, InstAlloca::InstAlloca(Cfg *Func, Operand *ByteCount, uint32_t AlignInBytes,
Variable *Dest) 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. // Verify AlignInBytes is 0 or a power of 2.
assert(AlignInBytes == 0 || llvm::isPowerOf2_32(AlignInBytes)); assert(AlignInBytes == 0 || llvm::isPowerOf2_32(AlignInBytes));
addSource(ByteCount); addSource(ByteCount);
...@@ -204,7 +204,7 @@ InstAlloca::InstAlloca(Cfg *Func, Operand *ByteCount, uint32_t AlignInBytes, ...@@ -204,7 +204,7 @@ InstAlloca::InstAlloca(Cfg *Func, Operand *ByteCount, uint32_t AlignInBytes,
InstArithmetic::InstArithmetic(Cfg *Func, OpKind Op, Variable *Dest, InstArithmetic::InstArithmetic(Cfg *Func, OpKind Op, Variable *Dest,
Operand *Source1, Operand *Source2) Operand *Source1, Operand *Source2)
: Inst(Func, Inst::Arithmetic, 2, Dest), Op(Op) { : InstHighLevel(Func, Inst::Arithmetic, 2, Dest), Op(Op) {
addSource(Source1); addSource(Source1);
addSource(Source2); addSource(Source2);
} }
...@@ -221,7 +221,7 @@ bool InstArithmetic::isCommutative() const { ...@@ -221,7 +221,7 @@ bool InstArithmetic::isCommutative() const {
} }
InstAssign::InstAssign(Cfg *Func, Variable *Dest, Operand *Source) InstAssign::InstAssign(Cfg *Func, Variable *Dest, Operand *Source)
: Inst(Func, Inst::Assign, 1, Dest) { : InstHighLevel(Func, Inst::Assign, 1, Dest) {
addSource(Source); addSource(Source);
} }
...@@ -230,7 +230,7 @@ InstAssign::InstAssign(Cfg *Func, Variable *Dest, Operand *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. // semantics, there is at most one edge from one node to another.
InstBr::InstBr(Cfg *Func, Operand *Source, CfgNode *TargetTrue, InstBr::InstBr(Cfg *Func, Operand *Source, CfgNode *TargetTrue,
CfgNode *TargetFalse) CfgNode *TargetFalse)
: Inst(Func, Inst::Br, 1, NULL), TargetFalse(TargetFalse), : InstHighLevel(Func, Inst::Br, 1, NULL), TargetFalse(TargetFalse),
TargetTrue(TargetTrue) { TargetTrue(TargetTrue) {
if (TargetTrue == TargetFalse) { if (TargetTrue == TargetFalse) {
TargetTrue = NULL; // turn into unconditional version TargetTrue = NULL; // turn into unconditional version
...@@ -240,7 +240,8 @@ InstBr::InstBr(Cfg *Func, Operand *Source, CfgNode *TargetTrue, ...@@ -240,7 +240,8 @@ InstBr::InstBr(Cfg *Func, Operand *Source, CfgNode *TargetTrue,
} }
InstBr::InstBr(Cfg *Func, CfgNode *Target) 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 InstBr::getTerminatorEdges() const {
NodeList OutEdges; NodeList OutEdges;
...@@ -251,27 +252,27 @@ NodeList InstBr::getTerminatorEdges() const { ...@@ -251,27 +252,27 @@ NodeList InstBr::getTerminatorEdges() const {
} }
InstCast::InstCast(Cfg *Func, OpKind CastKind, Variable *Dest, Operand *Source) 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); addSource(Source);
} }
InstExtractElement::InstExtractElement(Cfg *Func, Variable *Dest, InstExtractElement::InstExtractElement(Cfg *Func, Variable *Dest,
Operand *Source1, Operand *Source2) Operand *Source1, Operand *Source2)
: Inst(Func, Inst::ExtractElement, 2, Dest) { : InstHighLevel(Func, Inst::ExtractElement, 2, Dest) {
addSource(Source1); addSource(Source1);
addSource(Source2); addSource(Source2);
} }
InstFcmp::InstFcmp(Cfg *Func, FCond Condition, Variable *Dest, Operand *Source1, InstFcmp::InstFcmp(Cfg *Func, FCond Condition, Variable *Dest, Operand *Source1,
Operand *Source2) Operand *Source2)
: Inst(Func, Inst::Fcmp, 2, Dest), Condition(Condition) { : InstHighLevel(Func, Inst::Fcmp, 2, Dest), Condition(Condition) {
addSource(Source1); addSource(Source1);
addSource(Source2); addSource(Source2);
} }
InstIcmp::InstIcmp(Cfg *Func, ICond Condition, Variable *Dest, Operand *Source1, InstIcmp::InstIcmp(Cfg *Func, ICond Condition, Variable *Dest, Operand *Source1,
Operand *Source2) Operand *Source2)
: Inst(Func, Inst::Icmp, 2, Dest), Condition(Condition) { : InstHighLevel(Func, Inst::Icmp, 2, Dest), Condition(Condition) {
addSource(Source1); addSource(Source1);
addSource(Source2); addSource(Source2);
} }
...@@ -279,19 +280,19 @@ InstIcmp::InstIcmp(Cfg *Func, ICond Condition, Variable *Dest, Operand *Source1, ...@@ -279,19 +280,19 @@ InstIcmp::InstIcmp(Cfg *Func, ICond Condition, Variable *Dest, Operand *Source1,
InstInsertElement::InstInsertElement(Cfg *Func, Variable *Dest, InstInsertElement::InstInsertElement(Cfg *Func, Variable *Dest,
Operand *Source1, Operand *Source2, Operand *Source1, Operand *Source2,
Operand *Source3) Operand *Source3)
: Inst(Func, Inst::InsertElement, 3, Dest) { : InstHighLevel(Func, Inst::InsertElement, 3, Dest) {
addSource(Source1); addSource(Source1);
addSource(Source2); addSource(Source2);
addSource(Source3); addSource(Source3);
} }
InstLoad::InstLoad(Cfg *Func, Variable *Dest, Operand *SourceAddr) InstLoad::InstLoad(Cfg *Func, Variable *Dest, Operand *SourceAddr)
: Inst(Func, Inst::Load, 1, Dest) { : InstHighLevel(Func, Inst::Load, 1, Dest) {
addSource(SourceAddr); addSource(SourceAddr);
} }
InstPhi::InstPhi(Cfg *Func, SizeT MaxSrcs, Variable *Dest) InstPhi::InstPhi(Cfg *Func, SizeT MaxSrcs, Variable *Dest)
: Inst(Func, Phi, MaxSrcs, Dest) { : InstHighLevel(Func, Phi, MaxSrcs, Dest) {
Labels = Func->allocateArrayOf<CfgNode *>(MaxSrcs); Labels = Func->allocateArrayOf<CfgNode *>(MaxSrcs);
} }
...@@ -350,14 +351,14 @@ Inst *InstPhi::lower(Cfg *Func) { ...@@ -350,14 +351,14 @@ Inst *InstPhi::lower(Cfg *Func) {
} }
InstRet::InstRet(Cfg *Func, Operand *RetValue) InstRet::InstRet(Cfg *Func, Operand *RetValue)
: Inst(Func, Ret, RetValue ? 1 : 0, NULL) { : InstHighLevel(Func, Ret, RetValue ? 1 : 0, NULL) {
if (RetValue) if (RetValue)
addSource(RetValue); addSource(RetValue);
} }
InstSelect::InstSelect(Cfg *Func, Variable *Dest, Operand *Condition, InstSelect::InstSelect(Cfg *Func, Variable *Dest, Operand *Condition,
Operand *SourceTrue, Operand *SourceFalse) Operand *SourceTrue, Operand *SourceFalse)
: Inst(Func, Inst::Select, 3, Dest) { : InstHighLevel(Func, Inst::Select, 3, Dest) {
assert(typeElementType(Condition->getType()) == IceType_i1); assert(typeElementType(Condition->getType()) == IceType_i1);
addSource(Condition); addSource(Condition);
addSource(SourceTrue); addSource(SourceTrue);
...@@ -365,14 +366,14 @@ InstSelect::InstSelect(Cfg *Func, Variable *Dest, Operand *Condition, ...@@ -365,14 +366,14 @@ InstSelect::InstSelect(Cfg *Func, Variable *Dest, Operand *Condition,
} }
InstStore::InstStore(Cfg *Func, Operand *Data, Operand *Addr) InstStore::InstStore(Cfg *Func, Operand *Data, Operand *Addr)
: Inst(Func, Inst::Store, 2, NULL) { : InstHighLevel(Func, Inst::Store, 2, NULL) {
addSource(Data); addSource(Data);
addSource(Addr); addSource(Addr);
} }
InstSwitch::InstSwitch(Cfg *Func, SizeT NumCases, Operand *Source, InstSwitch::InstSwitch(Cfg *Func, SizeT NumCases, Operand *Source,
CfgNode *LabelDefault) CfgNode *LabelDefault)
: Inst(Func, Inst::Switch, 1, NULL), LabelDefault(LabelDefault), : InstHighLevel(Func, Inst::Switch, 1, NULL), LabelDefault(LabelDefault),
NumCases(NumCases) { NumCases(NumCases) {
addSource(Source); addSource(Source);
Values = Func->allocateArrayOf<uint64_t>(NumCases); Values = Func->allocateArrayOf<uint64_t>(NumCases);
...@@ -400,24 +401,25 @@ NodeList InstSwitch::getTerminatorEdges() const { ...@@ -400,24 +401,25 @@ NodeList InstSwitch::getTerminatorEdges() const {
} }
InstUnreachable::InstUnreachable(Cfg *Func) InstUnreachable::InstUnreachable(Cfg *Func)
: Inst(Func, Inst::Unreachable, 0, NULL) {} : InstHighLevel(Func, Inst::Unreachable, 0, NULL) {}
InstFakeDef::InstFakeDef(Cfg *Func, Variable *Dest, Variable *Src) 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); assert(Dest);
if (Src) if (Src)
addSource(Src); addSource(Src);
} }
InstFakeUse::InstFakeUse(Cfg *Func, Variable *Src) InstFakeUse::InstFakeUse(Cfg *Func, Variable *Src)
: Inst(Func, Inst::FakeUse, 1, NULL) { : InstHighLevel(Func, Inst::FakeUse, 1, NULL) {
assert(Src); assert(Src);
addSource(Src); addSource(Src);
} }
InstFakeKill::InstFakeKill(Cfg *Func, const VarList &KilledRegs, InstFakeKill::InstFakeKill(Cfg *Func, const VarList &KilledRegs,
const Inst *Linked) 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(); for (VarList::const_iterator I = KilledRegs.begin(), E = KilledRegs.end();
I != E; ++I) { I != E; ++I) {
Variable *Var = *I; Variable *Var = *I;
...@@ -449,12 +451,6 @@ void Inst::dumpDecorated(const Cfg *Func) const { ...@@ -449,12 +451,6 @@ void Inst::dumpDecorated(const Cfg *Func) const {
Str << "\n"; 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 { void Inst::dump(const Cfg *Func) const {
Ostream &Str = Func->getContext()->getStrDump(); Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func); dumpDest(Func);
...@@ -754,6 +750,4 @@ void InstTarget::dump(const Cfg *Func) const { ...@@ -754,6 +750,4 @@ void InstTarget::dump(const Cfg *Func) const {
Inst::dump(Func); Inst::dump(Func);
} }
void InstTarget::dumpExtras(const Cfg *Func) const { Inst::dumpExtras(Func); }
} // end of namespace Ice } // end of namespace Ice
...@@ -30,6 +30,10 @@ ...@@ -30,6 +30,10 @@
namespace Ice { 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 { class Inst {
public: public:
enum InstKind { enum InstKind {
...@@ -103,8 +107,8 @@ public: ...@@ -103,8 +107,8 @@ public:
// result in any native instructions, and a target-specific // result in any native instructions, and a target-specific
// instruction results in a single native instruction. // instruction results in a single native instruction.
virtual uint32_t getEmitInstCount() const { return 0; } virtual uint32_t getEmitInstCount() const { return 0; }
virtual void emit(const Cfg *Func) const; virtual void emit(const Cfg *Func) const = 0;
virtual void emitIAS(const Cfg *Func) const; virtual void emitIAS(const Cfg *Func) const = 0;
virtual void dump(const Cfg *Func) const; virtual void dump(const Cfg *Func) const;
virtual void dumpExtras(const Cfg *Func) const; virtual void dumpExtras(const Cfg *Func) const;
void dumpDecorated(const Cfg *Func) const; void dumpDecorated(const Cfg *Func) const;
...@@ -165,10 +169,26 @@ private: ...@@ -165,10 +169,26 @@ private:
Inst &operator=(const Inst &) LLVM_DELETED_FUNCTION; 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), // Alloca instruction. This captures the size in bytes as getSrc(0),
// and the required alignment in bytes. The alignment must be either // and the required alignment in bytes. The alignment must be either
// 0 (no alignment required) or a power of 2. // 0 (no alignment required) or a power of 2.
class InstAlloca : public Inst { class InstAlloca : public InstHighLevel {
public: public:
static InstAlloca *create(Cfg *Func, Operand *ByteCount, static InstAlloca *create(Cfg *Func, Operand *ByteCount,
uint32_t AlignInBytes, Variable *Dest) { uint32_t AlignInBytes, Variable *Dest) {
...@@ -177,7 +197,7 @@ public: ...@@ -177,7 +197,7 @@ public:
} }
uint32_t getAlignInBytes() const { return AlignInBytes; } uint32_t getAlignInBytes() const { return AlignInBytes; }
Operand *getSizeInBytes() const { return getSrc(0); } 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; } static bool classof(const Inst *Inst) { return Inst->getKind() == Alloca; }
private: private:
...@@ -185,13 +205,13 @@ private: ...@@ -185,13 +205,13 @@ private:
Variable *Dest); Variable *Dest);
InstAlloca(const InstAlloca &) LLVM_DELETED_FUNCTION; InstAlloca(const InstAlloca &) LLVM_DELETED_FUNCTION;
InstAlloca &operator=(const InstAlloca &) LLVM_DELETED_FUNCTION; InstAlloca &operator=(const InstAlloca &) LLVM_DELETED_FUNCTION;
virtual ~InstAlloca() {} ~InstAlloca() override {}
const uint32_t AlignInBytes; const uint32_t AlignInBytes;
}; };
// Binary arithmetic instruction. The source operands are captured in // Binary arithmetic instruction. The source operands are captured in
// getSrc(0) and getSrc(1). // getSrc(0) and getSrc(1).
class InstArithmetic : public Inst { class InstArithmetic : public InstHighLevel {
public: public:
enum OpKind { enum OpKind {
#define X(tag, str, commutative) tag, #define X(tag, str, commutative) tag,
...@@ -208,7 +228,7 @@ public: ...@@ -208,7 +228,7 @@ public:
OpKind getOp() const { return Op; } OpKind getOp() const { return Op; }
static const char *getOpName(OpKind Op); static const char *getOpName(OpKind Op);
bool isCommutative() const; bool isCommutative() const;
virtual void dump(const Cfg *Func) const; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { static bool classof(const Inst *Inst) {
return Inst->getKind() == Arithmetic; return Inst->getKind() == Arithmetic;
} }
...@@ -218,7 +238,7 @@ private: ...@@ -218,7 +238,7 @@ private:
Operand *Source2); Operand *Source2);
InstArithmetic(const InstArithmetic &) LLVM_DELETED_FUNCTION; InstArithmetic(const InstArithmetic &) LLVM_DELETED_FUNCTION;
InstArithmetic &operator=(const InstArithmetic &) LLVM_DELETED_FUNCTION; InstArithmetic &operator=(const InstArithmetic &) LLVM_DELETED_FUNCTION;
virtual ~InstArithmetic() {} ~InstArithmetic() override {}
const OpKind Op; const OpKind Op;
}; };
...@@ -229,26 +249,26 @@ private: ...@@ -229,26 +249,26 @@ private:
// lowering happens before target lowering, or for representing an // lowering happens before target lowering, or for representing an
// Inttoptr instruction, or as an intermediate step for lowering a // Inttoptr instruction, or as an intermediate step for lowering a
// Load instruction. // Load instruction.
class InstAssign : public Inst { class InstAssign : public InstHighLevel {
public: public:
static InstAssign *create(Cfg *Func, Variable *Dest, Operand *Source) { static InstAssign *create(Cfg *Func, Variable *Dest, Operand *Source) {
return new (Func->allocateInst<InstAssign>()) return new (Func->allocateInst<InstAssign>())
InstAssign(Func, Dest, Source); InstAssign(Func, Dest, Source);
} }
virtual bool isSimpleAssign() const { return true; } bool isSimpleAssign() const override { return true; }
virtual void dump(const Cfg *Func) const; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return Inst->getKind() == Assign; } static bool classof(const Inst *Inst) { return Inst->getKind() == Assign; }
private: private:
InstAssign(Cfg *Func, Variable *Dest, Operand *Source); InstAssign(Cfg *Func, Variable *Dest, Operand *Source);
InstAssign(const InstAssign &) LLVM_DELETED_FUNCTION; InstAssign(const InstAssign &) LLVM_DELETED_FUNCTION;
InstAssign &operator=(const InstAssign &) LLVM_DELETED_FUNCTION; InstAssign &operator=(const InstAssign &) LLVM_DELETED_FUNCTION;
virtual ~InstAssign() {} ~InstAssign() override {}
}; };
// Branch instruction. This represents both conditional and // Branch instruction. This represents both conditional and
// unconditional branches. // unconditional branches.
class InstBr : public Inst { class InstBr : public InstHighLevel {
public: public:
// Create a conditional branch. If TargetTrue==TargetFalse, it is // Create a conditional branch. If TargetTrue==TargetFalse, it is
// optimized to an unconditional branch. // optimized to an unconditional branch.
...@@ -272,8 +292,8 @@ public: ...@@ -272,8 +292,8 @@ public:
assert(isUnconditional()); assert(isUnconditional());
return getTargetFalse(); return getTargetFalse();
} }
virtual NodeList getTerminatorEdges() const; NodeList getTerminatorEdges() const override;
virtual void dump(const Cfg *Func) const; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return Inst->getKind() == Br; } static bool classof(const Inst *Inst) { return Inst->getKind() == Br; }
private: private:
...@@ -283,7 +303,7 @@ private: ...@@ -283,7 +303,7 @@ private:
InstBr(Cfg *Func, CfgNode *Target); InstBr(Cfg *Func, CfgNode *Target);
InstBr(const InstBr &) LLVM_DELETED_FUNCTION; InstBr(const InstBr &) LLVM_DELETED_FUNCTION;
InstBr &operator=(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 TargetFalse; // Doubles as unconditional branch target
CfgNode *const TargetTrue; // NULL if unconditional branch CfgNode *const TargetTrue; // NULL if unconditional branch
...@@ -291,7 +311,7 @@ private: ...@@ -291,7 +311,7 @@ private:
// Call instruction. The call target is captured as getSrc(0), and // Call instruction. The call target is captured as getSrc(0), and
// arg I is captured as getSrc(I+1). // arg I is captured as getSrc(I+1).
class InstCall : public Inst { class InstCall : public InstHighLevel {
public: public:
static InstCall *create(Cfg *Func, SizeT NumArgs, Variable *Dest, static InstCall *create(Cfg *Func, SizeT NumArgs, Variable *Dest,
Operand *CallTarget, bool HasTailCall) { Operand *CallTarget, bool HasTailCall) {
...@@ -308,19 +328,18 @@ public: ...@@ -308,19 +328,18 @@ public:
Operand *getArg(SizeT I) const { return getSrc(I + 1); } Operand *getArg(SizeT I) const { return getSrc(I + 1); }
SizeT getNumArgs() const { return getSrcSize() - 1; } SizeT getNumArgs() const { return getSrcSize() - 1; }
bool isTailcall() const { return HasTailCall; } 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; } static bool classof(const Inst *Inst) { return Inst->getKind() == Call; }
Type getReturnType() const; Type getReturnType() const;
protected: protected:
InstCall(Cfg *Func, SizeT NumArgs, Variable *Dest, Operand *CallTarget, InstCall(Cfg *Func, SizeT NumArgs, Variable *Dest, Operand *CallTarget,
bool HasTailCall, bool HasSideEff, InstKind Kind) bool HasTailCall, bool HasSideEff, InstKind Kind)
: Inst(Func, Kind, NumArgs + 1, Dest), : InstHighLevel(Func, Kind, NumArgs + 1, Dest), HasTailCall(HasTailCall) {
HasTailCall(HasTailCall) {
HasSideEffects = HasSideEff; HasSideEffects = HasSideEff;
addSource(CallTarget); addSource(CallTarget);
} }
virtual ~InstCall() {} ~InstCall() override {}
private: private:
bool HasTailCall; bool HasTailCall;
...@@ -329,7 +348,7 @@ private: ...@@ -329,7 +348,7 @@ private:
}; };
// Cast instruction (a.k.a. conversion operation). // Cast instruction (a.k.a. conversion operation).
class InstCast : public Inst { class InstCast : public InstHighLevel {
public: public:
enum OpKind { enum OpKind {
#define X(tag, str) tag, #define X(tag, str) tag,
...@@ -344,19 +363,19 @@ public: ...@@ -344,19 +363,19 @@ public:
InstCast(Func, CastKind, Dest, Source); InstCast(Func, CastKind, Dest, Source);
} }
OpKind getCastKind() const { return CastKind; } 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; } static bool classof(const Inst *Inst) { return Inst->getKind() == Cast; }
private: private:
InstCast(Cfg *Func, OpKind CastKind, Variable *Dest, Operand *Source); InstCast(Cfg *Func, OpKind CastKind, Variable *Dest, Operand *Source);
InstCast(const InstCast &) LLVM_DELETED_FUNCTION; InstCast(const InstCast &) LLVM_DELETED_FUNCTION;
InstCast &operator=(const InstCast &) LLVM_DELETED_FUNCTION; InstCast &operator=(const InstCast &) LLVM_DELETED_FUNCTION;
virtual ~InstCast() {} ~InstCast() override {}
const OpKind CastKind; const OpKind CastKind;
}; };
// ExtractElement instruction. // ExtractElement instruction.
class InstExtractElement : public Inst { class InstExtractElement : public InstHighLevel {
public: public:
static InstExtractElement *create(Cfg *Func, Variable *Dest, Operand *Source1, static InstExtractElement *create(Cfg *Func, Variable *Dest, Operand *Source1,
Operand *Source2) { Operand *Source2) {
...@@ -364,7 +383,7 @@ public: ...@@ -364,7 +383,7 @@ public:
InstExtractElement(Func, Dest, Source1, Source2); 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) { static bool classof(const Inst *Inst) {
return Inst->getKind() == ExtractElement; return Inst->getKind() == ExtractElement;
} }
...@@ -375,12 +394,12 @@ private: ...@@ -375,12 +394,12 @@ private:
InstExtractElement(const InstExtractElement &) LLVM_DELETED_FUNCTION; InstExtractElement(const InstExtractElement &) LLVM_DELETED_FUNCTION;
InstExtractElement & InstExtractElement &
operator=(const InstExtractElement &) LLVM_DELETED_FUNCTION; operator=(const InstExtractElement &) LLVM_DELETED_FUNCTION;
virtual ~InstExtractElement() {} ~InstExtractElement() override {}
}; };
// Floating-point comparison instruction. The source operands are // Floating-point comparison instruction. The source operands are
// captured in getSrc(0) and getSrc(1). // captured in getSrc(0) and getSrc(1).
class InstFcmp : public Inst { class InstFcmp : public InstHighLevel {
public: public:
enum FCond { enum FCond {
#define X(tag, str) tag, #define X(tag, str) tag,
...@@ -395,7 +414,7 @@ public: ...@@ -395,7 +414,7 @@ public:
InstFcmp(Func, Condition, Dest, Source1, Source2); InstFcmp(Func, Condition, Dest, Source1, Source2);
} }
FCond getCondition() const { return Condition; } 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; } static bool classof(const Inst *Inst) { return Inst->getKind() == Fcmp; }
private: private:
...@@ -403,13 +422,13 @@ private: ...@@ -403,13 +422,13 @@ private:
Operand *Source2); Operand *Source2);
InstFcmp(const InstFcmp &) LLVM_DELETED_FUNCTION; InstFcmp(const InstFcmp &) LLVM_DELETED_FUNCTION;
InstFcmp &operator=(const InstFcmp &) LLVM_DELETED_FUNCTION; InstFcmp &operator=(const InstFcmp &) LLVM_DELETED_FUNCTION;
virtual ~InstFcmp() {} ~InstFcmp() override {}
const FCond Condition; const FCond Condition;
}; };
// Integer comparison instruction. The source operands are captured // Integer comparison instruction. The source operands are captured
// in getSrc(0) and getSrc(1). // in getSrc(0) and getSrc(1).
class InstIcmp : public Inst { class InstIcmp : public InstHighLevel {
public: public:
enum ICond { enum ICond {
#define X(tag, str) tag, #define X(tag, str) tag,
...@@ -424,7 +443,7 @@ public: ...@@ -424,7 +443,7 @@ public:
InstIcmp(Func, Condition, Dest, Source1, Source2); InstIcmp(Func, Condition, Dest, Source1, Source2);
} }
ICond getCondition() const { return Condition; } 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; } static bool classof(const Inst *Inst) { return Inst->getKind() == Icmp; }
private: private:
...@@ -432,12 +451,12 @@ private: ...@@ -432,12 +451,12 @@ private:
Operand *Source2); Operand *Source2);
InstIcmp(const InstIcmp &) LLVM_DELETED_FUNCTION; InstIcmp(const InstIcmp &) LLVM_DELETED_FUNCTION;
InstIcmp &operator=(const InstIcmp &) LLVM_DELETED_FUNCTION; InstIcmp &operator=(const InstIcmp &) LLVM_DELETED_FUNCTION;
virtual ~InstIcmp() {} ~InstIcmp() override {}
const ICond Condition; const ICond Condition;
}; };
// InsertElement instruction. // InsertElement instruction.
class InstInsertElement : public Inst { class InstInsertElement : public InstHighLevel {
public: public:
static InstInsertElement *create(Cfg *Func, Variable *Dest, Operand *Source1, static InstInsertElement *create(Cfg *Func, Variable *Dest, Operand *Source1,
Operand *Source2, Operand *Source3) { Operand *Source2, Operand *Source3) {
...@@ -445,7 +464,7 @@ public: ...@@ -445,7 +464,7 @@ public:
InstInsertElement(Func, Dest, Source1, Source2, Source3); 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) { static bool classof(const Inst *Inst) {
return Inst->getKind() == InsertElement; return Inst->getKind() == InsertElement;
} }
...@@ -455,7 +474,7 @@ private: ...@@ -455,7 +474,7 @@ private:
Operand *Source2, Operand *Source3); Operand *Source2, Operand *Source3);
InstInsertElement(const InstInsertElement &) LLVM_DELETED_FUNCTION; InstInsertElement(const InstInsertElement &) LLVM_DELETED_FUNCTION;
InstInsertElement &operator=(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), // Call to an intrinsic function. The call target is captured as getSrc(0),
...@@ -482,12 +501,12 @@ private: ...@@ -482,12 +501,12 @@ private:
Info(Info) {} Info(Info) {}
InstIntrinsicCall(const InstIntrinsicCall &) LLVM_DELETED_FUNCTION; InstIntrinsicCall(const InstIntrinsicCall &) LLVM_DELETED_FUNCTION;
InstIntrinsicCall &operator=(const InstIntrinsicCall &) LLVM_DELETED_FUNCTION; InstIntrinsicCall &operator=(const InstIntrinsicCall &) LLVM_DELETED_FUNCTION;
virtual ~InstIntrinsicCall() {} ~InstIntrinsicCall() override {}
const Intrinsics::IntrinsicInfo Info; const Intrinsics::IntrinsicInfo Info;
}; };
// Load instruction. The source address is captured in getSrc(0). // Load instruction. The source address is captured in getSrc(0).
class InstLoad : public Inst { class InstLoad : public InstHighLevel {
public: public:
static InstLoad *create(Cfg *Func, Variable *Dest, Operand *SourceAddr, static InstLoad *create(Cfg *Func, Variable *Dest, Operand *SourceAddr,
uint32_t align = 1) { uint32_t align = 1) {
...@@ -497,19 +516,19 @@ public: ...@@ -497,19 +516,19 @@ public:
InstLoad(Func, Dest, SourceAddr); InstLoad(Func, Dest, SourceAddr);
} }
Operand *getSourceAddress() const { return getSrc(0); } 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; } static bool classof(const Inst *Inst) { return Inst->getKind() == Load; }
private: private:
InstLoad(Cfg *Func, Variable *Dest, Operand *SourceAddr); InstLoad(Cfg *Func, Variable *Dest, Operand *SourceAddr);
InstLoad(const InstLoad &) LLVM_DELETED_FUNCTION; InstLoad(const InstLoad &) LLVM_DELETED_FUNCTION;
InstLoad &operator=(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 // Phi instruction. For incoming edge I, the node is Labels[I] and
// the Phi source operand is getSrc(I). // the Phi source operand is getSrc(I).
class InstPhi : public Inst { class InstPhi : public InstHighLevel {
public: public:
static InstPhi *create(Cfg *Func, SizeT MaxSrcs, Variable *Dest) { static InstPhi *create(Cfg *Func, SizeT MaxSrcs, Variable *Dest) {
return new (Func->allocateInst<InstPhi>()) InstPhi(Func, MaxSrcs, Dest); return new (Func->allocateInst<InstPhi>()) InstPhi(Func, MaxSrcs, Dest);
...@@ -519,18 +538,18 @@ public: ...@@ -519,18 +538,18 @@ public:
void livenessPhiOperand(llvm::BitVector &Live, CfgNode *Target, void livenessPhiOperand(llvm::BitVector &Live, CfgNode *Target,
Liveness *Liveness); Liveness *Liveness);
Inst *lower(Cfg *Func); 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; } static bool classof(const Inst *Inst) { return Inst->getKind() == Phi; }
private: private:
InstPhi(Cfg *Func, SizeT MaxSrcs, Variable *Dest); InstPhi(Cfg *Func, SizeT MaxSrcs, Variable *Dest);
InstPhi(const InstPhi &) LLVM_DELETED_FUNCTION; InstPhi(const InstPhi &) LLVM_DELETED_FUNCTION;
InstPhi &operator=(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); Func->deallocateArrayOf<CfgNode *>(Labels);
Inst::destroy(Func); Inst::destroy(Func);
} }
virtual ~InstPhi() {} ~InstPhi() override {}
// Labels[] duplicates the InEdges[] information in the enclosing // Labels[] duplicates the InEdges[] information in the enclosing
// CfgNode, but the Phi instruction is created before InEdges[] // CfgNode, but the Phi instruction is created before InEdges[]
...@@ -541,7 +560,7 @@ private: ...@@ -541,7 +560,7 @@ private:
// Ret instruction. The return value is captured in getSrc(0), but if // Ret instruction. The return value is captured in getSrc(0), but if
// there is no return value (void-type function), then // there is no return value (void-type function), then
// getSrcSize()==0 and hasRetValue()==false. // getSrcSize()==0 and hasRetValue()==false.
class InstRet : public Inst { class InstRet : public InstHighLevel {
public: public:
static InstRet *create(Cfg *Func, Operand *RetValue = NULL) { static InstRet *create(Cfg *Func, Operand *RetValue = NULL) {
return new (Func->allocateInst<InstRet>()) InstRet(Func, RetValue); return new (Func->allocateInst<InstRet>()) InstRet(Func, RetValue);
...@@ -551,19 +570,19 @@ public: ...@@ -551,19 +570,19 @@ public:
assert(hasRetValue()); assert(hasRetValue());
return getSrc(0); return getSrc(0);
} }
virtual NodeList getTerminatorEdges() const { return NodeList(); } NodeList getTerminatorEdges() const override { return NodeList(); }
virtual void dump(const Cfg *Func) const; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return Inst->getKind() == Ret; } static bool classof(const Inst *Inst) { return Inst->getKind() == Ret; }
private: private:
InstRet(Cfg *Func, Operand *RetValue); InstRet(Cfg *Func, Operand *RetValue);
InstRet(const InstRet &) LLVM_DELETED_FUNCTION; InstRet(const InstRet &) LLVM_DELETED_FUNCTION;
InstRet &operator=(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. // Select instruction. The condition, true, and false operands are captured.
class InstSelect : public Inst { class InstSelect : public InstHighLevel {
public: public:
static InstSelect *create(Cfg *Func, Variable *Dest, Operand *Condition, static InstSelect *create(Cfg *Func, Variable *Dest, Operand *Condition,
Operand *SourceTrue, Operand *SourceFalse) { Operand *SourceTrue, Operand *SourceFalse) {
...@@ -573,7 +592,7 @@ public: ...@@ -573,7 +592,7 @@ public:
Operand *getCondition() const { return getSrc(0); } Operand *getCondition() const { return getSrc(0); }
Operand *getTrueOperand() const { return getSrc(1); } Operand *getTrueOperand() const { return getSrc(1); }
Operand *getFalseOperand() const { return getSrc(2); } 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; } static bool classof(const Inst *Inst) { return Inst->getKind() == Select; }
private: private:
...@@ -581,12 +600,12 @@ private: ...@@ -581,12 +600,12 @@ private:
Operand *Source2); Operand *Source2);
InstSelect(const InstSelect &) LLVM_DELETED_FUNCTION; InstSelect(const InstSelect &) LLVM_DELETED_FUNCTION;
InstSelect &operator=(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 // Store instruction. The address operand is captured, along with the
// data operand to be stored into the address. // data operand to be stored into the address.
class InstStore : public Inst { class InstStore : public InstHighLevel {
public: public:
static InstStore *create(Cfg *Func, Operand *Data, Operand *Addr, static InstStore *create(Cfg *Func, Operand *Data, Operand *Addr,
uint32_t align = 1) { uint32_t align = 1) {
...@@ -596,19 +615,19 @@ public: ...@@ -596,19 +615,19 @@ public:
} }
Operand *getAddr() const { return getSrc(1); } Operand *getAddr() const { return getSrc(1); }
Operand *getData() const { return getSrc(0); } 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; } static bool classof(const Inst *Inst) { return Inst->getKind() == Store; }
private: private:
InstStore(Cfg *Func, Operand *Data, Operand *Addr); InstStore(Cfg *Func, Operand *Data, Operand *Addr);
InstStore(const InstStore &) LLVM_DELETED_FUNCTION; InstStore(const InstStore &) LLVM_DELETED_FUNCTION;
InstStore &operator=(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 // Switch instruction. The single source operand is captured as
// getSrc(0). // getSrc(0).
class InstSwitch : public Inst { class InstSwitch : public InstHighLevel {
public: public:
static InstSwitch *create(Cfg *Func, SizeT NumCases, Operand *Source, static InstSwitch *create(Cfg *Func, SizeT NumCases, Operand *Source,
CfgNode *LabelDefault) { CfgNode *LabelDefault) {
...@@ -627,20 +646,20 @@ public: ...@@ -627,20 +646,20 @@ public:
return Labels[I]; return Labels[I];
} }
void addBranch(SizeT CaseIndex, uint64_t Value, CfgNode *Label); void addBranch(SizeT CaseIndex, uint64_t Value, CfgNode *Label);
virtual NodeList getTerminatorEdges() const; NodeList getTerminatorEdges() const override;
virtual void dump(const Cfg *Func) const; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return Inst->getKind() == Switch; } static bool classof(const Inst *Inst) { return Inst->getKind() == Switch; }
private: private:
InstSwitch(Cfg *Func, SizeT NumCases, Operand *Source, CfgNode *LabelDefault); InstSwitch(Cfg *Func, SizeT NumCases, Operand *Source, CfgNode *LabelDefault);
InstSwitch(const InstSwitch &) LLVM_DELETED_FUNCTION; InstSwitch(const InstSwitch &) LLVM_DELETED_FUNCTION;
InstSwitch &operator=(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<uint64_t>(Values);
Func->deallocateArrayOf<CfgNode *>(Labels); Func->deallocateArrayOf<CfgNode *>(Labels);
Inst::destroy(Func); Inst::destroy(Func);
} }
virtual ~InstSwitch() {} ~InstSwitch() override {}
CfgNode *LabelDefault; CfgNode *LabelDefault;
SizeT NumCases; // not including the default case SizeT NumCases; // not including the default case
...@@ -650,13 +669,13 @@ private: ...@@ -650,13 +669,13 @@ private:
// Unreachable instruction. This is a terminator instruction with no // Unreachable instruction. This is a terminator instruction with no
// operands. // operands.
class InstUnreachable : public Inst { class InstUnreachable : public InstHighLevel {
public: public:
static InstUnreachable *create(Cfg *Func) { static InstUnreachable *create(Cfg *Func) {
return new (Func->allocateInst<InstUnreachable>()) InstUnreachable(Func); return new (Func->allocateInst<InstUnreachable>()) InstUnreachable(Func);
} }
virtual NodeList getTerminatorEdges() const { return NodeList(); } NodeList getTerminatorEdges() const override { return NodeList(); }
virtual void dump(const Cfg *Func) const; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { static bool classof(const Inst *Inst) {
return Inst->getKind() == Unreachable; return Inst->getKind() == Unreachable;
} }
...@@ -665,7 +684,7 @@ private: ...@@ -665,7 +684,7 @@ private:
InstUnreachable(Cfg *Func); InstUnreachable(Cfg *Func);
InstUnreachable(const InstUnreachable &) LLVM_DELETED_FUNCTION; InstUnreachable(const InstUnreachable &) LLVM_DELETED_FUNCTION;
InstUnreachable &operator=(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, // FakeDef instruction. This creates a fake definition of a variable,
...@@ -680,20 +699,21 @@ private: ...@@ -680,20 +699,21 @@ private:
// dest. Otherwise, the original instruction could be dead-code // dest. Otherwise, the original instruction could be dead-code
// eliminated if its dest operand is unused, and therefore the FakeDef // eliminated if its dest operand is unused, and therefore the FakeDef
// dest wouldn't be properly initialized. // dest wouldn't be properly initialized.
class InstFakeDef : public Inst { class InstFakeDef : public InstHighLevel {
public: public:
static InstFakeDef *create(Cfg *Func, Variable *Dest, Variable *Src = NULL) { static InstFakeDef *create(Cfg *Func, Variable *Dest, Variable *Src = NULL) {
return new (Func->allocateInst<InstFakeDef>()) InstFakeDef(Func, Dest, Src); return new (Func->allocateInst<InstFakeDef>()) InstFakeDef(Func, Dest, Src);
} }
virtual void emit(const Cfg *Func) const; void emit(const Cfg *Func) const override;
virtual void dump(const Cfg *Func) const; 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; } static bool classof(const Inst *Inst) { return Inst->getKind() == FakeDef; }
private: private:
InstFakeDef(Cfg *Func, Variable *Dest, Variable *Src); InstFakeDef(Cfg *Func, Variable *Dest, Variable *Src);
InstFakeDef(const InstFakeDef &) LLVM_DELETED_FUNCTION; InstFakeDef(const InstFakeDef &) LLVM_DELETED_FUNCTION;
InstFakeDef &operator=(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 // FakeUse instruction. This creates a fake use of a variable, to
...@@ -701,20 +721,21 @@ private: ...@@ -701,20 +721,21 @@ private:
// dead-code eliminated. This is useful in a variety of lowering // dead-code eliminated. This is useful in a variety of lowering
// situations. The FakeUse instruction has no dest, so it can itself // situations. The FakeUse instruction has no dest, so it can itself
// never be dead-code eliminated. // never be dead-code eliminated.
class InstFakeUse : public Inst { class InstFakeUse : public InstHighLevel {
public: public:
static InstFakeUse *create(Cfg *Func, Variable *Src) { static InstFakeUse *create(Cfg *Func, Variable *Src) {
return new (Func->allocateInst<InstFakeUse>()) InstFakeUse(Func, Src); return new (Func->allocateInst<InstFakeUse>()) InstFakeUse(Func, Src);
} }
virtual void emit(const Cfg *Func) const; void emit(const Cfg *Func) const override;
virtual void dump(const Cfg *Func) const; 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; } static bool classof(const Inst *Inst) { return Inst->getKind() == FakeUse; }
private: private:
InstFakeUse(Cfg *Func, Variable *Src); InstFakeUse(Cfg *Func, Variable *Src);
InstFakeUse(const InstFakeUse &) LLVM_DELETED_FUNCTION; InstFakeUse(const InstFakeUse &) LLVM_DELETED_FUNCTION;
InstFakeUse &operator=(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 // FakeKill instruction. This "kills" a set of variables by adding a
...@@ -726,7 +747,7 @@ private: ...@@ -726,7 +747,7 @@ private:
// The FakeKill instruction also holds a pointer to the instruction // The FakeKill instruction also holds a pointer to the instruction
// that kills the set of variables, so that if that linked instruction // that kills the set of variables, so that if that linked instruction
// gets dead-code eliminated, the FakeKill instruction will as well. // gets dead-code eliminated, the FakeKill instruction will as well.
class InstFakeKill : public Inst { class InstFakeKill : public InstHighLevel {
public: public:
static InstFakeKill *create(Cfg *Func, const VarList &KilledRegs, static InstFakeKill *create(Cfg *Func, const VarList &KilledRegs,
const Inst *Linked) { const Inst *Linked) {
...@@ -734,15 +755,16 @@ public: ...@@ -734,15 +755,16 @@ public:
InstFakeKill(Func, KilledRegs, Linked); InstFakeKill(Func, KilledRegs, Linked);
} }
const Inst *getLinked() const { return Linked; } const Inst *getLinked() const { return Linked; }
virtual void emit(const Cfg *Func) const; void emit(const Cfg *Func) const override;
virtual void dump(const Cfg *Func) const; 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; } static bool classof(const Inst *Inst) { return Inst->getKind() == FakeKill; }
private: private:
InstFakeKill(Cfg *Func, const VarList &KilledRegs, const Inst *Linked); InstFakeKill(Cfg *Func, const VarList &KilledRegs, const Inst *Linked);
InstFakeKill(const InstFakeKill &) LLVM_DELETED_FUNCTION; InstFakeKill(const InstFakeKill &) LLVM_DELETED_FUNCTION;
InstFakeKill &operator=(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. // This instruction is ignored if Linked->isDeleted() is true.
const Inst *Linked; const Inst *Linked;
...@@ -751,11 +773,12 @@ private: ...@@ -751,11 +773,12 @@ private:
// The Target instruction is the base class for all target-specific // The Target instruction is the base class for all target-specific
// instructions. // instructions.
class InstTarget : public Inst { class InstTarget : public Inst {
InstTarget(const InstTarget &) LLVM_DELETED_FUNCTION;
InstTarget &operator=(const InstTarget &) LLVM_DELETED_FUNCTION;
public: public:
virtual uint32_t getEmitInstCount() const { return 1; } uint32_t getEmitInstCount() const override { return 1; }
virtual void emit(const Cfg *Func) const = 0; void dump(const Cfg *Func) const override;
virtual void dump(const Cfg *Func) const;
virtual void dumpExtras(const Cfg *Func) const;
static bool classof(const Inst *Inst) { return Inst->getKind() >= Target; } static bool classof(const Inst *Inst) { return Inst->getKind() >= Target; }
protected: protected:
...@@ -763,9 +786,8 @@ protected: ...@@ -763,9 +786,8 @@ protected:
: Inst(Func, Kind, MaxSrcs, Dest) { : Inst(Func, Kind, MaxSrcs, Dest) {
assert(Kind >= Target); assert(Kind >= Target);
} }
InstTarget(const InstTarget &) LLVM_DELETED_FUNCTION; void emitIAS(const Cfg *Func) const override { emit(Func); }
InstTarget &operator=(const InstTarget &) LLVM_DELETED_FUNCTION; ~InstTarget() override {}
virtual ~InstTarget() {}
}; };
} // end of namespace Ice } // end of namespace Ice
......
...@@ -36,16 +36,15 @@ public: ...@@ -36,16 +36,15 @@ public:
kMem, kMem,
kSplit kSplit
}; };
virtual void emit(const Cfg *Func) const = 0;
using Operand::dump; using Operand::dump;
virtual void dump(const Cfg *, Ostream &Str) const { void dump(const Cfg *, Ostream &Str) const override {
Str << "<OperandX8632>"; Str << "<OperandX8632>";
} }
protected: protected:
OperandX8632(OperandKindX8632 Kind, Type Ty) OperandX8632(OperandKindX8632 Kind, Type Ty)
: Operand(static_cast<OperandKind>(Kind), Ty) {} : Operand(static_cast<OperandKind>(Kind), Ty) {}
virtual ~OperandX8632() {} ~OperandX8632() override {}
private: private:
OperandX8632(const OperandX8632 &) LLVM_DELETED_FUNCTION; OperandX8632(const OperandX8632 &) LLVM_DELETED_FUNCTION;
...@@ -77,9 +76,9 @@ public: ...@@ -77,9 +76,9 @@ public:
uint16_t getShift() const { return Shift; } uint16_t getShift() const { return Shift; }
SegmentRegisters getSegmentRegister() const { return SegmentReg; } SegmentRegisters getSegmentRegister() const { return SegmentReg; }
x86::Address toAsmAddress(Assembler *Asm) const; x86::Address toAsmAddress(Assembler *Asm) const;
virtual void emit(const Cfg *Func) const; void emit(const Cfg *Func) const override;
using OperandX8632::dump; 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) { static bool classof(const Operand *Operand) {
return Operand->getKind() == static_cast<OperandKind>(kMem); return Operand->getKind() == static_cast<OperandKind>(kMem);
...@@ -90,7 +89,7 @@ private: ...@@ -90,7 +89,7 @@ private:
Variable *Index, uint16_t Shift, SegmentRegisters SegmentReg); Variable *Index, uint16_t Shift, SegmentRegisters SegmentReg);
OperandX8632Mem(const OperandX8632Mem &) LLVM_DELETED_FUNCTION; OperandX8632Mem(const OperandX8632Mem &) LLVM_DELETED_FUNCTION;
OperandX8632Mem &operator=(const OperandX8632Mem &) LLVM_DELETED_FUNCTION; OperandX8632Mem &operator=(const OperandX8632Mem &) LLVM_DELETED_FUNCTION;
virtual ~OperandX8632Mem() {} ~OperandX8632Mem() override {}
Variable *Base; Variable *Base;
Constant *Offset; Constant *Offset;
Variable *Index; Variable *Index;
...@@ -113,9 +112,9 @@ public: ...@@ -113,9 +112,9 @@ public:
static VariableSplit *create(Cfg *Func, Variable *Var, Portion Part) { static VariableSplit *create(Cfg *Func, Variable *Var, Portion Part) {
return new (Func->allocate<VariableSplit>()) VariableSplit(Func, Var, 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; 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) { static bool classof(const Operand *Operand) {
return Operand->getKind() == static_cast<OperandKind>(kSplit); return Operand->getKind() == static_cast<OperandKind>(kSplit);
...@@ -131,7 +130,7 @@ private: ...@@ -131,7 +130,7 @@ private:
} }
VariableSplit(const VariableSplit &) LLVM_DELETED_FUNCTION; VariableSplit(const VariableSplit &) LLVM_DELETED_FUNCTION;
VariableSplit &operator=(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. Cfg *Func; // Held only for the destructor.
Variable *Var; Variable *Var;
Portion Part; Portion Part;
...@@ -253,13 +252,12 @@ public: ...@@ -253,13 +252,12 @@ public:
}; };
static const char *getWidthString(Type Ty); static const char *getWidthString(Type Ty);
virtual void emit(const Cfg *Func) const = 0; void dump(const Cfg *Func) const override;
virtual void dump(const Cfg *Func) const;
protected: protected:
InstX8632(Cfg *Func, InstKindX8632 Kind, SizeT Maxsrcs, Variable *Dest) InstX8632(Cfg *Func, InstKindX8632 Kind, SizeT Maxsrcs, Variable *Dest)
: InstTarget(Func, static_cast<InstKind>(Kind), Maxsrcs, Dest) {} : InstTarget(Func, static_cast<InstKind>(Kind), Maxsrcs, Dest) {}
virtual ~InstX8632() {} ~InstX8632() override {}
static bool isClassof(const Inst *Inst, InstKindX8632 MyKind) { static bool isClassof(const Inst *Inst, InstKindX8632 MyKind) {
return Inst->getKind() == static_cast<InstKind>(MyKind); return Inst->getKind() == static_cast<InstKind>(MyKind);
} }
...@@ -311,16 +309,16 @@ public: ...@@ -311,16 +309,16 @@ public:
static InstX8632Label *create(Cfg *Func, TargetX8632 *Target) { static InstX8632Label *create(Cfg *Func, TargetX8632 *Target) {
return new (Func->allocate<InstX8632Label>()) InstX8632Label(Func, 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; IceString getName(const Cfg *Func) const;
virtual void emit(const Cfg *Func) const; void emit(const Cfg *Func) const override;
virtual void dump(const Cfg *Func) const; void dump(const Cfg *Func) const override;
private: private:
InstX8632Label(Cfg *Func, TargetX8632 *Target); InstX8632Label(Cfg *Func, TargetX8632 *Target);
InstX8632Label(const InstX8632Label &) LLVM_DELETED_FUNCTION; InstX8632Label(const InstX8632Label &) LLVM_DELETED_FUNCTION;
InstX8632Label &operator=(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 SizeT Number; // used only for unique label string generation
}; };
...@@ -363,7 +361,7 @@ public: ...@@ -363,7 +361,7 @@ public:
const CfgNode *getTargetTrue() const { return TargetTrue; } const CfgNode *getTargetTrue() const { return TargetTrue; }
const CfgNode *getTargetFalse() const { return TargetFalse; } const CfgNode *getTargetFalse() const { return TargetFalse; }
bool optimizeBranch(const CfgNode *NextNode); bool optimizeBranch(const CfgNode *NextNode);
virtual uint32_t getEmitInstCount() const { uint32_t getEmitInstCount() const override {
uint32_t Sum = 0; uint32_t Sum = 0;
if (Label) if (Label)
++Sum; ++Sum;
...@@ -373,8 +371,8 @@ public: ...@@ -373,8 +371,8 @@ public:
++Sum; ++Sum;
return Sum; return Sum;
} }
virtual void emit(const Cfg *Func) const; void emit(const Cfg *Func) const override;
virtual void dump(const Cfg *Func) const; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return isClassof(Inst, Br); } static bool classof(const Inst *Inst) { return isClassof(Inst, Br); }
private: private:
...@@ -382,7 +380,7 @@ private: ...@@ -382,7 +380,7 @@ private:
const InstX8632Label *Label, CondX86::BrCond Condition); const InstX8632Label *Label, CondX86::BrCond Condition);
InstX8632Br(const InstX8632Br &) LLVM_DELETED_FUNCTION; InstX8632Br(const InstX8632Br &) LLVM_DELETED_FUNCTION;
InstX8632Br &operator=(const InstX8632Br &) LLVM_DELETED_FUNCTION; InstX8632Br &operator=(const InstX8632Br &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Br() {} ~InstX8632Br() override {}
CondX86::BrCond Condition; CondX86::BrCond Condition;
const CfgNode *TargetTrue; const CfgNode *TargetTrue;
const CfgNode *TargetFalse; const CfgNode *TargetFalse;
...@@ -397,9 +395,9 @@ public: ...@@ -397,9 +395,9 @@ public:
return new (Func->allocate<InstX8632AdjustStack>()) return new (Func->allocate<InstX8632AdjustStack>())
InstX8632AdjustStack(Func, Amount, Esp); InstX8632AdjustStack(Func, Amount, Esp);
} }
virtual void emit(const Cfg *Func) const; void emit(const Cfg *Func) const override;
virtual void emitIAS(const Cfg *Func) const; void emitIAS(const Cfg *Func) const override;
virtual void dump(const Cfg *Func) const; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return isClassof(Inst, Adjuststack); } static bool classof(const Inst *Inst) { return isClassof(Inst, Adjuststack); }
private: private:
...@@ -418,15 +416,15 @@ public: ...@@ -418,15 +416,15 @@ public:
InstX8632Call(Func, Dest, CallTarget); InstX8632Call(Func, Dest, CallTarget);
} }
Operand *getCallTarget() const { return getSrc(0); } Operand *getCallTarget() const { return getSrc(0); }
virtual void emit(const Cfg *Func) const; void emit(const Cfg *Func) const override;
virtual void dump(const Cfg *Func) const; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return isClassof(Inst, Call); } static bool classof(const Inst *Inst) { return isClassof(Inst, Call); }
private: private:
InstX8632Call(Cfg *Func, Variable *Dest, Operand *CallTarget); InstX8632Call(Cfg *Func, Variable *Dest, Operand *CallTarget);
InstX8632Call(const InstX8632Call &) LLVM_DELETED_FUNCTION; InstX8632Call(const InstX8632Call &) LLVM_DELETED_FUNCTION;
InstX8632Call &operator=(const InstX8632Call &) LLVM_DELETED_FUNCTION; InstX8632Call &operator=(const InstX8632Call &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Call() {} ~InstX8632Call() override {}
}; };
// Emit a one-operand (GPR) instruction. // Emit a one-operand (GPR) instruction.
...@@ -441,20 +439,20 @@ public: ...@@ -441,20 +439,20 @@ public:
return new (Func->allocate<InstX8632InplaceopGPR>()) return new (Func->allocate<InstX8632InplaceopGPR>())
InstX8632InplaceopGPR(Func, SrcDest); InstX8632InplaceopGPR(Func, SrcDest);
} }
virtual void emit(const Cfg *Func) const { void emit(const Cfg *Func) const override {
Ostream &Str = Func->getContext()->getStrEmit(); Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 1); assert(getSrcSize() == 1);
Str << "\t" << Opcode << "\t"; Str << "\t" << Opcode << "\t";
getSrc(0)->emit(Func); getSrc(0)->emit(Func);
Str << "\n"; Str << "\n";
} }
virtual void emitIAS(const Cfg *Func) const { void emitIAS(const Cfg *Func) const override {
assert(getSrcSize() == 1); assert(getSrcSize() == 1);
const Variable *Var = getDest(); const Variable *Var = getDest();
Type Ty = Var->getType(); Type Ty = Var->getType();
emitIASVarTyGPR(Func, Ty, Var, Emitter); emitIASVarTyGPR(Func, Ty, Var, Emitter);
} }
virtual void dump(const Cfg *Func) const { void dump(const Cfg *Func) const override {
Ostream &Str = Func->getContext()->getStrDump(); Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func); dumpDest(Func);
Str << " = " << Opcode << "." << getDest()->getType() << " "; Str << " = " << Opcode << "." << getDest()->getType() << " ";
...@@ -470,7 +468,7 @@ private: ...@@ -470,7 +468,7 @@ private:
InstX8632InplaceopGPR(const InstX8632InplaceopGPR &) LLVM_DELETED_FUNCTION; InstX8632InplaceopGPR(const InstX8632InplaceopGPR &) LLVM_DELETED_FUNCTION;
InstX8632InplaceopGPR & InstX8632InplaceopGPR &
operator=(const InstX8632InplaceopGPR &) LLVM_DELETED_FUNCTION; operator=(const InstX8632InplaceopGPR &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632InplaceopGPR() {} ~InstX8632InplaceopGPR() override {}
static const char *Opcode; static const char *Opcode;
static const x86::AssemblerX86::GPREmitterOneOp Emitter; static const x86::AssemblerX86::GPREmitterOneOp Emitter;
}; };
...@@ -489,7 +487,7 @@ public: ...@@ -489,7 +487,7 @@ public:
return new (Func->allocate<InstX8632UnaryopGPR>()) return new (Func->allocate<InstX8632UnaryopGPR>())
InstX8632UnaryopGPR(Func, Dest, Src); InstX8632UnaryopGPR(Func, Dest, Src);
} }
virtual void emit(const Cfg *Func) const { void emit(const Cfg *Func) const override {
Ostream &Str = Func->getContext()->getStrEmit(); Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 1); assert(getSrcSize() == 1);
Str << "\t" << Opcode << "\t"; Str << "\t" << Opcode << "\t";
...@@ -498,14 +496,14 @@ public: ...@@ -498,14 +496,14 @@ public:
getSrc(0)->emit(Func); getSrc(0)->emit(Func);
Str << "\n"; Str << "\n";
} }
virtual void emitIAS(const Cfg *Func) const { void emitIAS(const Cfg *Func) const override {
assert(getSrcSize() == 1); assert(getSrcSize() == 1);
const Variable *Var = getDest(); const Variable *Var = getDest();
Type Ty = Var->getType(); Type Ty = Var->getType();
const Operand *Src = getSrc(0); const Operand *Src = getSrc(0);
emitIASRegOpTyGPR(Func, Ty, Var, Src, Emitter); 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(); Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func); dumpDest(Func);
Str << " = " << Opcode << "." << getDest()->getType() << " "; Str << " = " << Opcode << "." << getDest()->getType() << " ";
...@@ -521,7 +519,7 @@ private: ...@@ -521,7 +519,7 @@ private:
InstX8632UnaryopGPR(const InstX8632UnaryopGPR &) LLVM_DELETED_FUNCTION; InstX8632UnaryopGPR(const InstX8632UnaryopGPR &) LLVM_DELETED_FUNCTION;
InstX8632UnaryopGPR & InstX8632UnaryopGPR &
operator=(const InstX8632UnaryopGPR &) LLVM_DELETED_FUNCTION; operator=(const InstX8632UnaryopGPR &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632UnaryopGPR() {} ~InstX8632UnaryopGPR() override {}
static const char *Opcode; static const char *Opcode;
static const x86::AssemblerX86::GPREmitterRegOp Emitter; static const x86::AssemblerX86::GPREmitterRegOp Emitter;
}; };
...@@ -537,7 +535,7 @@ public: ...@@ -537,7 +535,7 @@ public:
return new (Func->allocate<InstX8632UnaryopXmm>()) return new (Func->allocate<InstX8632UnaryopXmm>())
InstX8632UnaryopXmm(Func, Dest, Src); InstX8632UnaryopXmm(Func, Dest, Src);
} }
virtual void emit(const Cfg *Func) const { void emit(const Cfg *Func) const override {
Ostream &Str = Func->getContext()->getStrEmit(); Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 1); assert(getSrcSize() == 1);
Str << "\t" << Opcode << "\t"; Str << "\t" << Opcode << "\t";
...@@ -546,12 +544,12 @@ public: ...@@ -546,12 +544,12 @@ public:
getSrc(0)->emit(Func); getSrc(0)->emit(Func);
Str << "\n"; Str << "\n";
} }
virtual void emitIAS(const Cfg *Func) const { void emitIAS(const Cfg *Func) const override {
Type Ty = getDest()->getType(); Type Ty = getDest()->getType();
assert(getSrcSize() == 1); assert(getSrcSize() == 1);
emitIASVarOperandTyXMM(Func, Ty, getDest(), getSrc(0), Emitter); 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(); Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func); dumpDest(Func);
Str << " = " << Opcode << "." << getDest()->getType() << " "; Str << " = " << Opcode << "." << getDest()->getType() << " ";
...@@ -567,7 +565,7 @@ private: ...@@ -567,7 +565,7 @@ private:
InstX8632UnaryopXmm(const InstX8632UnaryopXmm &) LLVM_DELETED_FUNCTION; InstX8632UnaryopXmm(const InstX8632UnaryopXmm &) LLVM_DELETED_FUNCTION;
InstX8632UnaryopXmm & InstX8632UnaryopXmm &
operator=(const InstX8632UnaryopXmm &) LLVM_DELETED_FUNCTION; operator=(const InstX8632UnaryopXmm &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632UnaryopXmm() {} ~InstX8632UnaryopXmm() override {}
static const char *Opcode; static const char *Opcode;
static const x86::AssemblerX86::XmmEmitterTwoOps Emitter; static const x86::AssemblerX86::XmmEmitterTwoOps Emitter;
}; };
...@@ -585,10 +583,10 @@ public: ...@@ -585,10 +583,10 @@ public:
return new (Func->allocate<InstX8632Binop>()) return new (Func->allocate<InstX8632Binop>())
InstX8632Binop(Func, Dest, Source); InstX8632Binop(Func, Dest, Source);
} }
virtual void emit(const Cfg *Func) const { void emit(const Cfg *Func) const override {
emitTwoAddress(Opcode, this, Func, ShiftHack); emitTwoAddress(Opcode, this, Func, ShiftHack);
} }
virtual void dump(const Cfg *Func) const { void dump(const Cfg *Func) const override {
Ostream &Str = Func->getContext()->getStrDump(); Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func); dumpDest(Func);
Str << " = " << Opcode << "." << getDest()->getType() << " "; Str << " = " << Opcode << "." << getDest()->getType() << " ";
...@@ -604,7 +602,7 @@ private: ...@@ -604,7 +602,7 @@ private:
} }
InstX8632Binop(const InstX8632Binop &) LLVM_DELETED_FUNCTION; InstX8632Binop(const InstX8632Binop &) LLVM_DELETED_FUNCTION;
InstX8632Binop &operator=(const InstX8632Binop &) LLVM_DELETED_FUNCTION; InstX8632Binop &operator=(const InstX8632Binop &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Binop() {} ~InstX8632Binop() override {}
static const char *Opcode; static const char *Opcode;
}; };
...@@ -616,18 +614,18 @@ public: ...@@ -616,18 +614,18 @@ public:
return new (Func->allocate<InstX8632BinopXmm>()) return new (Func->allocate<InstX8632BinopXmm>())
InstX8632BinopXmm(Func, Dest, Source); InstX8632BinopXmm(Func, Dest, Source);
} }
virtual void emit(const Cfg *Func) const { void emit(const Cfg *Func) const override {
const bool ShiftHack = false; const bool ShiftHack = false;
emitTwoAddress(Opcode, this, Func, ShiftHack); emitTwoAddress(Opcode, this, Func, ShiftHack);
} }
virtual void emitIAS(const Cfg *Func) const { void emitIAS(const Cfg *Func) const override {
Type Ty = getDest()->getType(); Type Ty = getDest()->getType();
if (NeedsElementType) if (NeedsElementType)
Ty = typeElementType(Ty); Ty = typeElementType(Ty);
assert(getSrcSize() == 2); assert(getSrcSize() == 2);
emitIASVarOperandTyXMM(Func, Ty, getDest(), getSrc(1), Emitter); 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(); Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func); dumpDest(Func);
Str << " = " << Opcode << "." << getDest()->getType() << " "; Str << " = " << Opcode << "." << getDest()->getType() << " ";
...@@ -643,7 +641,7 @@ private: ...@@ -643,7 +641,7 @@ private:
} }
InstX8632BinopXmm(const InstX8632BinopXmm &) LLVM_DELETED_FUNCTION; InstX8632BinopXmm(const InstX8632BinopXmm &) LLVM_DELETED_FUNCTION;
InstX8632BinopXmm &operator=(const InstX8632BinopXmm &) LLVM_DELETED_FUNCTION; InstX8632BinopXmm &operator=(const InstX8632BinopXmm &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632BinopXmm() {} ~InstX8632BinopXmm() override {}
static const char *Opcode; static const char *Opcode;
static const x86::AssemblerX86::XmmEmitterTwoOps Emitter; static const x86::AssemblerX86::XmmEmitterTwoOps Emitter;
}; };
...@@ -656,7 +654,7 @@ public: ...@@ -656,7 +654,7 @@ public:
return new (Func->allocate<InstX8632Ternop>()) return new (Func->allocate<InstX8632Ternop>())
InstX8632Ternop(Func, Dest, Source1, Source2); InstX8632Ternop(Func, Dest, Source1, Source2);
} }
virtual void emit(const Cfg *Func) const { void emit(const Cfg *Func) const override {
Ostream &Str = Func->getContext()->getStrEmit(); Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 3); assert(getSrcSize() == 3);
Str << "\t" << Opcode << "\t"; Str << "\t" << Opcode << "\t";
...@@ -667,7 +665,7 @@ public: ...@@ -667,7 +665,7 @@ public:
getSrc(2)->emit(Func); getSrc(2)->emit(Func);
Str << "\n"; Str << "\n";
} }
virtual void dump(const Cfg *Func) const { void dump(const Cfg *Func) const override {
Ostream &Str = Func->getContext()->getStrDump(); Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func); dumpDest(Func);
Str << " = " << Opcode << "." << getDest()->getType() << " "; Str << " = " << Opcode << "." << getDest()->getType() << " ";
...@@ -684,7 +682,7 @@ private: ...@@ -684,7 +682,7 @@ private:
} }
InstX8632Ternop(const InstX8632Ternop &) LLVM_DELETED_FUNCTION; InstX8632Ternop(const InstX8632Ternop &) LLVM_DELETED_FUNCTION;
InstX8632Ternop &operator=(const InstX8632Ternop &) LLVM_DELETED_FUNCTION; InstX8632Ternop &operator=(const InstX8632Ternop &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Ternop() {} ~InstX8632Ternop() override {}
static const char *Opcode; static const char *Opcode;
}; };
...@@ -697,7 +695,7 @@ public: ...@@ -697,7 +695,7 @@ public:
return new (Func->allocate<InstX8632ThreeAddressop>()) return new (Func->allocate<InstX8632ThreeAddressop>())
InstX8632ThreeAddressop(Func, Dest, Source0, Source1); InstX8632ThreeAddressop(Func, Dest, Source0, Source1);
} }
virtual void emit(const Cfg *Func) const { void emit(const Cfg *Func) const override {
Ostream &Str = Func->getContext()->getStrEmit(); Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 2); assert(getSrcSize() == 2);
Str << "\t" << Opcode << "\t"; Str << "\t" << Opcode << "\t";
...@@ -708,7 +706,7 @@ public: ...@@ -708,7 +706,7 @@ public:
getSrc(1)->emit(Func); getSrc(1)->emit(Func);
Str << "\n"; Str << "\n";
} }
virtual void dump(const Cfg *Func) const { void dump(const Cfg *Func) const override {
Ostream &Str = Func->getContext()->getStrDump(); Ostream &Str = Func->getContext()->getStrDump();
dumpDest(Func); dumpDest(Func);
Str << " = " << Opcode << "." << getDest()->getType() << " "; Str << " = " << Opcode << "." << getDest()->getType() << " ";
...@@ -727,7 +725,7 @@ private: ...@@ -727,7 +725,7 @@ private:
LLVM_DELETED_FUNCTION; LLVM_DELETED_FUNCTION;
InstX8632ThreeAddressop & InstX8632ThreeAddressop &
operator=(const InstX8632ThreeAddressop &) LLVM_DELETED_FUNCTION; operator=(const InstX8632ThreeAddressop &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632ThreeAddressop() {} ~InstX8632ThreeAddressop() override {}
static const char *Opcode; static const char *Opcode;
}; };
...@@ -741,12 +739,12 @@ public: ...@@ -741,12 +739,12 @@ public:
return new (Func->allocate<InstX8632Movlike>()) return new (Func->allocate<InstX8632Movlike>())
InstX8632Movlike(Func, Dest, Source); InstX8632Movlike(Func, Dest, Source);
} }
virtual bool isRedundantAssign() const { bool isRedundantAssign() const override {
return checkForRedundantAssign(getDest(), getSrc(0)); return checkForRedundantAssign(getDest(), getSrc(0));
} }
virtual bool isSimpleAssign() const { return true; } bool isSimpleAssign() const override { return true; }
virtual void emit(const Cfg *Func) const; void emit(const Cfg *Func) const override;
virtual void dump(const Cfg *Func) const { void dump(const Cfg *Func) const override {
Ostream &Str = Func->getContext()->getStrDump(); Ostream &Str = Func->getContext()->getStrDump();
Str << Opcode << "." << getDest()->getType() << " "; Str << Opcode << "." << getDest()->getType() << " ";
dumpDest(Func); dumpDest(Func);
...@@ -762,7 +760,7 @@ private: ...@@ -762,7 +760,7 @@ private:
} }
InstX8632Movlike(const InstX8632Movlike &) LLVM_DELETED_FUNCTION; InstX8632Movlike(const InstX8632Movlike &) LLVM_DELETED_FUNCTION;
InstX8632Movlike &operator=(const InstX8632Movlike &) LLVM_DELETED_FUNCTION; InstX8632Movlike &operator=(const InstX8632Movlike &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Movlike() {} ~InstX8632Movlike() override {}
static const char *Opcode; static const char *Opcode;
}; };
...@@ -844,7 +842,7 @@ protected: ...@@ -844,7 +842,7 @@ protected:
// with optimizations. // with optimizations.
HasSideEffects = Locked; HasSideEffects = Locked;
} }
virtual ~InstX8632Lockable() {} ~InstX8632Lockable() override {}
private: private:
InstX8632Lockable(const InstX8632Lockable &) LLVM_DELETED_FUNCTION; InstX8632Lockable(const InstX8632Lockable &) LLVM_DELETED_FUNCTION;
...@@ -859,15 +857,15 @@ public: ...@@ -859,15 +857,15 @@ public:
return new (Func->allocate<InstX8632Mul>()) return new (Func->allocate<InstX8632Mul>())
InstX8632Mul(Func, Dest, Source1, Source2); InstX8632Mul(Func, Dest, Source1, Source2);
} }
virtual void emit(const Cfg *Func) const; void emit(const Cfg *Func) const override;
virtual void dump(const Cfg *Func) const; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return isClassof(Inst, Mul); } static bool classof(const Inst *Inst) { return isClassof(Inst, Mul); }
private: private:
InstX8632Mul(Cfg *Func, Variable *Dest, Variable *Source1, Operand *Source2); InstX8632Mul(Cfg *Func, Variable *Dest, Variable *Source1, Operand *Source2);
InstX8632Mul(const InstX8632Mul &) LLVM_DELETED_FUNCTION; InstX8632Mul(const InstX8632Mul &) LLVM_DELETED_FUNCTION;
InstX8632Mul &operator=(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 // Shld instruction - shift across a pair of operands. TODO: Verify
...@@ -879,8 +877,8 @@ public: ...@@ -879,8 +877,8 @@ public:
return new (Func->allocate<InstX8632Shld>()) return new (Func->allocate<InstX8632Shld>())
InstX8632Shld(Func, Dest, Source1, Source2); InstX8632Shld(Func, Dest, Source1, Source2);
} }
virtual void emit(const Cfg *Func) const; void emit(const Cfg *Func) const override;
virtual void dump(const Cfg *Func) const; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return isClassof(Inst, Shld); } static bool classof(const Inst *Inst) { return isClassof(Inst, Shld); }
private: private:
...@@ -888,7 +886,7 @@ private: ...@@ -888,7 +886,7 @@ private:
Variable *Source2); Variable *Source2);
InstX8632Shld(const InstX8632Shld &) LLVM_DELETED_FUNCTION; InstX8632Shld(const InstX8632Shld &) LLVM_DELETED_FUNCTION;
InstX8632Shld &operator=(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 // Shrd instruction - shift across a pair of operands. TODO: Verify
...@@ -900,8 +898,8 @@ public: ...@@ -900,8 +898,8 @@ public:
return new (Func->allocate<InstX8632Shrd>()) return new (Func->allocate<InstX8632Shrd>())
InstX8632Shrd(Func, Dest, Source1, Source2); InstX8632Shrd(Func, Dest, Source1, Source2);
} }
virtual void emit(const Cfg *Func) const; void emit(const Cfg *Func) const override;
virtual void dump(const Cfg *Func) const; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return isClassof(Inst, Shrd); } static bool classof(const Inst *Inst) { return isClassof(Inst, Shrd); }
private: private:
...@@ -909,7 +907,7 @@ private: ...@@ -909,7 +907,7 @@ private:
Variable *Source2); Variable *Source2);
InstX8632Shrd(const InstX8632Shrd &) LLVM_DELETED_FUNCTION; InstX8632Shrd(const InstX8632Shrd &) LLVM_DELETED_FUNCTION;
InstX8632Shrd &operator=(const InstX8632Shrd &) LLVM_DELETED_FUNCTION; InstX8632Shrd &operator=(const InstX8632Shrd &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Shrd() {} ~InstX8632Shrd() override {}
}; };
// Conditional move instruction. // Conditional move instruction.
...@@ -920,9 +918,9 @@ public: ...@@ -920,9 +918,9 @@ public:
return new (Func->allocate<InstX8632Cmov>()) return new (Func->allocate<InstX8632Cmov>())
InstX8632Cmov(Func, Dest, Source, Cond); InstX8632Cmov(Func, Dest, Source, Cond);
} }
virtual void emit(const Cfg *Func) const; void emit(const Cfg *Func) const override;
virtual void emitIAS(const Cfg *Func) const; void emitIAS(const Cfg *Func) const override;
virtual void dump(const Cfg *Func) const; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return isClassof(Inst, Cmov); } static bool classof(const Inst *Inst) { return isClassof(Inst, Cmov); }
private: private:
...@@ -930,7 +928,7 @@ private: ...@@ -930,7 +928,7 @@ private:
CondX86::BrCond Cond); CondX86::BrCond Cond);
InstX8632Cmov(const InstX8632Cmov &) LLVM_DELETED_FUNCTION; InstX8632Cmov(const InstX8632Cmov &) LLVM_DELETED_FUNCTION;
InstX8632Cmov &operator=(const InstX8632Cmov &) LLVM_DELETED_FUNCTION; InstX8632Cmov &operator=(const InstX8632Cmov &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Cmov() {} ~InstX8632Cmov() override {}
CondX86::BrCond Condition; CondX86::BrCond Condition;
}; };
...@@ -944,9 +942,9 @@ public: ...@@ -944,9 +942,9 @@ public:
return new (Func->allocate<InstX8632Cmpps>()) return new (Func->allocate<InstX8632Cmpps>())
InstX8632Cmpps(Func, Dest, Source, Condition); InstX8632Cmpps(Func, Dest, Source, Condition);
} }
virtual void emit(const Cfg *Func) const; void emit(const Cfg *Func) const override;
virtual void emitIAS(const Cfg *Func) const; void emitIAS(const Cfg *Func) const override;
virtual void dump(const Cfg *Func) const; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return isClassof(Inst, Cmpps); } static bool classof(const Inst *Inst) { return isClassof(Inst, Cmpps); }
private: private:
...@@ -954,7 +952,7 @@ private: ...@@ -954,7 +952,7 @@ private:
CondX86::CmppsCond Cond); CondX86::CmppsCond Cond);
InstX8632Cmpps(const InstX8632Cmpps &) LLVM_DELETED_FUNCTION; InstX8632Cmpps(const InstX8632Cmpps &) LLVM_DELETED_FUNCTION;
InstX8632Cmpps &operator=(const InstX8632Cmpps &) LLVM_DELETED_FUNCTION; InstX8632Cmpps &operator=(const InstX8632Cmpps &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Cmpps() {} ~InstX8632Cmpps() override {}
CondX86::CmppsCond Condition; CondX86::CmppsCond Condition;
}; };
...@@ -971,9 +969,9 @@ public: ...@@ -971,9 +969,9 @@ public:
return new (Func->allocate<InstX8632Cmpxchg>()) return new (Func->allocate<InstX8632Cmpxchg>())
InstX8632Cmpxchg(Func, DestOrAddr, Eax, Desired, Locked); InstX8632Cmpxchg(Func, DestOrAddr, Eax, Desired, Locked);
} }
virtual void emit(const Cfg *Func) const; void emit(const Cfg *Func) const override;
virtual void emitIAS(const Cfg *Func) const; void emitIAS(const Cfg *Func) const override;
virtual void dump(const Cfg *Func) const; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return isClassof(Inst, Cmpxchg); } static bool classof(const Inst *Inst) { return isClassof(Inst, Cmpxchg); }
private: private:
...@@ -981,7 +979,7 @@ private: ...@@ -981,7 +979,7 @@ private:
Variable *Desired, bool Locked); Variable *Desired, bool Locked);
InstX8632Cmpxchg(const InstX8632Cmpxchg &) LLVM_DELETED_FUNCTION; InstX8632Cmpxchg(const InstX8632Cmpxchg &) LLVM_DELETED_FUNCTION;
InstX8632Cmpxchg &operator=(const InstX8632Cmpxchg &) LLVM_DELETED_FUNCTION; InstX8632Cmpxchg &operator=(const InstX8632Cmpxchg &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Cmpxchg() {} ~InstX8632Cmpxchg() override {}
}; };
// Cmpxchg8b instruction - cmpxchg8b <m64> will compare if <m64> // Cmpxchg8b instruction - cmpxchg8b <m64> will compare if <m64>
...@@ -998,9 +996,9 @@ public: ...@@ -998,9 +996,9 @@ public:
return new (Func->allocate<InstX8632Cmpxchg8b>()) return new (Func->allocate<InstX8632Cmpxchg8b>())
InstX8632Cmpxchg8b(Func, Dest, Edx, Eax, Ecx, Ebx, Locked); InstX8632Cmpxchg8b(Func, Dest, Edx, Eax, Ecx, Ebx, Locked);
} }
virtual void emit(const Cfg *Func) const; void emit(const Cfg *Func) const override;
virtual void emitIAS(const Cfg *Func) const; void emitIAS(const Cfg *Func) const override;
virtual void dump(const Cfg *Func) const; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return isClassof(Inst, Cmpxchg8b); } static bool classof(const Inst *Inst) { return isClassof(Inst, Cmpxchg8b); }
private: private:
...@@ -1009,7 +1007,7 @@ private: ...@@ -1009,7 +1007,7 @@ private:
InstX8632Cmpxchg8b(const InstX8632Cmpxchg8b &) LLVM_DELETED_FUNCTION; InstX8632Cmpxchg8b(const InstX8632Cmpxchg8b &) LLVM_DELETED_FUNCTION;
InstX8632Cmpxchg8b & InstX8632Cmpxchg8b &
operator=(const InstX8632Cmpxchg8b &) LLVM_DELETED_FUNCTION; operator=(const InstX8632Cmpxchg8b &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Cmpxchg8b() {} ~InstX8632Cmpxchg8b() override {}
}; };
// Cvt instruction - wrapper for cvtsX2sY where X and Y are in {s,d,i} // Cvt instruction - wrapper for cvtsX2sY where X and Y are in {s,d,i}
...@@ -1023,8 +1021,8 @@ public: ...@@ -1023,8 +1021,8 @@ public:
return new (Func->allocate<InstX8632Cvt>()) return new (Func->allocate<InstX8632Cvt>())
InstX8632Cvt(Func, Dest, Source, Trunc); InstX8632Cvt(Func, Dest, Source, Trunc);
} }
virtual void emit(const Cfg *Func) const; void emit(const Cfg *Func) const override;
virtual void dump(const Cfg *Func) const; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return isClassof(Inst, Cvt); } static bool classof(const Inst *Inst) { return isClassof(Inst, Cvt); }
private: private:
...@@ -1032,7 +1030,7 @@ private: ...@@ -1032,7 +1030,7 @@ private:
InstX8632Cvt(Cfg *Func, Variable *Dest, Operand *Source, bool Trunc); InstX8632Cvt(Cfg *Func, Variable *Dest, Operand *Source, bool Trunc);
InstX8632Cvt(const InstX8632Cvt &) LLVM_DELETED_FUNCTION; InstX8632Cvt(const InstX8632Cvt &) LLVM_DELETED_FUNCTION;
InstX8632Cvt &operator=(const InstX8632Cvt &) LLVM_DELETED_FUNCTION; InstX8632Cvt &operator=(const InstX8632Cvt &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Cvt() {} ~InstX8632Cvt() override {}
}; };
// cmp - Integer compare instruction. // cmp - Integer compare instruction.
...@@ -1042,15 +1040,15 @@ public: ...@@ -1042,15 +1040,15 @@ public:
return new (Func->allocate<InstX8632Icmp>()) return new (Func->allocate<InstX8632Icmp>())
InstX8632Icmp(Func, Src1, Src2); InstX8632Icmp(Func, Src1, Src2);
} }
virtual void emit(const Cfg *Func) const; void emit(const Cfg *Func) const override;
virtual void dump(const Cfg *Func) const; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return isClassof(Inst, Icmp); } static bool classof(const Inst *Inst) { return isClassof(Inst, Icmp); }
private: private:
InstX8632Icmp(Cfg *Func, Operand *Src1, Operand *Src2); InstX8632Icmp(Cfg *Func, Operand *Src1, Operand *Src2);
InstX8632Icmp(const InstX8632Icmp &) LLVM_DELETED_FUNCTION; InstX8632Icmp(const InstX8632Icmp &) LLVM_DELETED_FUNCTION;
InstX8632Icmp &operator=(const InstX8632Icmp &) LLVM_DELETED_FUNCTION; InstX8632Icmp &operator=(const InstX8632Icmp &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Icmp() {} ~InstX8632Icmp() override {}
}; };
// ucomiss/ucomisd - floating-point compare instruction. // ucomiss/ucomisd - floating-point compare instruction.
...@@ -1060,16 +1058,16 @@ public: ...@@ -1060,16 +1058,16 @@ public:
return new (Func->allocate<InstX8632Ucomiss>()) return new (Func->allocate<InstX8632Ucomiss>())
InstX8632Ucomiss(Func, Src1, Src2); InstX8632Ucomiss(Func, Src1, Src2);
} }
virtual void emit(const Cfg *Func) const; void emit(const Cfg *Func) const override;
virtual void emitIAS(const Cfg *Func) const; void emitIAS(const Cfg *Func) const override;
virtual void dump(const Cfg *Func) const; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return isClassof(Inst, Ucomiss); } static bool classof(const Inst *Inst) { return isClassof(Inst, Ucomiss); }
private: private:
InstX8632Ucomiss(Cfg *Func, Operand *Src1, Operand *Src2); InstX8632Ucomiss(Cfg *Func, Operand *Src1, Operand *Src2);
InstX8632Ucomiss(const InstX8632Ucomiss &) LLVM_DELETED_FUNCTION; InstX8632Ucomiss(const InstX8632Ucomiss &) LLVM_DELETED_FUNCTION;
InstX8632Ucomiss &operator=(const InstX8632Ucomiss &) LLVM_DELETED_FUNCTION; InstX8632Ucomiss &operator=(const InstX8632Ucomiss &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Ucomiss() {} ~InstX8632Ucomiss() override {}
}; };
// UD2 instruction. // UD2 instruction.
...@@ -1078,15 +1076,15 @@ public: ...@@ -1078,15 +1076,15 @@ public:
static InstX8632UD2 *create(Cfg *Func) { static InstX8632UD2 *create(Cfg *Func) {
return new (Func->allocate<InstX8632UD2>()) InstX8632UD2(Func); return new (Func->allocate<InstX8632UD2>()) InstX8632UD2(Func);
} }
virtual void emit(const Cfg *Func) const; void emit(const Cfg *Func) const override;
virtual void dump(const Cfg *Func) const; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return isClassof(Inst, UD2); } static bool classof(const Inst *Inst) { return isClassof(Inst, UD2); }
private: private:
InstX8632UD2(Cfg *Func); InstX8632UD2(Cfg *Func);
InstX8632UD2(const InstX8632UD2 &) LLVM_DELETED_FUNCTION; InstX8632UD2(const InstX8632UD2 &) LLVM_DELETED_FUNCTION;
InstX8632UD2 &operator=(const InstX8632UD2 &) LLVM_DELETED_FUNCTION; InstX8632UD2 &operator=(const InstX8632UD2 &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632UD2() {} ~InstX8632UD2() override {}
}; };
// Test instruction. // Test instruction.
...@@ -1096,15 +1094,15 @@ public: ...@@ -1096,15 +1094,15 @@ public:
return new (Func->allocate<InstX8632Test>()) return new (Func->allocate<InstX8632Test>())
InstX8632Test(Func, Source1, Source2); InstX8632Test(Func, Source1, Source2);
} }
virtual void emit(const Cfg *Func) const; void emit(const Cfg *Func) const override;
virtual void dump(const Cfg *Func) const; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return isClassof(Inst, Test); } static bool classof(const Inst *Inst) { return isClassof(Inst, Test); }
private: private:
InstX8632Test(Cfg *Func, Operand *Source1, Operand *Source2); InstX8632Test(Cfg *Func, Operand *Source1, Operand *Source2);
InstX8632Test(const InstX8632Test &) LLVM_DELETED_FUNCTION; InstX8632Test(const InstX8632Test &) LLVM_DELETED_FUNCTION;
InstX8632Test &operator=(const InstX8632Test &) LLVM_DELETED_FUNCTION; InstX8632Test &operator=(const InstX8632Test &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Test() {} ~InstX8632Test() override {}
}; };
// Mfence instruction. // Mfence instruction.
...@@ -1113,15 +1111,15 @@ public: ...@@ -1113,15 +1111,15 @@ public:
static InstX8632Mfence *create(Cfg *Func) { static InstX8632Mfence *create(Cfg *Func) {
return new (Func->allocate<InstX8632Mfence>()) InstX8632Mfence(Func); return new (Func->allocate<InstX8632Mfence>()) InstX8632Mfence(Func);
} }
virtual void emit(const Cfg *Func) const; void emit(const Cfg *Func) const override;
virtual void dump(const Cfg *Func) const; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return isClassof(Inst, Mfence); } static bool classof(const Inst *Inst) { return isClassof(Inst, Mfence); }
private: private:
InstX8632Mfence(Cfg *Func); InstX8632Mfence(Cfg *Func);
InstX8632Mfence(const InstX8632Mfence &) LLVM_DELETED_FUNCTION; InstX8632Mfence(const InstX8632Mfence &) LLVM_DELETED_FUNCTION;
InstX8632Mfence &operator=(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 // This is essentially a "mov" instruction with an OperandX8632Mem
...@@ -1133,15 +1131,15 @@ public: ...@@ -1133,15 +1131,15 @@ public:
return new (Func->allocate<InstX8632Store>()) return new (Func->allocate<InstX8632Store>())
InstX8632Store(Func, Value, Mem); InstX8632Store(Func, Value, Mem);
} }
virtual void emit(const Cfg *Func) const; void emit(const Cfg *Func) const override;
virtual void dump(const Cfg *Func) const; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return isClassof(Inst, Store); } static bool classof(const Inst *Inst) { return isClassof(Inst, Store); }
private: private:
InstX8632Store(Cfg *Func, Operand *Value, OperandX8632 *Mem); InstX8632Store(Cfg *Func, Operand *Value, OperandX8632 *Mem);
InstX8632Store(const InstX8632Store &) LLVM_DELETED_FUNCTION; InstX8632Store(const InstX8632Store &) LLVM_DELETED_FUNCTION;
InstX8632Store &operator=(const InstX8632Store &) LLVM_DELETED_FUNCTION; InstX8632Store &operator=(const InstX8632Store &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Store() {} ~InstX8632Store() override {}
}; };
class InstX8632StoreP : public InstX8632 { class InstX8632StoreP : public InstX8632 {
...@@ -1150,15 +1148,15 @@ public: ...@@ -1150,15 +1148,15 @@ public:
return new (Func->allocate<InstX8632StoreP>()) return new (Func->allocate<InstX8632StoreP>())
InstX8632StoreP(Func, Value, Mem); InstX8632StoreP(Func, Value, Mem);
} }
virtual void emit(const Cfg *Func) const; void emit(const Cfg *Func) const override;
virtual void dump(const Cfg *Func) const; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return isClassof(Inst, StoreP); } static bool classof(const Inst *Inst) { return isClassof(Inst, StoreP); }
private: private:
InstX8632StoreP(Cfg *Func, Operand *Value, OperandX8632 *Mem); InstX8632StoreP(Cfg *Func, Operand *Value, OperandX8632 *Mem);
InstX8632StoreP(const InstX8632StoreP &) LLVM_DELETED_FUNCTION; InstX8632StoreP(const InstX8632StoreP &) LLVM_DELETED_FUNCTION;
InstX8632StoreP &operator=(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 // This is essentially a "movq" instruction with an OperandX8632Mem
...@@ -1170,15 +1168,15 @@ public: ...@@ -1170,15 +1168,15 @@ public:
return new (Func->allocate<InstX8632StoreQ>()) return new (Func->allocate<InstX8632StoreQ>())
InstX8632StoreQ(Func, Value, Mem); InstX8632StoreQ(Func, Value, Mem);
} }
virtual void emit(const Cfg *Func) const; void emit(const Cfg *Func) const override;
virtual void dump(const Cfg *Func) const; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return isClassof(Inst, StoreQ); } static bool classof(const Inst *Inst) { return isClassof(Inst, StoreQ); }
private: private:
InstX8632StoreQ(Cfg *Func, Operand *Value, OperandX8632 *Mem); InstX8632StoreQ(Cfg *Func, Operand *Value, OperandX8632 *Mem);
InstX8632StoreQ(const InstX8632StoreQ &) LLVM_DELETED_FUNCTION; InstX8632StoreQ(const InstX8632StoreQ &) LLVM_DELETED_FUNCTION;
InstX8632StoreQ &operator=(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 // Movsx - copy from a narrower integer type to a wider integer
...@@ -1189,15 +1187,15 @@ public: ...@@ -1189,15 +1187,15 @@ public:
return new (Func->allocate<InstX8632Movsx>()) return new (Func->allocate<InstX8632Movsx>())
InstX8632Movsx(Func, Dest, Source); InstX8632Movsx(Func, Dest, Source);
} }
virtual void emit(const Cfg *Func) const; void emit(const Cfg *Func) const override;
virtual void dump(const Cfg *Func) const; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return isClassof(Inst, Movsx); } static bool classof(const Inst *Inst) { return isClassof(Inst, Movsx); }
private: private:
InstX8632Movsx(Cfg *Func, Variable *Dest, Operand *Source); InstX8632Movsx(Cfg *Func, Variable *Dest, Operand *Source);
InstX8632Movsx(const InstX8632Movsx &) LLVM_DELETED_FUNCTION; InstX8632Movsx(const InstX8632Movsx &) LLVM_DELETED_FUNCTION;
InstX8632Movsx &operator=(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 // Movzx - copy from a narrower integer type to a wider integer
...@@ -1208,15 +1206,15 @@ public: ...@@ -1208,15 +1206,15 @@ public:
return new (Func->allocate<InstX8632Movzx>()) return new (Func->allocate<InstX8632Movzx>())
InstX8632Movzx(Func, Dest, Source); InstX8632Movzx(Func, Dest, Source);
} }
virtual void emit(const Cfg *Func) const; void emit(const Cfg *Func) const override;
virtual void dump(const Cfg *Func) const; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return isClassof(Inst, Movzx); } static bool classof(const Inst *Inst) { return isClassof(Inst, Movzx); }
private: private:
InstX8632Movzx(Cfg *Func, Variable *Dest, Operand *Source); InstX8632Movzx(Cfg *Func, Variable *Dest, Operand *Source);
InstX8632Movzx(const InstX8632Movzx &) LLVM_DELETED_FUNCTION; InstX8632Movzx(const InstX8632Movzx &) LLVM_DELETED_FUNCTION;
InstX8632Movzx &operator=(const InstX8632Movzx &) LLVM_DELETED_FUNCTION; InstX8632Movzx &operator=(const InstX8632Movzx &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Movzx() {} ~InstX8632Movzx() override {}
}; };
// Nop instructions of varying length // Nop instructions of varying length
...@@ -1228,16 +1226,16 @@ public: ...@@ -1228,16 +1226,16 @@ public:
static InstX8632Nop *create(Cfg *Func, NopVariant Variant) { static InstX8632Nop *create(Cfg *Func, NopVariant Variant) {
return new (Func->allocate<InstX8632Nop>()) InstX8632Nop(Func, Variant); return new (Func->allocate<InstX8632Nop>()) InstX8632Nop(Func, Variant);
} }
virtual void emit(const Cfg *Func) const; void emit(const Cfg *Func) const override;
virtual void emitIAS(const Cfg *Func) const; void emitIAS(const Cfg *Func) const override;
virtual void dump(const Cfg *Func) const; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return isClassof(Inst, Nop); } static bool classof(const Inst *Inst) { return isClassof(Inst, Nop); }
private: private:
InstX8632Nop(Cfg *Func, SizeT Length); InstX8632Nop(Cfg *Func, SizeT Length);
InstX8632Nop(const InstX8632Nop &) LLVM_DELETED_FUNCTION; InstX8632Nop(const InstX8632Nop &) LLVM_DELETED_FUNCTION;
InstX8632Nop &operator=(const InstX8632Nop &) LLVM_DELETED_FUNCTION; InstX8632Nop &operator=(const InstX8632Nop &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Nop() {} ~InstX8632Nop() override {}
NopVariant Variant; NopVariant Variant;
}; };
...@@ -1248,15 +1246,15 @@ public: ...@@ -1248,15 +1246,15 @@ public:
static InstX8632Fld *create(Cfg *Func, Operand *Src) { static InstX8632Fld *create(Cfg *Func, Operand *Src) {
return new (Func->allocate<InstX8632Fld>()) InstX8632Fld(Func, Src); return new (Func->allocate<InstX8632Fld>()) InstX8632Fld(Func, Src);
} }
virtual void emit(const Cfg *Func) const; void emit(const Cfg *Func) const override;
virtual void dump(const Cfg *Func) const; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return isClassof(Inst, Fld); } static bool classof(const Inst *Inst) { return isClassof(Inst, Fld); }
private: private:
InstX8632Fld(Cfg *Func, Operand *Src); InstX8632Fld(Cfg *Func, Operand *Src);
InstX8632Fld(const InstX8632Fld &) LLVM_DELETED_FUNCTION; InstX8632Fld(const InstX8632Fld &) LLVM_DELETED_FUNCTION;
InstX8632Fld &operator=(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). // Fstp - store x87 st(0) into memory and pop st(0).
...@@ -1265,15 +1263,15 @@ public: ...@@ -1265,15 +1263,15 @@ public:
static InstX8632Fstp *create(Cfg *Func, Variable *Dest) { static InstX8632Fstp *create(Cfg *Func, Variable *Dest) {
return new (Func->allocate<InstX8632Fstp>()) InstX8632Fstp(Func, Dest); return new (Func->allocate<InstX8632Fstp>()) InstX8632Fstp(Func, Dest);
} }
virtual void emit(const Cfg *Func) const; void emit(const Cfg *Func) const override;
virtual void dump(const Cfg *Func) const; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return isClassof(Inst, Fstp); } static bool classof(const Inst *Inst) { return isClassof(Inst, Fstp); }
private: private:
InstX8632Fstp(Cfg *Func, Variable *Dest); InstX8632Fstp(Cfg *Func, Variable *Dest);
InstX8632Fstp(const InstX8632Fstp &) LLVM_DELETED_FUNCTION; InstX8632Fstp(const InstX8632Fstp &) LLVM_DELETED_FUNCTION;
InstX8632Fstp &operator=(const InstX8632Fstp &) LLVM_DELETED_FUNCTION; InstX8632Fstp &operator=(const InstX8632Fstp &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Fstp() {} ~InstX8632Fstp() override {}
}; };
class InstX8632Pop : public InstX8632 { class InstX8632Pop : public InstX8632 {
...@@ -1281,16 +1279,16 @@ public: ...@@ -1281,16 +1279,16 @@ public:
static InstX8632Pop *create(Cfg *Func, Variable *Dest) { static InstX8632Pop *create(Cfg *Func, Variable *Dest) {
return new (Func->allocate<InstX8632Pop>()) InstX8632Pop(Func, Dest); return new (Func->allocate<InstX8632Pop>()) InstX8632Pop(Func, Dest);
} }
virtual void emit(const Cfg *Func) const; void emit(const Cfg *Func) const override;
virtual void emitIAS(const Cfg *Func) const; void emitIAS(const Cfg *Func) const override;
virtual void dump(const Cfg *Func) const; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return isClassof(Inst, Pop); } static bool classof(const Inst *Inst) { return isClassof(Inst, Pop); }
private: private:
InstX8632Pop(Cfg *Func, Variable *Dest); InstX8632Pop(Cfg *Func, Variable *Dest);
InstX8632Pop(const InstX8632Pop &) LLVM_DELETED_FUNCTION; InstX8632Pop(const InstX8632Pop &) LLVM_DELETED_FUNCTION;
InstX8632Pop &operator=(const InstX8632Pop &) LLVM_DELETED_FUNCTION; InstX8632Pop &operator=(const InstX8632Pop &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Pop() {} ~InstX8632Pop() override {}
}; };
class InstX8632Push : public InstX8632 { class InstX8632Push : public InstX8632 {
...@@ -1300,8 +1298,8 @@ public: ...@@ -1300,8 +1298,8 @@ public:
return new (Func->allocate<InstX8632Push>()) return new (Func->allocate<InstX8632Push>())
InstX8632Push(Func, Source, SuppressStackAdjustment); InstX8632Push(Func, Source, SuppressStackAdjustment);
} }
virtual void emit(const Cfg *Func) const; void emit(const Cfg *Func) const override;
virtual void dump(const Cfg *Func) const; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return isClassof(Inst, Push); } static bool classof(const Inst *Inst) { return isClassof(Inst, Push); }
private: private:
...@@ -1309,7 +1307,7 @@ private: ...@@ -1309,7 +1307,7 @@ private:
InstX8632Push(const InstX8632Push &) LLVM_DELETED_FUNCTION; InstX8632Push(const InstX8632Push &) LLVM_DELETED_FUNCTION;
InstX8632Push &operator=(const InstX8632Push &) LLVM_DELETED_FUNCTION; InstX8632Push &operator=(const InstX8632Push &) LLVM_DELETED_FUNCTION;
bool SuppressStackAdjustment; bool SuppressStackAdjustment;
virtual ~InstX8632Push() {} ~InstX8632Push() override {}
}; };
// Ret instruction. Currently only supports the "ret" version that // Ret instruction. Currently only supports the "ret" version that
...@@ -1321,16 +1319,16 @@ public: ...@@ -1321,16 +1319,16 @@ public:
static InstX8632Ret *create(Cfg *Func, Variable *Source = NULL) { static InstX8632Ret *create(Cfg *Func, Variable *Source = NULL) {
return new (Func->allocate<InstX8632Ret>()) InstX8632Ret(Func, Source); return new (Func->allocate<InstX8632Ret>()) InstX8632Ret(Func, Source);
} }
virtual void emit(const Cfg *Func) const; void emit(const Cfg *Func) const override;
virtual void emitIAS(const Cfg *Func) const; void emitIAS(const Cfg *Func) const override;
virtual void dump(const Cfg *Func) const; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return isClassof(Inst, Ret); } static bool classof(const Inst *Inst) { return isClassof(Inst, Ret); }
private: private:
InstX8632Ret(Cfg *Func, Variable *Source); InstX8632Ret(Cfg *Func, Variable *Source);
InstX8632Ret(const InstX8632Ret &) LLVM_DELETED_FUNCTION; InstX8632Ret(const InstX8632Ret &) LLVM_DELETED_FUNCTION;
InstX8632Ret &operator=(const InstX8632Ret &) LLVM_DELETED_FUNCTION; InstX8632Ret &operator=(const InstX8632Ret &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Ret() {} ~InstX8632Ret() override {}
}; };
// Exchanging Add instruction. Exchanges the first operand (destination // Exchanging Add instruction. Exchanges the first operand (destination
...@@ -1347,16 +1345,16 @@ public: ...@@ -1347,16 +1345,16 @@ public:
return new (Func->allocate<InstX8632Xadd>()) return new (Func->allocate<InstX8632Xadd>())
InstX8632Xadd(Func, Dest, Source, Locked); InstX8632Xadd(Func, Dest, Source, Locked);
} }
virtual void emit(const Cfg *Func) const; void emit(const Cfg *Func) const override;
virtual void emitIAS(const Cfg *Func) const; void emitIAS(const Cfg *Func) const override;
virtual void dump(const Cfg *Func) const; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return isClassof(Inst, Xadd); } static bool classof(const Inst *Inst) { return isClassof(Inst, Xadd); }
private: private:
InstX8632Xadd(Cfg *Func, Operand *Dest, Variable *Source, bool Locked); InstX8632Xadd(Cfg *Func, Operand *Dest, Variable *Source, bool Locked);
InstX8632Xadd(const InstX8632Xadd &) LLVM_DELETED_FUNCTION; InstX8632Xadd(const InstX8632Xadd &) LLVM_DELETED_FUNCTION;
InstX8632Xadd &operator=(const InstX8632Xadd &) LLVM_DELETED_FUNCTION; InstX8632Xadd &operator=(const InstX8632Xadd &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Xadd() {} ~InstX8632Xadd() override {}
}; };
// Exchange instruction. Exchanges the first operand (destination // Exchange instruction. Exchanges the first operand (destination
...@@ -1371,16 +1369,16 @@ public: ...@@ -1371,16 +1369,16 @@ public:
return new (Func->allocate<InstX8632Xchg>()) return new (Func->allocate<InstX8632Xchg>())
InstX8632Xchg(Func, Dest, Source); InstX8632Xchg(Func, Dest, Source);
} }
virtual void emit(const Cfg *Func) const; void emit(const Cfg *Func) const override;
virtual void emitIAS(const Cfg *Func) const; void emitIAS(const Cfg *Func) const override;
virtual void dump(const Cfg *Func) const; void dump(const Cfg *Func) const override;
static bool classof(const Inst *Inst) { return isClassof(Inst, Xchg); } static bool classof(const Inst *Inst) { return isClassof(Inst, Xchg); }
private: private:
InstX8632Xchg(Cfg *Func, Operand *Dest, Variable *Source); InstX8632Xchg(Cfg *Func, Operand *Dest, Variable *Source);
InstX8632Xchg(const InstX8632Xchg &) LLVM_DELETED_FUNCTION; InstX8632Xchg(const InstX8632Xchg &) LLVM_DELETED_FUNCTION;
InstX8632Xchg &operator=(const InstX8632Xchg &) LLVM_DELETED_FUNCTION; InstX8632Xchg &operator=(const InstX8632Xchg &) LLVM_DELETED_FUNCTION;
virtual ~InstX8632Xchg() {} ~InstX8632Xchg() override {}
}; };
// Declare partial template specializations of emit() methods that // Declare partial template specializations of emit() methods that
......
...@@ -102,9 +102,9 @@ class Constant : public Operand { ...@@ -102,9 +102,9 @@ class Constant : public Operand {
public: public:
uint32_t getPoolEntryID() const { return PoolEntryID; } uint32_t getPoolEntryID() const { return PoolEntryID; }
using Operand::dump; 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 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) { static bool classof(const Operand *Operand) {
OperandKind Kind = Operand->getKind(); OperandKind Kind = Operand->getKind();
...@@ -117,7 +117,7 @@ protected: ...@@ -117,7 +117,7 @@ protected:
Vars = NULL; Vars = NULL;
NumVars = 0; NumVars = 0;
} }
virtual ~Constant() {} ~Constant() override {}
// PoolEntryID is an integer that uniquely identifies the constant // PoolEntryID is an integer that uniquely identifies the constant
// within its constant pool. It is used for building the constant // within its constant pool. It is used for building the constant
// pool in the object code and for referencing its entries. // pool in the object code and for referencing its entries.
...@@ -141,9 +141,9 @@ public: ...@@ -141,9 +141,9 @@ public:
using Constant::emit; using Constant::emit;
// The target needs to implement this for each ConstantPrimitive // The target needs to implement this for each ConstantPrimitive
// specialization. // specialization.
virtual void emit(GlobalContext *Ctx) const; void emit(GlobalContext *Ctx) const override;
using Constant::dump; 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) { static bool classof(const Operand *Operand) {
return Operand->getKind() == K; return Operand->getKind() == K;
...@@ -154,7 +154,7 @@ private: ...@@ -154,7 +154,7 @@ private:
: Constant(K, Ty, PoolEntryID), Value(Value) {} : Constant(K, Ty, PoolEntryID), Value(Value) {}
ConstantPrimitive(const ConstantPrimitive &) LLVM_DELETED_FUNCTION; ConstantPrimitive(const ConstantPrimitive &) LLVM_DELETED_FUNCTION;
ConstantPrimitive &operator=(const ConstantPrimitive &) LLVM_DELETED_FUNCTION; ConstantPrimitive &operator=(const ConstantPrimitive &) LLVM_DELETED_FUNCTION;
virtual ~ConstantPrimitive() {} ~ConstantPrimitive() override {}
const T Value; const T Value;
}; };
...@@ -213,8 +213,8 @@ public: ...@@ -213,8 +213,8 @@ public:
bool getSuppressMangling() const { return SuppressMangling; } bool getSuppressMangling() const { return SuppressMangling; }
using Constant::emit; using Constant::emit;
using Constant::dump; using Constant::dump;
virtual void emit(GlobalContext *Ctx) const; void emit(GlobalContext *Ctx) const override;
virtual void dump(const Cfg *Func, Ostream &Str) const; void dump(const Cfg *Func, Ostream &Str) const override;
static bool classof(const Operand *Operand) { static bool classof(const Operand *Operand) {
OperandKind Kind = Operand->getKind(); OperandKind Kind = Operand->getKind();
...@@ -229,7 +229,7 @@ private: ...@@ -229,7 +229,7 @@ private:
ConstantRelocatable(const ConstantRelocatable &) LLVM_DELETED_FUNCTION; ConstantRelocatable(const ConstantRelocatable &) LLVM_DELETED_FUNCTION;
ConstantRelocatable & ConstantRelocatable &
operator=(const ConstantRelocatable &) LLVM_DELETED_FUNCTION; operator=(const ConstantRelocatable &) LLVM_DELETED_FUNCTION;
virtual ~ConstantRelocatable() {} ~ConstantRelocatable() override {}
const int64_t Offset; // fixed offset to add const int64_t Offset; // fixed offset to add
const IceString Name; // optional for debug/dump const IceString Name; // optional for debug/dump
bool SuppressMangling; bool SuppressMangling;
...@@ -248,8 +248,8 @@ public: ...@@ -248,8 +248,8 @@ public:
using Constant::emit; using Constant::emit;
using Constant::dump; using Constant::dump;
// The target needs to implement this. // The target needs to implement this.
virtual void emit(GlobalContext *Ctx) const; void emit(GlobalContext *Ctx) const override;
virtual void dump(const Cfg *, Ostream &Str) const { Str << "undef"; } void dump(const Cfg *, Ostream &Str) const override { Str << "undef"; }
static bool classof(const Operand *Operand) { static bool classof(const Operand *Operand) {
return Operand->getKind() == kConstUndef; return Operand->getKind() == kConstUndef;
...@@ -260,7 +260,7 @@ private: ...@@ -260,7 +260,7 @@ private:
: Constant(kConstUndef, Ty, PoolEntryID) {} : Constant(kConstUndef, Ty, PoolEntryID) {}
ConstantUndef(const ConstantUndef &) LLVM_DELETED_FUNCTION; ConstantUndef(const ConstantUndef &) LLVM_DELETED_FUNCTION;
ConstantUndef &operator=(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 // RegWeight is a wrapper for a uint32_t weight value, with a
...@@ -415,9 +415,9 @@ public: ...@@ -415,9 +415,9 @@ public:
// VarsReal. // VarsReal.
Variable asType(Type Ty); Variable asType(Type Ty);
virtual void emit(const Cfg *Func) const; void emit(const Cfg *Func) const override;
using Operand::dump; 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) { static bool classof(const Operand *Operand) {
OperandKind Kind = Operand->getKind(); OperandKind Kind = Operand->getKind();
...@@ -425,7 +425,7 @@ public: ...@@ -425,7 +425,7 @@ public:
} }
// The destructor is public because of the asType() method. // The destructor is public because of the asType() method.
virtual ~Variable() {} ~Variable() override {}
protected: protected:
Variable(OperandKind K, Type Ty, SizeT Index, const IceString &Name) Variable(OperandKind K, Type Ty, SizeT Index, const IceString &Name)
......
...@@ -28,36 +28,36 @@ class TargetX8632 : public TargetLowering { ...@@ -28,36 +28,36 @@ class TargetX8632 : public TargetLowering {
public: public:
static TargetX8632 *create(Cfg *Func) { return new TargetX8632(Func); } static TargetX8632 *create(Cfg *Func) { return new TargetX8632(Func); }
virtual void translateOm1(); void translateOm1() override;
virtual void translateO2(); void translateO2() override;
virtual bool doBranchOpt(Inst *I, const CfgNode *NextNode); bool doBranchOpt(Inst *I, const CfgNode *NextNode) override;
virtual Variable *getPhysicalRegister(SizeT RegNum); Variable *getPhysicalRegister(SizeT RegNum) override;
virtual IceString getRegName(SizeT RegNum, Type Ty) const; IceString getRegName(SizeT RegNum, Type Ty) const override;
virtual llvm::SmallBitVector getRegisterSet(RegSetMask Include, llvm::SmallBitVector getRegisterSet(RegSetMask Include,
RegSetMask Exclude) const; RegSetMask Exclude) const override;
virtual const llvm::SmallBitVector &getRegisterSetForType(Type Ty) const { const llvm::SmallBitVector &getRegisterSetForType(Type Ty) const override {
return TypeToRegisterSet[Ty]; return TypeToRegisterSet[Ty];
} }
virtual bool hasFramePointer() const { return IsEbpBasedFrame; } bool hasFramePointer() const override { return IsEbpBasedFrame; }
virtual SizeT getFrameOrStackReg() const { SizeT getFrameOrStackReg() const override {
return IsEbpBasedFrame ? RegX8632::Reg_ebp : RegX8632::Reg_esp; 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, // Round up to the next multiple of 4 bytes. In particular, i1,
// i8, and i16 are rounded up to 4 bytes. // i8, and i16 are rounded up to 4 bytes.
return (typeWidthInBytes(Ty) + 3) & ~3; return (typeWidthInBytes(Ty) + 3) & ~3;
} }
virtual SizeT getBundleAlignLog2Bytes() const { return 5; } SizeT getBundleAlignLog2Bytes() const override { return 5; }
virtual llvm::ArrayRef<uint8_t> getNonExecBundlePadding() const { llvm::ArrayRef<uint8_t> getNonExecBundlePadding() const override {
static const uint8_t Padding[] = { 0xF4 }; static const uint8_t Padding[] = { 0xF4 };
return llvm::ArrayRef<uint8_t>(Padding, 1); return llvm::ArrayRef<uint8_t>(Padding, 1);
} }
virtual void emitVariable(const Variable *Var) const; void emitVariable(const Variable *Var) const override;
virtual void lowerArguments(); void lowerArguments() override;
virtual void addProlog(CfgNode *Node); void addProlog(CfgNode *Node) override;
virtual void addEpilog(CfgNode *Node); void addEpilog(CfgNode *Node) override;
virtual void emitConstants() const; void emitConstants() const override;
SizeT makeNextLabelNumber() { return NextLabelNumber++; } SizeT makeNextLabelNumber() { return NextLabelNumber++; }
// Ensure that a 64-bit Variable has been split into 2 32-bit // Ensure that a 64-bit Variable has been split into 2 32-bit
// Variables, creating them if necessary. This is needed for all // Variables, creating them if necessary. This is needed for all
...@@ -82,29 +82,29 @@ public: ...@@ -82,29 +82,29 @@ public:
protected: protected:
TargetX8632(Cfg *Func); TargetX8632(Cfg *Func);
virtual void postLower(); void postLower() override;
virtual void lowerAlloca(const InstAlloca *Inst); void lowerAlloca(const InstAlloca *Inst) override;
virtual void lowerArithmetic(const InstArithmetic *Inst); void lowerArithmetic(const InstArithmetic *Inst) override;
virtual void lowerAssign(const InstAssign *Inst); void lowerAssign(const InstAssign *Inst) override;
virtual void lowerBr(const InstBr *Inst); void lowerBr(const InstBr *Inst) override;
virtual void lowerCall(const InstCall *Inst); void lowerCall(const InstCall *Inst) override;
virtual void lowerCast(const InstCast *Inst); void lowerCast(const InstCast *Inst) override;
virtual void lowerExtractElement(const InstExtractElement *Inst); void lowerExtractElement(const InstExtractElement *Inst) override;
virtual void lowerFcmp(const InstFcmp *Inst); void lowerFcmp(const InstFcmp *Inst) override;
virtual void lowerIcmp(const InstIcmp *Inst); void lowerIcmp(const InstIcmp *Inst) override;
virtual void lowerIntrinsicCall(const InstIntrinsicCall *Inst); void lowerIntrinsicCall(const InstIntrinsicCall *Inst) override;
virtual void lowerInsertElement(const InstInsertElement *Inst); void lowerInsertElement(const InstInsertElement *Inst) override;
virtual void lowerLoad(const InstLoad *Inst); void lowerLoad(const InstLoad *Inst) override;
virtual void lowerPhi(const InstPhi *Inst); void lowerPhi(const InstPhi *Inst) override;
virtual void lowerRet(const InstRet *Inst); void lowerRet(const InstRet *Inst) override;
virtual void lowerSelect(const InstSelect *Inst); void lowerSelect(const InstSelect *Inst) override;
virtual void lowerStore(const InstStore *Inst); void lowerStore(const InstStore *Inst) override;
virtual void lowerSwitch(const InstSwitch *Inst); void lowerSwitch(const InstSwitch *Inst) override;
virtual void lowerUnreachable(const InstUnreachable *Inst); void lowerUnreachable(const InstUnreachable *Inst) override;
virtual void doAddressOptLoad(); void doAddressOptLoad() override;
virtual void doAddressOptStore(); void doAddressOptStore() override;
virtual void randomlyInsertNop(float Probability); void randomlyInsertNop(float Probability) override;
// Naive lowering of cmpxchg. // Naive lowering of cmpxchg.
void lowerAtomicCmpxchg(Variable *DestPrev, Operand *Ptr, Operand *Expected, void lowerAtomicCmpxchg(Variable *DestPrev, Operand *Ptr, Operand *Expected,
...@@ -477,7 +477,7 @@ protected: ...@@ -477,7 +477,7 @@ protected:
private: private:
TargetX8632(const TargetX8632 &) LLVM_DELETED_FUNCTION; TargetX8632(const TargetX8632 &) LLVM_DELETED_FUNCTION;
TargetX8632 &operator=(const TargetX8632 &) LLVM_DELETED_FUNCTION; TargetX8632 &operator=(const TargetX8632 &) LLVM_DELETED_FUNCTION;
virtual ~TargetX8632() {} ~TargetX8632() override {}
template <typename T> void emitConstantPool() const; template <typename T> void emitConstantPool() const;
}; };
...@@ -486,9 +486,9 @@ public: ...@@ -486,9 +486,9 @@ public:
static TargetGlobalInitLowering *create(GlobalContext *Ctx) { static TargetGlobalInitLowering *create(GlobalContext *Ctx) {
return new TargetGlobalInitX8632(Ctx); return new TargetGlobalInitX8632(Ctx);
} }
virtual void lower(const IceString &Name, SizeT Align, bool IsInternal, void lower(const IceString &Name, SizeT Align, bool IsInternal, bool IsConst,
bool IsConst, bool IsZeroInitializer, SizeT Size, bool IsZeroInitializer, SizeT Size, const char *Data,
const char *Data, bool DisableTranslation); bool DisableTranslation) override;
protected: protected:
TargetGlobalInitX8632(GlobalContext *Ctx); TargetGlobalInitX8632(GlobalContext *Ctx);
...@@ -497,7 +497,7 @@ private: ...@@ -497,7 +497,7 @@ private:
TargetGlobalInitX8632(const TargetGlobalInitX8632 &) LLVM_DELETED_FUNCTION; TargetGlobalInitX8632(const TargetGlobalInitX8632 &) LLVM_DELETED_FUNCTION;
TargetGlobalInitX8632 & TargetGlobalInitX8632 &
operator=(const TargetGlobalInitX8632 &) LLVM_DELETED_FUNCTION; operator=(const TargetGlobalInitX8632 &) LLVM_DELETED_FUNCTION;
virtual ~TargetGlobalInitX8632() {} ~TargetGlobalInitX8632() override {}
}; };
template <> void ConstantInteger32::emit(GlobalContext *Ctx) const; 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