Commit c6ead20c by Jim Stichnoth

Subzero: Improve class definition hygiene.

Delete zero-argument ctor where possible. Delete default copy ctor and default assignment operator where possible (some were missed in the past). (The above are not done to the cross tests because we aren't yet building them with C++11.) Declare single-argument ctor as "explicit". BUG= none R=jfb@chromium.org Review URL: https://codereview.chromium.org/952953002
parent 1e11bf65
...@@ -100,7 +100,7 @@ std::string vectAsString(const typename Vectors<T>::Ty Vect) { ...@@ -100,7 +100,7 @@ std::string vectAsString(const typename Vectors<T>::Ty Vect) {
// TODO: Replace with a portable PRNG from C++11. // TODO: Replace with a portable PRNG from C++11.
class PRNG { class PRNG {
public: public:
PRNG(uint32_t Seed = 1) : State(Seed) {} explicit PRNG(uint32_t Seed = 1) : State(Seed) {}
uint32_t operator()() { uint32_t operator()() {
// Lewis, Goodman, and Miller (1969) // Lewis, Goodman, and Miller (1969)
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
/// ///
/// \file /// \file
/// \brief This file implements a class to represent 64 bit integer constant /// \brief This file implements a class to represent 64 bit integer constant
/// values, and thier conversion to variable bit sized integers. /// values, and their conversion to variable bit sized integers.
/// ///
/// Note: This is a simplified version of llvm/include/llvm/ADT/APInt.h for use /// Note: This is a simplified version of llvm/include/llvm/ADT/APInt.h for use
/// with Subzero. /// with Subzero.
...@@ -23,6 +23,10 @@ ...@@ -23,6 +23,10 @@
namespace Ice { namespace Ice {
class APInt { class APInt {
APInt() = delete;
APInt(const APInt &) = delete;
APInt &operator=(const APInt &) = delete;
public: public:
/// Bits in an (internal) value. /// Bits in an (internal) value.
static const SizeT APINT_BITS_PER_WORD = sizeof(uint64_t) * CHAR_BIT; static const SizeT APINT_BITS_PER_WORD = sizeof(uint64_t) * CHAR_BIT;
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
namespace Ice { namespace Ice {
class Cfg { class Cfg {
Cfg() = delete;
Cfg(const Cfg &) = delete; Cfg(const Cfg &) = delete;
Cfg &operator=(const Cfg &) = delete; Cfg &operator=(const Cfg &) = delete;
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
namespace Ice { namespace Ice {
class CfgNode { class CfgNode {
CfgNode() = delete;
CfgNode(const CfgNode &) = delete; CfgNode(const CfgNode &) = delete;
CfgNode &operator=(const CfgNode &) = delete; CfgNode &operator=(const CfgNode &) = delete;
......
...@@ -20,6 +20,10 @@ ...@@ -20,6 +20,10 @@
namespace Ice { namespace Ice {
class CondX86 { class CondX86 {
CondX86() = delete;
CondX86(const CondX86 &) = delete;
CondX86 &operator=(const CondX86 &) = delete;
public: public:
// An enum of condition codes used for branches and cmov. The enum value // An enum of condition codes used for branches and cmov. The enum value
// should match the value used to encode operands in binary instructions. // should match the value used to encode operands in binary instructions.
......
...@@ -53,11 +53,12 @@ template <typename T> static std::string LLVMObjectAsString(const T *O) { ...@@ -53,11 +53,12 @@ template <typename T> static std::string LLVMObjectAsString(const T *O) {
// respect to Translator. In particular, the unique_ptr ownership // respect to Translator. In particular, the unique_ptr ownership
// rules in LLVM2ICEFunctionConverter. // rules in LLVM2ICEFunctionConverter.
class LLVM2ICEConverter { class LLVM2ICEConverter {
LLVM2ICEConverter() = delete;
LLVM2ICEConverter(const LLVM2ICEConverter &) = delete; LLVM2ICEConverter(const LLVM2ICEConverter &) = delete;
LLVM2ICEConverter &operator=(const LLVM2ICEConverter &) = delete; LLVM2ICEConverter &operator=(const LLVM2ICEConverter &) = delete;
public: public:
LLVM2ICEConverter(Ice::Converter &Converter) explicit LLVM2ICEConverter(Ice::Converter &Converter)
: Converter(Converter), Ctx(Converter.getContext()), : Converter(Converter), Ctx(Converter.getContext()),
TypeConverter(Converter.getModule()->getContext()) {} TypeConverter(Converter.getModule()->getContext()) {}
...@@ -75,12 +76,13 @@ protected: ...@@ -75,12 +76,13 @@ protected:
// Note: this currently assumes that the given IR was verified to be // Note: this currently assumes that the given IR was verified to be
// valid PNaCl bitcode. Otherwise, the behavior is undefined. // valid PNaCl bitcode. Otherwise, the behavior is undefined.
class LLVM2ICEFunctionConverter : LLVM2ICEConverter { class LLVM2ICEFunctionConverter : LLVM2ICEConverter {
LLVM2ICEFunctionConverter() = delete;
LLVM2ICEFunctionConverter(const LLVM2ICEFunctionConverter &) = delete; LLVM2ICEFunctionConverter(const LLVM2ICEFunctionConverter &) = delete;
LLVM2ICEFunctionConverter & LLVM2ICEFunctionConverter &
operator=(const LLVM2ICEFunctionConverter &) = delete; operator=(const LLVM2ICEFunctionConverter &) = delete;
public: public:
LLVM2ICEFunctionConverter(Ice::Converter &Converter) explicit LLVM2ICEFunctionConverter(Ice::Converter &Converter)
: LLVM2ICEConverter(Converter), Func(nullptr) {} : LLVM2ICEConverter(Converter), Func(nullptr) {}
void convertFunction(const Function *F) { void convertFunction(const Function *F) {
...@@ -651,12 +653,13 @@ private: ...@@ -651,12 +653,13 @@ private:
// Note: this currently assumes that the given IR was verified to be // Note: this currently assumes that the given IR was verified to be
// valid PNaCl bitcode. Othewise, the behavior is undefined. // valid PNaCl bitcode. Othewise, the behavior is undefined.
class LLVM2ICEGlobalsConverter : public LLVM2ICEConverter { class LLVM2ICEGlobalsConverter : public LLVM2ICEConverter {
LLVM2ICEGlobalsConverter() = delete;
LLVM2ICEGlobalsConverter(const LLVM2ICEGlobalsConverter &) = delete; LLVM2ICEGlobalsConverter(const LLVM2ICEGlobalsConverter &) = delete;
LLVM2ICEGlobalsConverter & LLVM2ICEGlobalsConverter &
operator-(const LLVM2ICEGlobalsConverter &) = delete; operator-(const LLVM2ICEGlobalsConverter &) = delete;
public: public:
LLVM2ICEGlobalsConverter(Ice::Converter &Converter) explicit LLVM2ICEGlobalsConverter(Ice::Converter &Converter)
: LLVM2ICEConverter(Converter) {} : LLVM2ICEConverter(Converter) {}
/// Converts global variables, and their initializers into ICE /// Converts global variables, and their initializers into ICE
......
...@@ -25,6 +25,7 @@ class Module; ...@@ -25,6 +25,7 @@ class Module;
namespace Ice { namespace Ice {
class Converter : public Translator { class Converter : public Translator {
Converter() = delete;
Converter(const Converter &) = delete; Converter(const Converter &) = delete;
Converter &operator=(const Converter &) = delete; Converter &operator=(const Converter &) = delete;
......
...@@ -48,6 +48,7 @@ namespace Ice { ...@@ -48,6 +48,7 @@ namespace Ice {
// file. Having both -fdata-sections and -ffunction-sections does allow // file. Having both -fdata-sections and -ffunction-sections does allow
// relaxing this requirement. // relaxing this requirement.
class ELFObjectWriter { class ELFObjectWriter {
ELFObjectWriter() = delete;
ELFObjectWriter(const ELFObjectWriter &) = delete; ELFObjectWriter(const ELFObjectWriter &) = delete;
ELFObjectWriter &operator=(const ELFObjectWriter &) = delete; ELFObjectWriter &operator=(const ELFObjectWriter &) = delete;
......
...@@ -28,6 +28,7 @@ class ELFStringTableSection; ...@@ -28,6 +28,7 @@ class ELFStringTableSection;
// Base representation of an ELF section. // Base representation of an ELF section.
class ELFSection { class ELFSection {
ELFSection() = delete;
ELFSection(const ELFSection &) = delete; ELFSection(const ELFSection &) = delete;
ELFSection &operator=(const ELFSection &) = delete; ELFSection &operator=(const ELFSection &) = delete;
...@@ -97,6 +98,7 @@ protected: ...@@ -97,6 +98,7 @@ protected:
// Models text/code sections. Code is written out incrementally and the // Models text/code sections. Code is written out incrementally and the
// size of the section is then updated incrementally. // size of the section is then updated incrementally.
class ELFTextSection : public ELFSection { class ELFTextSection : public ELFSection {
ELFTextSection() = delete;
ELFTextSection(const ELFTextSection &) = delete; ELFTextSection(const ELFTextSection &) = delete;
ELFTextSection &operator=(const ELFTextSection &) = delete; ELFTextSection &operator=(const ELFTextSection &) = delete;
...@@ -110,6 +112,7 @@ public: ...@@ -110,6 +112,7 @@ public:
// size of the section is then updated incrementally. // size of the section is then updated incrementally.
// Some rodata sections may have fixed entsize and duplicates may be mergeable. // Some rodata sections may have fixed entsize and duplicates may be mergeable.
class ELFDataSection : public ELFSection { class ELFDataSection : public ELFSection {
ELFDataSection() = delete;
ELFDataSection(const ELFDataSection &) = delete; ELFDataSection(const ELFDataSection &) = delete;
ELFDataSection &operator=(const ELFDataSection &) = delete; ELFDataSection &operator=(const ELFDataSection &) = delete;
...@@ -155,6 +158,10 @@ struct ELFSym { ...@@ -155,6 +158,10 @@ struct ELFSym {
// Models a symbol table. Symbols may be added up until updateIndices is // Models a symbol table. Symbols may be added up until updateIndices is
// called. At that point the indices of each symbol will be finalized. // called. At that point the indices of each symbol will be finalized.
class ELFSymbolTableSection : public ELFSection { class ELFSymbolTableSection : public ELFSection {
ELFSymbolTableSection() = delete;
ELFSymbolTableSection(const ELFSymbolTableSection &) = delete;
ELFSymbolTableSection &operator=(const ELFSymbolTableSection &) = delete;
public: public:
using ELFSection::ELFSection; using ELFSection::ELFSection;
...@@ -199,6 +206,7 @@ private: ...@@ -199,6 +206,7 @@ private:
// Models a relocation section. // Models a relocation section.
class ELFRelocationSection : public ELFSection { class ELFRelocationSection : public ELFSection {
ELFRelocationSection() = delete;
ELFRelocationSection(const ELFRelocationSection &) = delete; ELFRelocationSection(const ELFRelocationSection &) = delete;
ELFRelocationSection &operator=(const ELFRelocationSection &) = delete; ELFRelocationSection &operator=(const ELFRelocationSection &) = delete;
...@@ -237,6 +245,7 @@ private: ...@@ -237,6 +245,7 @@ private:
// can be discovered and used to fill out section headers and symbol // can be discovered and used to fill out section headers and symbol
// table entries. // table entries.
class ELFStringTableSection : public ELFSection { class ELFStringTableSection : public ELFSection {
ELFStringTableSection() = delete;
ELFStringTableSection(const ELFStringTableSection &) = delete; ELFStringTableSection(const ELFStringTableSection &) = delete;
ELFStringTableSection &operator=(const ELFStringTableSection &) = delete; ELFStringTableSection &operator=(const ELFStringTableSection &) = delete;
......
...@@ -22,6 +22,10 @@ namespace Ice { ...@@ -22,6 +22,10 @@ namespace Ice {
// Low level writer that can that can handle ELFCLASS32/64. // Low level writer that can that can handle ELFCLASS32/64.
// Little endian only for now. // Little endian only for now.
class ELFStreamer { class ELFStreamer {
ELFStreamer() = delete;
ELFStreamer(const ELFStreamer &) = delete;
ELFStreamer &operator=(const ELFStreamer &) = delete;
public: public:
explicit ELFStreamer(Fdstream &Out) : Out(Out) {} explicit ELFStreamer(Fdstream &Out) : Out(Out) {}
......
...@@ -25,7 +25,11 @@ typedef uint32_t FixupKind; ...@@ -25,7 +25,11 @@ typedef uint32_t FixupKind;
// Assembler fixups are positions in generated code/data that hold relocation // Assembler fixups are positions in generated code/data that hold relocation
// information that needs to be processed before finalizing the code/data. // information that needs to be processed before finalizing the code/data.
struct AssemblerFixup { struct AssemblerFixup {
AssemblerFixup &operator=(const AssemblerFixup &) = delete;
public: public:
AssemblerFixup() : position_(0), kind_(0), value_(nullptr) {}
AssemblerFixup(const AssemblerFixup &) = default;
intptr_t position() const { return position_; } intptr_t position() const { return position_; }
void set_position(intptr_t Position) { position_ = Position; } void set_position(intptr_t Position) { position_ = Position; }
......
...@@ -58,6 +58,7 @@ private: ...@@ -58,6 +58,7 @@ private:
}; };
class GlobalContext { class GlobalContext {
GlobalContext() = delete;
GlobalContext(const GlobalContext &) = delete; GlobalContext(const GlobalContext &) = delete;
GlobalContext &operator=(const GlobalContext &) = delete; GlobalContext &operator=(const GlobalContext &) = delete;
...@@ -100,7 +101,11 @@ class GlobalContext { ...@@ -100,7 +101,11 @@ class GlobalContext {
// TimerList is a vector of TimerStack objects, with extra methods // TimerList is a vector of TimerStack objects, with extra methods
// to initialize and merge these vectors. // to initialize and merge these vectors.
class TimerList : public std::vector<TimerStack> { class TimerList : public std::vector<TimerStack> {
TimerList(const TimerList &) = delete;
TimerList &operator=(const TimerList &) = delete;
public: public:
TimerList() = default;
// initInto() initializes a target list of timers based on the // initInto() initializes a target list of timers based on the
// current list. In particular, it creates the same number of // current list. In particular, it creates the same number of
// timers, in the same order, with the same names, but initially // timers, in the same order, with the same names, but initially
...@@ -457,6 +462,7 @@ public: ...@@ -457,6 +462,7 @@ public:
// pushes a marker, and the destructor pops it. This is for // pushes a marker, and the destructor pops it. This is for
// convenient timing of regions of code. // convenient timing of regions of code.
class TimerMarker { class TimerMarker {
TimerMarker() = delete;
TimerMarker(const TimerMarker &) = delete; TimerMarker(const TimerMarker &) = delete;
TimerMarker &operator=(const TimerMarker &) = delete; TimerMarker &operator=(const TimerMarker &) = delete;
......
...@@ -30,6 +30,7 @@ namespace Ice { ...@@ -30,6 +30,7 @@ namespace Ice {
/// Base class for global variable and function declarations. /// Base class for global variable and function declarations.
class GlobalDeclaration { class GlobalDeclaration {
GlobalDeclaration() = delete;
GlobalDeclaration(const GlobalDeclaration &) = delete; GlobalDeclaration(const GlobalDeclaration &) = delete;
GlobalDeclaration &operator=(const GlobalDeclaration &) = delete; GlobalDeclaration &operator=(const GlobalDeclaration &) = delete;
...@@ -89,6 +90,7 @@ protected: ...@@ -89,6 +90,7 @@ protected:
// Models a function declaration. This includes the type signature of // Models a function declaration. This includes the type signature of
// the function, its calling conventions, and its linkage. // the function, its calling conventions, and its linkage.
class FunctionDeclaration : public GlobalDeclaration { class FunctionDeclaration : public GlobalDeclaration {
FunctionDeclaration() = delete;
FunctionDeclaration(const FunctionDeclaration &) = delete; FunctionDeclaration(const FunctionDeclaration &) = delete;
FunctionDeclaration &operator=(const FunctionDeclaration &) = delete; FunctionDeclaration &operator=(const FunctionDeclaration &) = delete;
......
...@@ -35,6 +35,7 @@ namespace Ice { ...@@ -35,6 +35,7 @@ namespace Ice {
// from InstHighLevel, and low-level (target-specific) ICE // from InstHighLevel, and low-level (target-specific) ICE
// instructions inherit from InstTarget. // instructions inherit from InstTarget.
class Inst : public llvm::ilist_node<Inst> { class Inst : public llvm::ilist_node<Inst> {
Inst() = delete;
Inst(const Inst &) = delete; Inst(const Inst &) = delete;
Inst &operator=(const Inst &) = delete; Inst &operator=(const Inst &) = delete;
...@@ -44,7 +45,6 @@ public: ...@@ -44,7 +45,6 @@ public:
Unreachable, Unreachable,
Alloca, Alloca,
Arithmetic, Arithmetic,
Assign, // not part of LLVM/PNaCl bitcode
Br, Br,
Call, Call,
Cast, Cast,
...@@ -59,6 +59,7 @@ public: ...@@ -59,6 +59,7 @@ public:
Select, Select,
Store, Store,
Switch, Switch,
Assign, // not part of LLVM/PNaCl bitcode
BundleLock, // not part of LLVM/PNaCl bitcode BundleLock, // not part of LLVM/PNaCl bitcode
BundleUnlock, // not part of LLVM/PNaCl bitcode BundleUnlock, // not part of LLVM/PNaCl bitcode
FakeDef, // not part of LLVM/PNaCl bitcode FakeDef, // not part of LLVM/PNaCl bitcode
...@@ -207,6 +208,7 @@ protected: ...@@ -207,6 +208,7 @@ protected:
}; };
class InstHighLevel : public Inst { class InstHighLevel : public Inst {
InstHighLevel() = delete;
InstHighLevel(const InstHighLevel &) = delete; InstHighLevel(const InstHighLevel &) = delete;
InstHighLevel &operator=(const InstHighLevel &) = delete; InstHighLevel &operator=(const InstHighLevel &) = delete;
...@@ -226,6 +228,7 @@ protected: ...@@ -226,6 +228,7 @@ protected:
// 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 InstHighLevel { class InstAlloca : public InstHighLevel {
InstAlloca() = delete;
InstAlloca(const InstAlloca &) = delete; InstAlloca(const InstAlloca &) = delete;
InstAlloca &operator=(const InstAlloca &) = delete; InstAlloca &operator=(const InstAlloca &) = delete;
...@@ -250,6 +253,7 @@ private: ...@@ -250,6 +253,7 @@ private:
// 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 InstHighLevel { class InstArithmetic : public InstHighLevel {
InstArithmetic() = delete;
InstArithmetic(const InstArithmetic &) = delete; InstArithmetic(const InstArithmetic &) = delete;
InstArithmetic &operator=(const InstArithmetic &) = delete; InstArithmetic &operator=(const InstArithmetic &) = delete;
...@@ -289,6 +293,7 @@ private: ...@@ -289,6 +293,7 @@ private:
// 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 InstHighLevel { class InstAssign : public InstHighLevel {
InstAssign() = delete;
InstAssign(const InstAssign &) = delete; InstAssign(const InstAssign &) = delete;
InstAssign &operator=(const InstAssign &) = delete; InstAssign &operator=(const InstAssign &) = delete;
...@@ -308,6 +313,7 @@ private: ...@@ -308,6 +313,7 @@ private:
// Branch instruction. This represents both conditional and // Branch instruction. This represents both conditional and
// unconditional branches. // unconditional branches.
class InstBr : public InstHighLevel { class InstBr : public InstHighLevel {
InstBr() = delete;
InstBr(const InstBr &) = delete; InstBr(const InstBr &) = delete;
InstBr &operator=(const InstBr &) = delete; InstBr &operator=(const InstBr &) = delete;
...@@ -354,6 +360,7 @@ private: ...@@ -354,6 +360,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 InstHighLevel { class InstCall : public InstHighLevel {
InstCall() = delete;
InstCall(const InstCall &) = delete; InstCall(const InstCall &) = delete;
InstCall &operator=(const InstCall &) = delete; InstCall &operator=(const InstCall &) = delete;
...@@ -392,6 +399,7 @@ private: ...@@ -392,6 +399,7 @@ private:
// Cast instruction (a.k.a. conversion operation). // Cast instruction (a.k.a. conversion operation).
class InstCast : public InstHighLevel { class InstCast : public InstHighLevel {
InstCast() = delete;
InstCast(const InstCast &) = delete; InstCast(const InstCast &) = delete;
InstCast &operator=(const InstCast &) = delete; InstCast &operator=(const InstCast &) = delete;
...@@ -422,6 +430,7 @@ private: ...@@ -422,6 +430,7 @@ private:
// ExtractElement instruction. // ExtractElement instruction.
class InstExtractElement : public InstHighLevel { class InstExtractElement : public InstHighLevel {
InstExtractElement() = delete;
InstExtractElement(const InstExtractElement &) = delete; InstExtractElement(const InstExtractElement &) = delete;
InstExtractElement &operator=(const InstExtractElement &) = delete; InstExtractElement &operator=(const InstExtractElement &) = delete;
...@@ -446,6 +455,7 @@ private: ...@@ -446,6 +455,7 @@ private:
// 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 InstHighLevel { class InstFcmp : public InstHighLevel {
InstFcmp() = delete;
InstFcmp(const InstFcmp &) = delete; InstFcmp(const InstFcmp &) = delete;
InstFcmp &operator=(const InstFcmp &) = delete; InstFcmp &operator=(const InstFcmp &) = delete;
...@@ -476,6 +486,7 @@ private: ...@@ -476,6 +486,7 @@ private:
// 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 InstHighLevel { class InstIcmp : public InstHighLevel {
InstIcmp() = delete;
InstIcmp(const InstIcmp &) = delete; InstIcmp(const InstIcmp &) = delete;
InstIcmp &operator=(const InstIcmp &) = delete; InstIcmp &operator=(const InstIcmp &) = delete;
...@@ -505,6 +516,7 @@ private: ...@@ -505,6 +516,7 @@ private:
// InsertElement instruction. // InsertElement instruction.
class InstInsertElement : public InstHighLevel { class InstInsertElement : public InstHighLevel {
InstInsertElement() = delete;
InstInsertElement(const InstInsertElement &) = delete; InstInsertElement(const InstInsertElement &) = delete;
InstInsertElement &operator=(const InstInsertElement &) = delete; InstInsertElement &operator=(const InstInsertElement &) = delete;
...@@ -529,6 +541,7 @@ private: ...@@ -529,6 +541,7 @@ private:
// 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),
// and arg I is captured as getSrc(I+1). // and arg I is captured as getSrc(I+1).
class InstIntrinsicCall : public InstCall { class InstIntrinsicCall : public InstCall {
InstIntrinsicCall() = delete;
InstIntrinsicCall(const InstIntrinsicCall &) = delete; InstIntrinsicCall(const InstIntrinsicCall &) = delete;
InstIntrinsicCall &operator=(const InstIntrinsicCall &) = delete; InstIntrinsicCall &operator=(const InstIntrinsicCall &) = delete;
...@@ -557,6 +570,7 @@ private: ...@@ -557,6 +570,7 @@ private:
// Load instruction. The source address is captured in getSrc(0). // Load instruction. The source address is captured in getSrc(0).
class InstLoad : public InstHighLevel { class InstLoad : public InstHighLevel {
InstLoad() = delete;
InstLoad(const InstLoad &) = delete; InstLoad(const InstLoad &) = delete;
InstLoad &operator=(const InstLoad &) = delete; InstLoad &operator=(const InstLoad &) = delete;
...@@ -579,6 +593,7 @@ private: ...@@ -579,6 +593,7 @@ private:
// 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 InstHighLevel { class InstPhi : public InstHighLevel {
InstPhi() = delete;
InstPhi(const InstPhi &) = delete; InstPhi(const InstPhi &) = delete;
InstPhi &operator=(const InstPhi &) = delete; InstPhi &operator=(const InstPhi &) = delete;
...@@ -613,6 +628,7 @@ private: ...@@ -613,6 +628,7 @@ private:
// 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 InstHighLevel { class InstRet : public InstHighLevel {
InstRet() = delete;
InstRet(const InstRet &) = delete; InstRet(const InstRet &) = delete;
InstRet &operator=(const InstRet &) = delete; InstRet &operator=(const InstRet &) = delete;
...@@ -636,6 +652,7 @@ private: ...@@ -636,6 +652,7 @@ private:
// Select instruction. The condition, true, and false operands are captured. // Select instruction. The condition, true, and false operands are captured.
class InstSelect : public InstHighLevel { class InstSelect : public InstHighLevel {
InstSelect() = delete;
InstSelect(const InstSelect &) = delete; InstSelect(const InstSelect &) = delete;
InstSelect &operator=(const InstSelect &) = delete; InstSelect &operator=(const InstSelect &) = delete;
...@@ -660,6 +677,7 @@ private: ...@@ -660,6 +677,7 @@ private:
// 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 InstHighLevel { class InstStore : public InstHighLevel {
InstStore() = delete;
InstStore(const InstStore &) = delete; InstStore(const InstStore &) = delete;
InstStore &operator=(const InstStore &) = delete; InstStore &operator=(const InstStore &) = delete;
...@@ -683,6 +701,7 @@ private: ...@@ -683,6 +701,7 @@ private:
// 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 InstHighLevel { class InstSwitch : public InstHighLevel {
InstSwitch() = delete;
InstSwitch(const InstSwitch &) = delete; InstSwitch(const InstSwitch &) = delete;
InstSwitch &operator=(const InstSwitch &) = delete; InstSwitch &operator=(const InstSwitch &) = delete;
...@@ -727,6 +746,7 @@ private: ...@@ -727,6 +746,7 @@ private:
// Unreachable instruction. This is a terminator instruction with no // Unreachable instruction. This is a terminator instruction with no
// operands. // operands.
class InstUnreachable : public InstHighLevel { class InstUnreachable : public InstHighLevel {
InstUnreachable() = delete;
InstUnreachable(const InstUnreachable &) = delete; InstUnreachable(const InstUnreachable &) = delete;
InstUnreachable &operator=(const InstUnreachable &) = delete; InstUnreachable &operator=(const InstUnreachable &) = delete;
...@@ -741,13 +761,14 @@ public: ...@@ -741,13 +761,14 @@ public:
} }
private: private:
InstUnreachable(Cfg *Func); explicit InstUnreachable(Cfg *Func);
~InstUnreachable() override {} ~InstUnreachable() override {}
}; };
// BundleLock instruction. There are no operands. Contains an option // BundleLock instruction. There are no operands. Contains an option
// indicating whether align_to_end is specified. // indicating whether align_to_end is specified.
class InstBundleLock : public InstHighLevel { class InstBundleLock : public InstHighLevel {
InstBundleLock() = delete;
InstBundleLock(const InstBundleLock &) = delete; InstBundleLock(const InstBundleLock &) = delete;
InstBundleLock &operator=(const InstBundleLock &) = delete; InstBundleLock &operator=(const InstBundleLock &) = delete;
...@@ -773,6 +794,7 @@ private: ...@@ -773,6 +794,7 @@ private:
// BundleUnlock instruction. There are no operands. // BundleUnlock instruction. There are no operands.
class InstBundleUnlock : public InstHighLevel { class InstBundleUnlock : public InstHighLevel {
InstBundleUnlock() = delete;
InstBundleUnlock(const InstBundleUnlock &) = delete; InstBundleUnlock(const InstBundleUnlock &) = delete;
InstBundleUnlock &operator=(const InstBundleUnlock &) = delete; InstBundleUnlock &operator=(const InstBundleUnlock &) = delete;
...@@ -805,6 +827,7 @@ private: ...@@ -805,6 +827,7 @@ private:
// 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 InstHighLevel { class InstFakeDef : public InstHighLevel {
InstFakeDef() = delete;
InstFakeDef(const InstFakeDef &) = delete; InstFakeDef(const InstFakeDef &) = delete;
InstFakeDef &operator=(const InstFakeDef &) = delete; InstFakeDef &operator=(const InstFakeDef &) = delete;
...@@ -829,6 +852,7 @@ private: ...@@ -829,6 +852,7 @@ private:
// 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 InstHighLevel { class InstFakeUse : public InstHighLevel {
InstFakeUse() = delete;
InstFakeUse(const InstFakeUse &) = delete; InstFakeUse(const InstFakeUse &) = delete;
InstFakeUse &operator=(const InstFakeUse &) = delete; InstFakeUse &operator=(const InstFakeUse &) = delete;
...@@ -857,6 +881,7 @@ private: ...@@ -857,6 +881,7 @@ private:
// 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 InstHighLevel { class InstFakeKill : public InstHighLevel {
InstFakeKill() = delete;
InstFakeKill(const InstFakeKill &) = delete; InstFakeKill(const InstFakeKill &) = delete;
InstFakeKill &operator=(const InstFakeKill &) = delete; InstFakeKill &operator=(const InstFakeKill &) = delete;
...@@ -881,6 +906,7 @@ private: ...@@ -881,6 +906,7 @@ 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() = delete;
InstTarget(const InstTarget &) = delete; InstTarget(const InstTarget &) = delete;
InstTarget &operator=(const InstTarget &) = delete; InstTarget &operator=(const InstTarget &) = delete;
......
...@@ -30,6 +30,7 @@ class TargetX8632; ...@@ -30,6 +30,7 @@ class TargetX8632;
// OperandX8632 extends the Operand hierarchy. Its subclasses are // OperandX8632 extends the Operand hierarchy. Its subclasses are
// OperandX8632Mem and VariableSplit. // OperandX8632Mem and VariableSplit.
class OperandX8632 : public Operand { class OperandX8632 : public Operand {
OperandX8632() = delete;
OperandX8632(const OperandX8632 &) = delete; OperandX8632(const OperandX8632 &) = delete;
OperandX8632 &operator=(const OperandX8632 &) = delete; OperandX8632 &operator=(const OperandX8632 &) = delete;
...@@ -51,6 +52,7 @@ protected: ...@@ -51,6 +52,7 @@ protected:
// base and index registers, a constant offset, and a fixed shift // base and index registers, a constant offset, and a fixed shift
// value for the index register. // value for the index register.
class OperandX8632Mem : public OperandX8632 { class OperandX8632Mem : public OperandX8632 {
OperandX8632Mem() = delete;
OperandX8632Mem(const OperandX8632Mem &) = delete; OperandX8632Mem(const OperandX8632Mem &) = delete;
OperandX8632Mem &operator=(const OperandX8632Mem &) = delete; OperandX8632Mem &operator=(const OperandX8632Mem &) = delete;
...@@ -102,6 +104,7 @@ private: ...@@ -102,6 +104,7 @@ private:
// lowering forces the f64 to be spilled to the stack and then // lowering forces the f64 to be spilled to the stack and then
// accesses through the VariableSplit. // accesses through the VariableSplit.
class VariableSplit : public OperandX8632 { class VariableSplit : public OperandX8632 {
VariableSplit() = delete;
VariableSplit(const VariableSplit &) = delete; VariableSplit(const VariableSplit &) = delete;
VariableSplit &operator=(const VariableSplit &) = delete; VariableSplit &operator=(const VariableSplit &) = delete;
...@@ -141,6 +144,7 @@ private: ...@@ -141,6 +144,7 @@ private:
// register. If the linked Variable has a stack slot, then the // register. If the linked Variable has a stack slot, then the
// Variable and SpillVariable share that slot. // Variable and SpillVariable share that slot.
class SpillVariable : public Variable { class SpillVariable : public Variable {
SpillVariable() = delete;
SpillVariable(const SpillVariable &) = delete; SpillVariable(const SpillVariable &) = delete;
SpillVariable &operator=(const SpillVariable &) = delete; SpillVariable &operator=(const SpillVariable &) = delete;
...@@ -163,6 +167,7 @@ private: ...@@ -163,6 +167,7 @@ private:
}; };
class InstX8632 : public InstTarget { class InstX8632 : public InstTarget {
InstX8632() = delete;
InstX8632(const InstX8632 &) = delete; InstX8632(const InstX8632 &) = delete;
InstX8632 &operator=(const InstX8632 &) = delete; InstX8632 &operator=(const InstX8632 &) = delete;
...@@ -308,6 +313,7 @@ protected: ...@@ -308,6 +313,7 @@ protected:
// it may be prevented by running dead code elimination before // it may be prevented by running dead code elimination before
// lowering. // lowering.
class InstX8632Label : public InstX8632 { class InstX8632Label : public InstX8632 {
InstX8632Label() = delete;
InstX8632Label(const InstX8632Label &) = delete; InstX8632Label(const InstX8632Label &) = delete;
InstX8632Label &operator=(const InstX8632Label &) = delete; InstX8632Label &operator=(const InstX8632Label &) = delete;
...@@ -330,6 +336,7 @@ private: ...@@ -330,6 +336,7 @@ private:
// Conditional and unconditional branch instruction. // Conditional and unconditional branch instruction.
class InstX8632Br : public InstX8632 { class InstX8632Br : public InstX8632 {
InstX8632Br() = delete;
InstX8632Br(const InstX8632Br &) = delete; InstX8632Br(const InstX8632Br &) = delete;
InstX8632Br &operator=(const InstX8632Br &) = delete; InstX8632Br &operator=(const InstX8632Br &) = delete;
...@@ -405,6 +412,7 @@ private: ...@@ -405,6 +412,7 @@ private:
// naclret, unreachable. This is different from a Branch instruction // naclret, unreachable. This is different from a Branch instruction
// in that there is no intra-function control flow to represent. // in that there is no intra-function control flow to represent.
class InstX8632Jmp : public InstX8632 { class InstX8632Jmp : public InstX8632 {
InstX8632Jmp() = delete;
InstX8632Jmp(const InstX8632Jmp &) = delete; InstX8632Jmp(const InstX8632Jmp &) = delete;
InstX8632Jmp &operator=(const InstX8632Jmp &) = delete; InstX8632Jmp &operator=(const InstX8632Jmp &) = delete;
...@@ -425,6 +433,7 @@ private: ...@@ -425,6 +433,7 @@ private:
// AdjustStack instruction - subtracts esp by the given amount and // AdjustStack instruction - subtracts esp by the given amount and
// updates the stack offset during code emission. // updates the stack offset during code emission.
class InstX8632AdjustStack : public InstX8632 { class InstX8632AdjustStack : public InstX8632 {
InstX8632AdjustStack() = delete;
InstX8632AdjustStack(const InstX8632AdjustStack &) = delete; InstX8632AdjustStack(const InstX8632AdjustStack &) = delete;
InstX8632AdjustStack &operator=(const InstX8632AdjustStack &) = delete; InstX8632AdjustStack &operator=(const InstX8632AdjustStack &) = delete;
...@@ -445,6 +454,7 @@ private: ...@@ -445,6 +454,7 @@ private:
// Call instruction. Arguments should have already been pushed. // Call instruction. Arguments should have already been pushed.
class InstX8632Call : public InstX8632 { class InstX8632Call : public InstX8632 {
InstX8632Call() = delete;
InstX8632Call(const InstX8632Call &) = delete; InstX8632Call(const InstX8632Call &) = delete;
InstX8632Call &operator=(const InstX8632Call &) = delete; InstX8632Call &operator=(const InstX8632Call &) = delete;
...@@ -471,6 +481,7 @@ void emitIASOpTyGPR(const Cfg *Func, Type Ty, const Operand *Var, ...@@ -471,6 +481,7 @@ void emitIASOpTyGPR(const Cfg *Func, Type Ty, const Operand *Var,
// Instructions of the form x := op(x). // Instructions of the form x := op(x).
template <InstX8632::InstKindX8632 K> template <InstX8632::InstKindX8632 K>
class InstX8632InplaceopGPR : public InstX8632 { class InstX8632InplaceopGPR : public InstX8632 {
InstX8632InplaceopGPR() = delete;
InstX8632InplaceopGPR(const InstX8632InplaceopGPR &) = delete; InstX8632InplaceopGPR(const InstX8632InplaceopGPR &) = delete;
InstX8632InplaceopGPR &operator=(const InstX8632InplaceopGPR &) = delete; InstX8632InplaceopGPR &operator=(const InstX8632InplaceopGPR &) = delete;
...@@ -523,6 +534,7 @@ void emitIASRegOpTyGPR(const Cfg *Func, Type Ty, const Variable *Dst, ...@@ -523,6 +534,7 @@ void emitIASRegOpTyGPR(const Cfg *Func, Type Ty, const Variable *Dst,
// Instructions of the form x := op(y). // Instructions of the form x := op(y).
template <InstX8632::InstKindX8632 K> template <InstX8632::InstKindX8632 K>
class InstX8632UnaryopGPR : public InstX8632 { class InstX8632UnaryopGPR : public InstX8632 {
InstX8632UnaryopGPR() = delete;
InstX8632UnaryopGPR(const InstX8632UnaryopGPR &) = delete; InstX8632UnaryopGPR(const InstX8632UnaryopGPR &) = delete;
InstX8632UnaryopGPR &operator=(const InstX8632UnaryopGPR &) = delete; InstX8632UnaryopGPR &operator=(const InstX8632UnaryopGPR &) = delete;
...@@ -582,6 +594,7 @@ void emitIASRegOpTyXMM(const Cfg *Func, Type Ty, const Variable *Var, ...@@ -582,6 +594,7 @@ void emitIASRegOpTyXMM(const Cfg *Func, Type Ty, const Variable *Var,
template <InstX8632::InstKindX8632 K> template <InstX8632::InstKindX8632 K>
class InstX8632UnaryopXmm : public InstX8632 { class InstX8632UnaryopXmm : public InstX8632 {
InstX8632UnaryopXmm() = delete;
InstX8632UnaryopXmm(const InstX8632UnaryopXmm &) = delete; InstX8632UnaryopXmm(const InstX8632UnaryopXmm &) = delete;
InstX8632UnaryopXmm &operator=(const InstX8632UnaryopXmm &) = delete; InstX8632UnaryopXmm &operator=(const InstX8632UnaryopXmm &) = delete;
...@@ -636,6 +649,7 @@ void emitIASGPRShift(const Cfg *Func, Type Ty, const Variable *Var, ...@@ -636,6 +649,7 @@ void emitIASGPRShift(const Cfg *Func, Type Ty, const Variable *Var,
template <InstX8632::InstKindX8632 K> template <InstX8632::InstKindX8632 K>
class InstX8632BinopGPRShift : public InstX8632 { class InstX8632BinopGPRShift : public InstX8632 {
InstX8632BinopGPRShift() = delete;
InstX8632BinopGPRShift(const InstX8632BinopGPRShift &) = delete; InstX8632BinopGPRShift(const InstX8632BinopGPRShift &) = delete;
InstX8632BinopGPRShift &operator=(const InstX8632BinopGPRShift &) = delete; InstX8632BinopGPRShift &operator=(const InstX8632BinopGPRShift &) = delete;
...@@ -680,6 +694,7 @@ private: ...@@ -680,6 +694,7 @@ private:
template <InstX8632::InstKindX8632 K> template <InstX8632::InstKindX8632 K>
class InstX8632BinopGPR : public InstX8632 { class InstX8632BinopGPR : public InstX8632 {
InstX8632BinopGPR() = delete;
InstX8632BinopGPR(const InstX8632BinopGPR &) = delete; InstX8632BinopGPR(const InstX8632BinopGPR &) = delete;
InstX8632BinopGPR &operator=(const InstX8632BinopGPR &) = delete; InstX8632BinopGPR &operator=(const InstX8632BinopGPR &) = delete;
...@@ -723,6 +738,7 @@ private: ...@@ -723,6 +738,7 @@ private:
template <InstX8632::InstKindX8632 K, bool NeedsElementType> template <InstX8632::InstKindX8632 K, bool NeedsElementType>
class InstX8632BinopXmm : public InstX8632 { class InstX8632BinopXmm : public InstX8632 {
InstX8632BinopXmm() = delete;
InstX8632BinopXmm(const InstX8632BinopXmm &) = delete; InstX8632BinopXmm(const InstX8632BinopXmm &) = delete;
InstX8632BinopXmm &operator=(const InstX8632BinopXmm &) = delete; InstX8632BinopXmm &operator=(const InstX8632BinopXmm &) = delete;
...@@ -772,6 +788,7 @@ void emitIASXmmShift(const Cfg *Func, Type Ty, const Variable *Var, ...@@ -772,6 +788,7 @@ void emitIASXmmShift(const Cfg *Func, Type Ty, const Variable *Var,
template <InstX8632::InstKindX8632 K> template <InstX8632::InstKindX8632 K>
class InstX8632BinopXmmShift : public InstX8632 { class InstX8632BinopXmmShift : public InstX8632 {
InstX8632BinopXmmShift() = delete;
InstX8632BinopXmmShift(const InstX8632BinopXmmShift &) = delete; InstX8632BinopXmmShift(const InstX8632BinopXmmShift &) = delete;
InstX8632BinopXmmShift &operator=(const InstX8632BinopXmmShift &) = delete; InstX8632BinopXmmShift &operator=(const InstX8632BinopXmmShift &) = delete;
...@@ -818,6 +835,7 @@ private: ...@@ -818,6 +835,7 @@ private:
}; };
template <InstX8632::InstKindX8632 K> class InstX8632Ternop : public InstX8632 { template <InstX8632::InstKindX8632 K> class InstX8632Ternop : public InstX8632 {
InstX8632Ternop() = delete;
InstX8632Ternop(const InstX8632Ternop &) = delete; InstX8632Ternop(const InstX8632Ternop &) = delete;
InstX8632Ternop &operator=(const InstX8632Ternop &) = delete; InstX8632Ternop &operator=(const InstX8632Ternop &) = delete;
...@@ -865,6 +883,7 @@ private: ...@@ -865,6 +883,7 @@ private:
// Instructions of the form x := y op z // Instructions of the form x := y op z
template <InstX8632::InstKindX8632 K> template <InstX8632::InstKindX8632 K>
class InstX8632ThreeAddressop : public InstX8632 { class InstX8632ThreeAddressop : public InstX8632 {
InstX8632ThreeAddressop() = delete;
InstX8632ThreeAddressop(const InstX8632ThreeAddressop &) = delete; InstX8632ThreeAddressop(const InstX8632ThreeAddressop &) = delete;
InstX8632ThreeAddressop &operator=(const InstX8632ThreeAddressop &) = delete; InstX8632ThreeAddressop &operator=(const InstX8632ThreeAddressop &) = delete;
...@@ -913,6 +932,7 @@ bool checkForRedundantAssign(const Variable *Dest, const Operand *Source); ...@@ -913,6 +932,7 @@ bool checkForRedundantAssign(const Variable *Dest, const Operand *Source);
// Base class for assignment instructions // Base class for assignment instructions
template <InstX8632::InstKindX8632 K> template <InstX8632::InstKindX8632 K>
class InstX8632Movlike : public InstX8632 { class InstX8632Movlike : public InstX8632 {
InstX8632Movlike() = delete;
InstX8632Movlike(const InstX8632Movlike &) = delete; InstX8632Movlike(const InstX8632Movlike &) = delete;
InstX8632Movlike &operator=(const InstX8632Movlike &) = delete; InstX8632Movlike &operator=(const InstX8632Movlike &) = delete;
...@@ -1018,6 +1038,7 @@ typedef InstX8632ThreeAddressop<InstX8632::Pshufd> InstX8632Pshufd; ...@@ -1018,6 +1038,7 @@ typedef InstX8632ThreeAddressop<InstX8632::Pshufd> InstX8632Pshufd;
// Base class for a lockable x86-32 instruction (emits a locked prefix). // Base class for a lockable x86-32 instruction (emits a locked prefix).
class InstX8632Lockable : public InstX8632 { class InstX8632Lockable : public InstX8632 {
InstX8632Lockable() = delete;
InstX8632Lockable(const InstX8632Lockable &) = delete; InstX8632Lockable(const InstX8632Lockable &) = delete;
InstX8632Lockable &operator=(const InstX8632Lockable &) = delete; InstX8632Lockable &operator=(const InstX8632Lockable &) = delete;
...@@ -1036,6 +1057,7 @@ protected: ...@@ -1036,6 +1057,7 @@ protected:
// Mul instruction - unsigned multiply. // Mul instruction - unsigned multiply.
class InstX8632Mul : public InstX8632 { class InstX8632Mul : public InstX8632 {
InstX8632Mul() = delete;
InstX8632Mul(const InstX8632Mul &) = delete; InstX8632Mul(const InstX8632Mul &) = delete;
InstX8632Mul &operator=(const InstX8632Mul &) = delete; InstX8632Mul &operator=(const InstX8632Mul &) = delete;
...@@ -1057,6 +1079,7 @@ private: ...@@ -1057,6 +1079,7 @@ private:
// Shld instruction - shift across a pair of operands. // Shld instruction - shift across a pair of operands.
class InstX8632Shld : public InstX8632 { class InstX8632Shld : public InstX8632 {
InstX8632Shld() = delete;
InstX8632Shld(const InstX8632Shld &) = delete; InstX8632Shld(const InstX8632Shld &) = delete;
InstX8632Shld &operator=(const InstX8632Shld &) = delete; InstX8632Shld &operator=(const InstX8632Shld &) = delete;
...@@ -1079,6 +1102,7 @@ private: ...@@ -1079,6 +1102,7 @@ private:
// Shrd instruction - shift across a pair of operands. // Shrd instruction - shift across a pair of operands.
class InstX8632Shrd : public InstX8632 { class InstX8632Shrd : public InstX8632 {
InstX8632Shrd() = delete;
InstX8632Shrd(const InstX8632Shrd &) = delete; InstX8632Shrd(const InstX8632Shrd &) = delete;
InstX8632Shrd &operator=(const InstX8632Shrd &) = delete; InstX8632Shrd &operator=(const InstX8632Shrd &) = delete;
...@@ -1101,6 +1125,7 @@ private: ...@@ -1101,6 +1125,7 @@ private:
// Conditional move instruction. // Conditional move instruction.
class InstX8632Cmov : public InstX8632 { class InstX8632Cmov : public InstX8632 {
InstX8632Cmov() = delete;
InstX8632Cmov(const InstX8632Cmov &) = delete; InstX8632Cmov(const InstX8632Cmov &) = delete;
InstX8632Cmov &operator=(const InstX8632Cmov &) = delete; InstX8632Cmov &operator=(const InstX8632Cmov &) = delete;
...@@ -1126,6 +1151,7 @@ private: ...@@ -1126,6 +1151,7 @@ private:
// Cmpps instruction - compare packed singled-precision floating point // Cmpps instruction - compare packed singled-precision floating point
// values // values
class InstX8632Cmpps : public InstX8632 { class InstX8632Cmpps : public InstX8632 {
InstX8632Cmpps() = delete;
InstX8632Cmpps(const InstX8632Cmpps &) = delete; InstX8632Cmpps(const InstX8632Cmpps &) = delete;
InstX8632Cmpps &operator=(const InstX8632Cmpps &) = delete; InstX8632Cmpps &operator=(const InstX8632Cmpps &) = delete;
...@@ -1154,6 +1180,7 @@ private: ...@@ -1154,6 +1180,7 @@ private:
// <dest> can be a register or memory, while <desired> must be a register. // <dest> can be a register or memory, while <desired> must be a register.
// It is the user's responsiblity to mark eax with a FakeDef. // It is the user's responsiblity to mark eax with a FakeDef.
class InstX8632Cmpxchg : public InstX8632Lockable { class InstX8632Cmpxchg : public InstX8632Lockable {
InstX8632Cmpxchg() = delete;
InstX8632Cmpxchg(const InstX8632Cmpxchg &) = delete; InstX8632Cmpxchg(const InstX8632Cmpxchg &) = delete;
InstX8632Cmpxchg &operator=(const InstX8632Cmpxchg &) = delete; InstX8632Cmpxchg &operator=(const InstX8632Cmpxchg &) = delete;
...@@ -1181,6 +1208,7 @@ private: ...@@ -1181,6 +1208,7 @@ private:
// and eax as modified. // and eax as modified.
// <m64> must be a memory operand. // <m64> must be a memory operand.
class InstX8632Cmpxchg8b : public InstX8632Lockable { class InstX8632Cmpxchg8b : public InstX8632Lockable {
InstX8632Cmpxchg8b() = delete;
InstX8632Cmpxchg8b(const InstX8632Cmpxchg8b &) = delete; InstX8632Cmpxchg8b(const InstX8632Cmpxchg8b &) = delete;
InstX8632Cmpxchg8b &operator=(const InstX8632Cmpxchg8b &) = delete; InstX8632Cmpxchg8b &operator=(const InstX8632Cmpxchg8b &) = delete;
...@@ -1207,6 +1235,7 @@ private: ...@@ -1207,6 +1235,7 @@ private:
// from dest/src types. Sign and zero extension on the integer // from dest/src types. Sign and zero extension on the integer
// operand needs to be done separately. // operand needs to be done separately.
class InstX8632Cvt : public InstX8632 { class InstX8632Cvt : public InstX8632 {
InstX8632Cvt() = delete;
InstX8632Cvt(const InstX8632Cvt &) = delete; InstX8632Cvt(const InstX8632Cvt &) = delete;
InstX8632Cvt &operator=(const InstX8632Cvt &) = delete; InstX8632Cvt &operator=(const InstX8632Cvt &) = delete;
...@@ -1231,6 +1260,7 @@ private: ...@@ -1231,6 +1260,7 @@ private:
// cmp - Integer compare instruction. // cmp - Integer compare instruction.
class InstX8632Icmp : public InstX8632 { class InstX8632Icmp : public InstX8632 {
InstX8632Icmp() = delete;
InstX8632Icmp(const InstX8632Icmp &) = delete; InstX8632Icmp(const InstX8632Icmp &) = delete;
InstX8632Icmp &operator=(const InstX8632Icmp &) = delete; InstX8632Icmp &operator=(const InstX8632Icmp &) = delete;
...@@ -1251,6 +1281,7 @@ private: ...@@ -1251,6 +1281,7 @@ private:
// ucomiss/ucomisd - floating-point compare instruction. // ucomiss/ucomisd - floating-point compare instruction.
class InstX8632Ucomiss : public InstX8632 { class InstX8632Ucomiss : public InstX8632 {
InstX8632Ucomiss() = delete;
InstX8632Ucomiss(const InstX8632Ucomiss &) = delete; InstX8632Ucomiss(const InstX8632Ucomiss &) = delete;
InstX8632Ucomiss &operator=(const InstX8632Ucomiss &) = delete; InstX8632Ucomiss &operator=(const InstX8632Ucomiss &) = delete;
...@@ -1271,6 +1302,7 @@ private: ...@@ -1271,6 +1302,7 @@ private:
// UD2 instruction. // UD2 instruction.
class InstX8632UD2 : public InstX8632 { class InstX8632UD2 : public InstX8632 {
InstX8632UD2() = delete;
InstX8632UD2(const InstX8632UD2 &) = delete; InstX8632UD2(const InstX8632UD2 &) = delete;
InstX8632UD2 &operator=(const InstX8632UD2 &) = delete; InstX8632UD2 &operator=(const InstX8632UD2 &) = delete;
...@@ -1284,12 +1316,13 @@ public: ...@@ -1284,12 +1316,13 @@ public:
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); explicit InstX8632UD2(Cfg *Func);
~InstX8632UD2() override {} ~InstX8632UD2() override {}
}; };
// Test instruction. // Test instruction.
class InstX8632Test : public InstX8632 { class InstX8632Test : public InstX8632 {
InstX8632Test() = delete;
InstX8632Test(const InstX8632Test &) = delete; InstX8632Test(const InstX8632Test &) = delete;
InstX8632Test &operator=(const InstX8632Test &) = delete; InstX8632Test &operator=(const InstX8632Test &) = delete;
...@@ -1310,6 +1343,7 @@ private: ...@@ -1310,6 +1343,7 @@ private:
// Mfence instruction. // Mfence instruction.
class InstX8632Mfence : public InstX8632 { class InstX8632Mfence : public InstX8632 {
InstX8632Mfence() = delete;
InstX8632Mfence(const InstX8632Mfence &) = delete; InstX8632Mfence(const InstX8632Mfence &) = delete;
InstX8632Mfence &operator=(const InstX8632Mfence &) = delete; InstX8632Mfence &operator=(const InstX8632Mfence &) = delete;
...@@ -1323,7 +1357,7 @@ public: ...@@ -1323,7 +1357,7 @@ public:
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); explicit InstX8632Mfence(Cfg *Func);
~InstX8632Mfence() override {} ~InstX8632Mfence() override {}
}; };
...@@ -1331,6 +1365,7 @@ private: ...@@ -1331,6 +1365,7 @@ private:
// operand instead of Variable as the destination. It's important // operand instead of Variable as the destination. It's important
// for liveness that there is no Dest operand. // for liveness that there is no Dest operand.
class InstX8632Store : public InstX8632 { class InstX8632Store : public InstX8632 {
InstX8632Store() = delete;
InstX8632Store(const InstX8632Store &) = delete; InstX8632Store(const InstX8632Store &) = delete;
InstX8632Store &operator=(const InstX8632Store &) = delete; InstX8632Store &operator=(const InstX8632Store &) = delete;
...@@ -1354,6 +1389,7 @@ private: ...@@ -1354,6 +1389,7 @@ private:
// for liveness that there is no Dest operand. The source must be an // for liveness that there is no Dest operand. The source must be an
// Xmm register, since Dest is mem. // Xmm register, since Dest is mem.
class InstX8632StoreP : public InstX8632 { class InstX8632StoreP : public InstX8632 {
InstX8632StoreP() = delete;
InstX8632StoreP(const InstX8632StoreP &) = delete; InstX8632StoreP(const InstX8632StoreP &) = delete;
InstX8632StoreP &operator=(const InstX8632StoreP &) = delete; InstX8632StoreP &operator=(const InstX8632StoreP &) = delete;
...@@ -1374,6 +1410,7 @@ private: ...@@ -1374,6 +1410,7 @@ private:
}; };
class InstX8632StoreQ : public InstX8632 { class InstX8632StoreQ : public InstX8632 {
InstX8632StoreQ() = delete;
InstX8632StoreQ(const InstX8632StoreQ &) = delete; InstX8632StoreQ(const InstX8632StoreQ &) = delete;
InstX8632StoreQ &operator=(const InstX8632StoreQ &) = delete; InstX8632StoreQ &operator=(const InstX8632StoreQ &) = delete;
...@@ -1395,6 +1432,7 @@ private: ...@@ -1395,6 +1432,7 @@ private:
// Nop instructions of varying length // Nop instructions of varying length
class InstX8632Nop : public InstX8632 { class InstX8632Nop : public InstX8632 {
InstX8632Nop() = delete;
InstX8632Nop(const InstX8632Nop &) = delete; InstX8632Nop(const InstX8632Nop &) = delete;
InstX8632Nop &operator=(const InstX8632Nop &) = delete; InstX8632Nop &operator=(const InstX8632Nop &) = delete;
...@@ -1419,6 +1457,7 @@ private: ...@@ -1419,6 +1457,7 @@ private:
// Fld - load a value onto the x87 FP stack. // Fld - load a value onto the x87 FP stack.
class InstX8632Fld : public InstX8632 { class InstX8632Fld : public InstX8632 {
InstX8632Fld() = delete;
InstX8632Fld(const InstX8632Fld &) = delete; InstX8632Fld(const InstX8632Fld &) = delete;
InstX8632Fld &operator=(const InstX8632Fld &) = delete; InstX8632Fld &operator=(const InstX8632Fld &) = delete;
...@@ -1438,6 +1477,7 @@ private: ...@@ -1438,6 +1477,7 @@ private:
// Fstp - store x87 st(0) into memory and pop st(0). // Fstp - store x87 st(0) into memory and pop st(0).
class InstX8632Fstp : public InstX8632 { class InstX8632Fstp : public InstX8632 {
InstX8632Fstp() = delete;
InstX8632Fstp(const InstX8632Fstp &) = delete; InstX8632Fstp(const InstX8632Fstp &) = delete;
InstX8632Fstp &operator=(const InstX8632Fstp &) = delete; InstX8632Fstp &operator=(const InstX8632Fstp &) = delete;
...@@ -1456,6 +1496,7 @@ private: ...@@ -1456,6 +1496,7 @@ private:
}; };
class InstX8632Pop : public InstX8632 { class InstX8632Pop : public InstX8632 {
InstX8632Pop() = delete;
InstX8632Pop(const InstX8632Pop &) = delete; InstX8632Pop(const InstX8632Pop &) = delete;
InstX8632Pop &operator=(const InstX8632Pop &) = delete; InstX8632Pop &operator=(const InstX8632Pop &) = delete;
...@@ -1474,6 +1515,7 @@ private: ...@@ -1474,6 +1515,7 @@ private:
}; };
class InstX8632Push : public InstX8632 { class InstX8632Push : public InstX8632 {
InstX8632Push() = delete;
InstX8632Push(const InstX8632Push &) = delete; InstX8632Push(const InstX8632Push &) = delete;
InstX8632Push &operator=(const InstX8632Push &) = delete; InstX8632Push &operator=(const InstX8632Push &) = delete;
...@@ -1496,6 +1538,7 @@ private: ...@@ -1496,6 +1538,7 @@ private:
// (for non-void returning functions) for liveness analysis, though // (for non-void returning functions) for liveness analysis, though
// a FakeUse before the ret would do just as well. // a FakeUse before the ret would do just as well.
class InstX8632Ret : public InstX8632 { class InstX8632Ret : public InstX8632 {
InstX8632Ret() = delete;
InstX8632Ret(const InstX8632Ret &) = delete; InstX8632Ret(const InstX8632Ret &) = delete;
InstX8632Ret &operator=(const InstX8632Ret &) = delete; InstX8632Ret &operator=(const InstX8632Ret &) = delete;
...@@ -1521,6 +1564,7 @@ private: ...@@ -1521,6 +1564,7 @@ private:
// Both the dest and source are updated. The caller should then insert a // Both the dest and source are updated. The caller should then insert a
// FakeDef to reflect the second udpate. // FakeDef to reflect the second udpate.
class InstX8632Xadd : public InstX8632Lockable { class InstX8632Xadd : public InstX8632Lockable {
InstX8632Xadd() = delete;
InstX8632Xadd(const InstX8632Xadd &) = delete; InstX8632Xadd(const InstX8632Xadd &) = delete;
InstX8632Xadd &operator=(const InstX8632Xadd &) = delete; InstX8632Xadd &operator=(const InstX8632Xadd &) = delete;
...@@ -1547,6 +1591,7 @@ private: ...@@ -1547,6 +1591,7 @@ private:
// then the instruction is automatically "locked" without the need for // then the instruction is automatically "locked" without the need for
// a lock prefix. // a lock prefix.
class InstX8632Xchg : public InstX8632 { class InstX8632Xchg : public InstX8632 {
InstX8632Xchg() = delete;
InstX8632Xchg(const InstX8632Xchg &) = delete; InstX8632Xchg(const InstX8632Xchg &) = delete;
InstX8632Xchg &operator=(const InstX8632Xchg &) = delete; InstX8632Xchg &operator=(const InstX8632Xchg &) = delete;
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
namespace Ice { namespace Ice {
class Liveness { class Liveness {
Liveness() = delete;
Liveness(const Liveness &) = delete; Liveness(const Liveness &) = delete;
Liveness &operator=(const Liveness &) = delete; Liveness &operator=(const Liveness &) = delete;
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
namespace Ice { namespace Ice {
class Operand { class Operand {
Operand() = delete;
Operand(const Operand &) = delete; Operand(const Operand &) = delete;
Operand &operator=(const Operand &) = delete; Operand &operator=(const Operand &) = delete;
...@@ -97,6 +98,7 @@ inline StreamType &operator<<(StreamType &Str, const Operand &Op) { ...@@ -97,6 +98,7 @@ inline StreamType &operator<<(StreamType &Str, const Operand &Op) {
// Constant is the abstract base class for constants. All // Constant is the abstract base class for constants. All
// constants are allocated from a global arena and are pooled. // constants are allocated from a global arena and are pooled.
class Constant : public Operand { class Constant : public Operand {
Constant() = delete;
Constant(const Constant &) = delete; Constant(const Constant &) = delete;
Constant &operator=(const Constant &) = delete; Constant &operator=(const Constant &) = delete;
...@@ -128,6 +130,7 @@ protected: ...@@ -128,6 +130,7 @@ protected:
// ConstantPrimitive<> wraps a primitive type. // ConstantPrimitive<> wraps a primitive type.
template <typename T, Operand::OperandKind K> template <typename T, Operand::OperandKind K>
class ConstantPrimitive : public Constant { class ConstantPrimitive : public Constant {
ConstantPrimitive() = delete;
ConstantPrimitive(const ConstantPrimitive &) = delete; ConstantPrimitive(const ConstantPrimitive &) = delete;
ConstantPrimitive &operator=(const ConstantPrimitive &) = delete; ConstantPrimitive &operator=(const ConstantPrimitive &) = delete;
...@@ -191,6 +194,7 @@ inline void ConstantInteger64::dump(const Cfg *, Ostream &Str) const { ...@@ -191,6 +194,7 @@ inline void ConstantInteger64::dump(const Cfg *, Ostream &Str) const {
// ConstantRelocatable can fit into the global constant pool // ConstantRelocatable can fit into the global constant pool
// template mechanism. // template mechanism.
class RelocatableTuple { class RelocatableTuple {
RelocatableTuple() = delete;
RelocatableTuple &operator=(const RelocatableTuple &) = delete; RelocatableTuple &operator=(const RelocatableTuple &) = delete;
public: public:
...@@ -209,6 +213,7 @@ bool operator==(const RelocatableTuple &A, const RelocatableTuple &B); ...@@ -209,6 +213,7 @@ bool operator==(const RelocatableTuple &A, const RelocatableTuple &B);
// ConstantRelocatable represents a symbolic constant combined with // ConstantRelocatable represents a symbolic constant combined with
// a fixed offset. // a fixed offset.
class ConstantRelocatable : public Constant { class ConstantRelocatable : public Constant {
ConstantRelocatable() = delete;
ConstantRelocatable(const ConstantRelocatable &) = delete; ConstantRelocatable(const ConstantRelocatable &) = delete;
ConstantRelocatable &operator=(const ConstantRelocatable &) = delete; ConstantRelocatable &operator=(const ConstantRelocatable &) = delete;
...@@ -252,6 +257,7 @@ private: ...@@ -252,6 +257,7 @@ private:
// legal to lower ConstantUndef to any value, backends should try to // legal to lower ConstantUndef to any value, backends should try to
// make code generation deterministic by lowering ConstantUndefs to 0. // make code generation deterministic by lowering ConstantUndefs to 0.
class ConstantUndef : public Constant { class ConstantUndef : public Constant {
ConstantUndef() = delete;
ConstantUndef(const ConstantUndef &) = delete; ConstantUndef(const ConstantUndef &) = delete;
ConstantUndef &operator=(const ConstantUndef &) = delete; ConstantUndef &operator=(const ConstantUndef &) = delete;
...@@ -286,10 +292,9 @@ private: ...@@ -286,10 +292,9 @@ private:
// special value that represents infinite weight, and an addWeight() // special value that represents infinite weight, and an addWeight()
// method that ensures that W+infinity=infinity. // method that ensures that W+infinity=infinity.
class RegWeight { class RegWeight {
public: public:
RegWeight() : Weight(0) {} RegWeight() : Weight(0) {}
RegWeight(uint32_t Weight) : Weight(Weight) {} explicit RegWeight(uint32_t Weight) : Weight(Weight) {}
RegWeight(const RegWeight &) = default; RegWeight(const RegWeight &) = default;
RegWeight &operator=(const RegWeight &) = default; RegWeight &operator=(const RegWeight &) = default;
const static uint32_t Inf = ~0; // Force regalloc to give a register const static uint32_t Inf = ~0; // Force regalloc to give a register
...@@ -304,6 +309,7 @@ public: ...@@ -304,6 +309,7 @@ public:
void setWeight(uint32_t Val) { Weight = Val; } void setWeight(uint32_t Val) { Weight = Val; }
uint32_t getWeight() const { return Weight; } uint32_t getWeight() const { return Weight; }
bool isInf() const { return Weight == Inf; } bool isInf() const { return Weight == Inf; }
bool isZero() const { return Weight == Zero; }
private: private:
uint32_t Weight; uint32_t Weight;
...@@ -324,7 +330,7 @@ public: ...@@ -324,7 +330,7 @@ public:
LiveRange() : Weight(0) {} LiveRange() : Weight(0) {}
// Special constructor for building a kill set. The advantage is // Special constructor for building a kill set. The advantage is
// that we can reserve the right amount of space in advance. // that we can reserve the right amount of space in advance.
LiveRange(const std::vector<InstNumberT> &Kills) : Weight(0) { explicit LiveRange(const std::vector<InstNumberT> &Kills) : Weight(0) {
Range.reserve(Kills.size()); Range.reserve(Kills.size());
for (InstNumberT I : Kills) for (InstNumberT I : Kills)
addSegment(I, I); addSegment(I, I);
...@@ -380,6 +386,7 @@ Ostream &operator<<(Ostream &Str, const LiveRange &L); ...@@ -380,6 +386,7 @@ Ostream &operator<<(Ostream &Str, const LiveRange &L);
// stack-allocated. If it is register-allocated, it will ultimately // stack-allocated. If it is register-allocated, it will ultimately
// have a non-negative RegNum field. // have a non-negative RegNum field.
class Variable : public Operand { class Variable : public Operand {
Variable() = delete;
Variable(const Variable &) = delete; Variable(const Variable &) = delete;
Variable &operator=(const Variable &) = delete; Variable &operator=(const Variable &) = delete;
...@@ -421,8 +428,8 @@ public: ...@@ -421,8 +428,8 @@ public:
void setRegNumTmp(int32_t NewRegNum) { RegNumTmp = NewRegNum; } void setRegNumTmp(int32_t NewRegNum) { RegNumTmp = NewRegNum; }
RegWeight getWeight() const { return Weight; } RegWeight getWeight() const { return Weight; }
void setWeight(uint32_t NewWeight) { Weight = NewWeight; } void setWeight(uint32_t NewWeight) { Weight = RegWeight(NewWeight); }
void setWeightInfinite() { Weight = RegWeight::Inf; } void setWeightInfinite() { setWeight(RegWeight::Inf); }
LiveRange &getLiveRange() { return Live; } LiveRange &getLiveRange() { return Live; }
const LiveRange &getLiveRange() const { return Live; } const LiveRange &getLiveRange() const { return Live; }
...@@ -432,11 +439,13 @@ public: ...@@ -432,11 +439,13 @@ public:
assert(WeightDelta != RegWeight::Inf); assert(WeightDelta != RegWeight::Inf);
Live.addSegment(Start, End); Live.addSegment(Start, End);
if (Weight.isInf()) if (Weight.isInf())
Live.setWeight(RegWeight::Inf); Live.setWeight(RegWeight(RegWeight::Inf));
else else
Live.addWeight(WeightDelta * Weight.getWeight()); Live.addWeight(WeightDelta * Weight.getWeight());
} }
void setLiveRangeInfiniteWeight() { Live.setWeight(RegWeight::Inf); } void setLiveRangeInfiniteWeight() {
Live.setWeight(RegWeight(RegWeight::Inf));
}
void trimLiveRange(InstNumberT Start) { Live.trim(Start); } void trimLiveRange(InstNumberT Start) { Live.trim(Start); }
void untrimLiveRange() { Live.untrim(); } void untrimLiveRange() { Live.untrim(); }
bool rangeEndsBefore(const Variable *Other) const { bool rangeEndsBefore(const Variable *Other) const {
...@@ -570,11 +579,12 @@ private: ...@@ -570,11 +579,12 @@ private:
// VariablesMetadata analyzes and summarizes the metadata for the // VariablesMetadata analyzes and summarizes the metadata for the
// complete set of Variables. // complete set of Variables.
class VariablesMetadata { class VariablesMetadata {
VariablesMetadata() = delete;
VariablesMetadata(const VariablesMetadata &) = delete; VariablesMetadata(const VariablesMetadata &) = delete;
VariablesMetadata &operator=(const VariablesMetadata &) = delete; VariablesMetadata &operator=(const VariablesMetadata &) = delete;
public: public:
VariablesMetadata(const Cfg *Func) : Func(Func) {} explicit VariablesMetadata(const Cfg *Func) : Func(Func) {}
// Initialize the state by traversing all instructions/variables in // Initialize the state by traversing all instructions/variables in
// the CFG. // the CFG.
void init(MetadataKind TrackingKind); void init(MetadataKind TrackingKind);
......
...@@ -22,11 +22,12 @@ ...@@ -22,11 +22,12 @@
namespace Ice { namespace Ice {
class RandomNumberGenerator { class RandomNumberGenerator {
RandomNumberGenerator() = delete;
RandomNumberGenerator(const RandomNumberGenerator &) = delete; RandomNumberGenerator(const RandomNumberGenerator &) = delete;
RandomNumberGenerator &operator=(const RandomNumberGenerator &) = delete; RandomNumberGenerator &operator=(const RandomNumberGenerator &) = delete;
public: public:
RandomNumberGenerator(llvm::StringRef Salt); explicit RandomNumberGenerator(llvm::StringRef Salt);
uint64_t next(uint64_t Max); uint64_t next(uint64_t Max);
private: private:
...@@ -37,6 +38,7 @@ private: ...@@ -37,6 +38,7 @@ private:
// reason for the wrapper class is that we want to keep the // reason for the wrapper class is that we want to keep the
// RandomNumberGenerator interface identical to LLVM's. // RandomNumberGenerator interface identical to LLVM's.
class RandomNumberGeneratorWrapper { class RandomNumberGeneratorWrapper {
RandomNumberGeneratorWrapper() = delete;
RandomNumberGeneratorWrapper(const RandomNumberGeneratorWrapper &) = delete; RandomNumberGeneratorWrapper(const RandomNumberGeneratorWrapper &) = delete;
RandomNumberGeneratorWrapper & RandomNumberGeneratorWrapper &
operator=(const RandomNumberGeneratorWrapper &) = delete; operator=(const RandomNumberGeneratorWrapper &) = delete;
...@@ -44,7 +46,8 @@ class RandomNumberGeneratorWrapper { ...@@ -44,7 +46,8 @@ class RandomNumberGeneratorWrapper {
public: public:
uint64_t operator()(uint64_t Max) { return RNG.next(Max); } uint64_t operator()(uint64_t Max) { return RNG.next(Max); }
bool getTrueWithProbability(float Probability); bool getTrueWithProbability(float Probability);
RandomNumberGeneratorWrapper(RandomNumberGenerator &RNG) : RNG(RNG) {} explicit RandomNumberGeneratorWrapper(RandomNumberGenerator &RNG)
: RNG(RNG) {}
private: private:
RandomNumberGenerator &RNG; RandomNumberGenerator &RNG;
......
...@@ -95,7 +95,7 @@ void LinearScan::initForGlobal() { ...@@ -95,7 +95,7 @@ void LinearScan::initForGlobal() {
for (Variable *Var : Vars) { for (Variable *Var : Vars) {
// Explicitly don't consider zero-weight variables, which are // Explicitly don't consider zero-weight variables, which are
// meant to be spill slots. // meant to be spill slots.
if (Var->getWeight() == RegWeight::Zero) if (Var->getWeight().isZero())
continue; continue;
// Don't bother if the variable has a null live range, which means // Don't bother if the variable has a null live range, which means
// it was never referenced. // it was never referenced.
...@@ -167,7 +167,7 @@ void LinearScan::initForInfOnly() { ...@@ -167,7 +167,7 @@ void LinearScan::initForInfOnly() {
if (Inst.isDeleted()) if (Inst.isDeleted())
continue; continue;
if (const Variable *Var = Inst.getDest()) { if (const Variable *Var = Inst.getDest()) {
if (Var->hasReg() || Var->getWeight() == RegWeight::Inf) { if (Var->hasReg() || Var->getWeight().isInf()) {
if (LRBegin[Var->getIndex()] == Inst::NumberSentinel) { if (LRBegin[Var->getIndex()] == Inst::NumberSentinel) {
LRBegin[Var->getIndex()] = Inst.getNumber(); LRBegin[Var->getIndex()] = Inst.getNumber();
++NumVars; ++NumVars;
...@@ -179,7 +179,7 @@ void LinearScan::initForInfOnly() { ...@@ -179,7 +179,7 @@ void LinearScan::initForInfOnly() {
SizeT NumVars = Src->getNumVars(); SizeT NumVars = Src->getNumVars();
for (SizeT J = 0; J < NumVars; ++J) { for (SizeT J = 0; J < NumVars; ++J) {
const Variable *Var = Src->getVar(J); const Variable *Var = Src->getVar(J);
if (Var->hasReg() || Var->getWeight() == RegWeight::Inf) if (Var->hasReg() || Var->getWeight().isInf())
LREnd[Var->getIndex()] = Inst.getNumber(); LREnd[Var->getIndex()] = Inst.getNumber();
} }
} }
......
...@@ -22,11 +22,12 @@ ...@@ -22,11 +22,12 @@
namespace Ice { namespace Ice {
class LinearScan { class LinearScan {
LinearScan() = delete;
LinearScan(const LinearScan &) = delete; LinearScan(const LinearScan &) = delete;
LinearScan &operator=(const LinearScan &) = delete; LinearScan &operator=(const LinearScan &) = delete;
public: public:
LinearScan(Cfg *Func) explicit LinearScan(Cfg *Func)
: Func(Func), FindPreference(false), FindOverlap(false) {} : Func(Func), FindPreference(false), FindOverlap(false) {}
void init(RegAllocKind Kind); void init(RegAllocKind Kind);
void scan(const llvm::SmallBitVector &RegMask, bool Randomized); void scan(const llvm::SmallBitVector &RegMask, bool Randomized);
......
...@@ -90,6 +90,7 @@ private: ...@@ -90,6 +90,7 @@ private:
}; };
class TargetLowering { class TargetLowering {
TargetLowering() = delete;
TargetLowering(const TargetLowering &) = delete; TargetLowering(const TargetLowering &) = delete;
TargetLowering &operator=(const TargetLowering &) = delete; TargetLowering &operator=(const TargetLowering &) = delete;
...@@ -214,7 +215,7 @@ public: ...@@ -214,7 +215,7 @@ public:
virtual ~TargetLowering() {} virtual ~TargetLowering() {}
protected: protected:
TargetLowering(Cfg *Func); explicit TargetLowering(Cfg *Func);
virtual void lowerAlloca(const InstAlloca *Inst) = 0; virtual void lowerAlloca(const InstAlloca *Inst) = 0;
virtual void lowerArithmetic(const InstArithmetic *Inst) = 0; virtual void lowerArithmetic(const InstArithmetic *Inst) = 0;
virtual void lowerAssign(const InstAssign *Inst) = 0; virtual void lowerAssign(const InstAssign *Inst) = 0;
...@@ -272,7 +273,7 @@ public: ...@@ -272,7 +273,7 @@ public:
virtual void lowerConstants() const = 0; virtual void lowerConstants() const = 0;
protected: protected:
TargetDataLowering(GlobalContext *Ctx) : Ctx(Ctx) {} explicit TargetDataLowering(GlobalContext *Ctx) : Ctx(Ctx) {}
GlobalContext *Ctx; GlobalContext *Ctx;
}; };
......
...@@ -748,7 +748,7 @@ void TargetX8632::addProlog(CfgNode *Node) { ...@@ -748,7 +748,7 @@ void TargetX8632::addProlog(CfgNode *Node) {
// A spill slot linked to a variable with a stack slot should reuse // A spill slot linked to a variable with a stack slot should reuse
// that stack slot. // that stack slot.
if (SpillVariable *SpillVar = llvm::dyn_cast<SpillVariable>(Var)) { if (SpillVariable *SpillVar = llvm::dyn_cast<SpillVariable>(Var)) {
assert(Var->getWeight() == RegWeight::Zero); assert(Var->getWeight().isZero());
if (!SpillVar->getLinkedTo()->hasReg()) { if (!SpillVar->getLinkedTo()->hasReg()) {
VariablesLinkedToSpillSlots.push_back(Var); VariablesLinkedToSpillSlots.push_back(Var);
continue; continue;
...@@ -4336,7 +4336,7 @@ OperandX8632Mem *TargetX8632::getMemoryOperandForStackSlot(Type Ty, ...@@ -4336,7 +4336,7 @@ OperandX8632Mem *TargetX8632::getMemoryOperandForStackSlot(Type Ty,
Variable *Slot, Variable *Slot,
uint32_t Offset) { uint32_t Offset) {
// Ensure that Loc is a stack slot. // Ensure that Loc is a stack slot.
assert(Slot->getWeight() == RegWeight::Zero); assert(Slot->getWeight().isZero());
assert(Slot->getRegNum() == Variable::NoRegister); assert(Slot->getRegNum() == Variable::NoRegister);
// Compute the location of Loc in memory. // Compute the location of Loc in memory.
// TODO(wala,stichnot): lea should not be required. The address of // TODO(wala,stichnot): lea should not be required. The address of
...@@ -4433,8 +4433,7 @@ Operand *TargetX8632::legalize(Operand *From, LegalMask Allowed, ...@@ -4433,8 +4433,7 @@ Operand *TargetX8632::legalize(Operand *From, LegalMask Allowed,
// Check if the variable is guaranteed a physical register. This // Check if the variable is guaranteed a physical register. This
// can happen either when the variable is pre-colored or when it is // can happen either when the variable is pre-colored or when it is
// assigned infinite weight. // assigned infinite weight.
bool MustHaveRegister = bool MustHaveRegister = (Var->hasReg() || Var->getWeight().isInf());
(Var->hasReg() || Var->getWeight() == RegWeight::Inf);
// We need a new physical register for the operand if: // We need a new physical register for the operand if:
// Mem is not allowed and Var isn't guaranteed a physical // Mem is not allowed and Var isn't guaranteed a physical
// register, or // register, or
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
namespace Ice { namespace Ice {
class TargetX8632 : public TargetLowering { class TargetX8632 : public TargetLowering {
TargetX8632() = delete;
TargetX8632(const TargetX8632 &) = delete; TargetX8632(const TargetX8632 &) = delete;
TargetX8632 &operator=(const TargetX8632 &) = delete; TargetX8632 &operator=(const TargetX8632 &) = delete;
...@@ -78,7 +79,7 @@ public: ...@@ -78,7 +79,7 @@ public:
X86InstructionSet getInstructionSet() const { return InstructionSet; } X86InstructionSet getInstructionSet() const { return InstructionSet; }
protected: protected:
TargetX8632(Cfg *Func); explicit TargetX8632(Cfg *Func);
void postLower() override; void postLower() override;
...@@ -509,7 +510,7 @@ public: ...@@ -509,7 +510,7 @@ public:
void lowerConstants() const final; void lowerConstants() const final;
protected: protected:
TargetDataX8632(GlobalContext *Ctx); explicit TargetDataX8632(GlobalContext *Ctx);
private: private:
void lowerGlobal(const VariableDeclaration &Var) const; void lowerGlobal(const VariableDeclaration &Var) const;
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
namespace Ice { namespace Ice {
class TimerStack { class TimerStack {
TimerStack() = delete;
TimerStack &operator=(const TimerStack &) = delete; TimerStack &operator=(const TimerStack &) = delete;
// Timer tree index type. A variable of this type is used to access // Timer tree index type. A variable of this type is used to access
...@@ -59,7 +60,7 @@ public: ...@@ -59,7 +60,7 @@ public:
#undef X #undef X
TT__num TT__num
}; };
TimerStack(const IceString &Name); explicit TimerStack(const IceString &Name);
TimerStack(const TimerStack &) = default; TimerStack(const TimerStack &) = default;
TimerIdT getTimerID(const IceString &Name); TimerIdT getTimerID(const IceString &Name);
void mergeFrom(const TimerStack &Src); void mergeFrom(const TimerStack &Src);
......
...@@ -30,11 +30,12 @@ class GlobalContext; ...@@ -30,11 +30,12 @@ class GlobalContext;
// other intermediate representations down to ICE, and then call the appropriate // other intermediate representations down to ICE, and then call the appropriate
// (inherited) methods to convert ICE into machine instructions. // (inherited) methods to convert ICE into machine instructions.
class Translator { class Translator {
Translator() = delete;
Translator(const Translator &) = delete; Translator(const Translator &) = delete;
Translator &operator=(const Translator &) = delete; Translator &operator=(const Translator &) = delete;
public: public:
Translator(GlobalContext *Ctx); explicit Translator(GlobalContext *Ctx);
~Translator(); ~Translator();
const ErrorCode &getErrorStatus() const { return ErrorStatus; } const ErrorCode &getErrorStatus() const { return ErrorStatus; }
......
...@@ -28,12 +28,13 @@ namespace Ice { ...@@ -28,12 +28,13 @@ namespace Ice {
/// Converts LLVM types to ICE types, and ICE types to LLVM types. /// Converts LLVM types to ICE types, and ICE types to LLVM types.
class TypeConverter { class TypeConverter {
TypeConverter() = delete;
TypeConverter(const TypeConverter &) = delete; TypeConverter(const TypeConverter &) = delete;
TypeConverter &operator=(const TypeConverter &) = delete; TypeConverter &operator=(const TypeConverter &) = delete;
public: public:
/// Context is the context to use to build llvm types. /// Context is the context to use to build llvm types.
TypeConverter(llvm::LLVMContext &Context); explicit TypeConverter(llvm::LLVMContext &Context);
/// Converts LLVM type LLVMTy to an ICE type. Returns /// Converts LLVM type LLVMTy to an ICE type. Returns
/// Ice::IceType_NUM if unable to convert. /// Ice::IceType_NUM if unable to convert.
......
...@@ -31,6 +31,10 @@ template <class D, class S> inline D bit_copy(const S &source) { ...@@ -31,6 +31,10 @@ template <class D, class S> inline D bit_copy(const S &source) {
} }
class Utils { class Utils {
Utils() = delete;
Utils(const Utils &) = delete;
Utils &operator=(const Utils &) = delete;
public: public:
// Check whether an N-bit two's-complement representation can hold value. // Check whether an N-bit two's-complement representation can hold value.
template <typename T> static inline bool IsInt(int N, T value) { template <typename T> static inline bool IsInt(int N, T value) {
......
...@@ -105,6 +105,7 @@ Ice::Ostream &operator<<(Ice::Ostream &Stream, ExtendedType::TypeKind Kind) { ...@@ -105,6 +105,7 @@ Ice::Ostream &operator<<(Ice::Ostream &Stream, ExtendedType::TypeKind Kind) {
// Models an ICE type as an extended type. // Models an ICE type as an extended type.
class SimpleExtendedType : public ExtendedType { class SimpleExtendedType : public ExtendedType {
SimpleExtendedType() = delete;
SimpleExtendedType(const SimpleExtendedType &) = delete; SimpleExtendedType(const SimpleExtendedType &) = delete;
SimpleExtendedType &operator=(const SimpleExtendedType &) = delete; SimpleExtendedType &operator=(const SimpleExtendedType &) = delete;
...@@ -118,6 +119,7 @@ public: ...@@ -118,6 +119,7 @@ public:
// Models a function signature as an extended type. // Models a function signature as an extended type.
class FuncSigExtendedType : public ExtendedType { class FuncSigExtendedType : public ExtendedType {
FuncSigExtendedType() = delete;
FuncSigExtendedType(const FuncSigExtendedType &) = delete; FuncSigExtendedType(const FuncSigExtendedType &) = delete;
FuncSigExtendedType &operator=(const FuncSigExtendedType &) = delete; FuncSigExtendedType &operator=(const FuncSigExtendedType &) = delete;
...@@ -153,6 +155,7 @@ class BlockParserBaseClass; ...@@ -153,6 +155,7 @@ class BlockParserBaseClass;
// Top-level class to read PNaCl bitcode files, and translate to ICE. // Top-level class to read PNaCl bitcode files, and translate to ICE.
class TopLevelParser : public NaClBitcodeParser { class TopLevelParser : public NaClBitcodeParser {
TopLevelParser() = delete;
TopLevelParser(const TopLevelParser &) = delete; TopLevelParser(const TopLevelParser &) = delete;
TopLevelParser &operator=(const TopLevelParser &) = delete; TopLevelParser &operator=(const TopLevelParser &) = delete;
...@@ -568,6 +571,7 @@ Ice::Type TopLevelParser::convertToIceTypeError(Type *LLVMTy) { ...@@ -568,6 +571,7 @@ Ice::Type TopLevelParser::convertToIceTypeError(Type *LLVMTy) {
// messages if ParseBlock or ParseRecord is not overridden in derived // messages if ParseBlock or ParseRecord is not overridden in derived
// classes. // classes.
class BlockParserBaseClass : public NaClBitcodeParser { class BlockParserBaseClass : public NaClBitcodeParser {
BlockParserBaseClass() = delete;
BlockParserBaseClass(const BlockParserBaseClass &) = delete; BlockParserBaseClass(const BlockParserBaseClass &) = delete;
BlockParserBaseClass &operator=(const BlockParserBaseClass &) = delete; BlockParserBaseClass &operator=(const BlockParserBaseClass &) = delete;
...@@ -736,6 +740,10 @@ void BlockParserBaseClass::ProcessRecord() { ...@@ -736,6 +740,10 @@ void BlockParserBaseClass::ProcessRecord() {
// Class to parse a types block. // Class to parse a types block.
class TypesParser : public BlockParserBaseClass { class TypesParser : public BlockParserBaseClass {
TypesParser() = delete;
TypesParser(const TypesParser &) = delete;
TypesParser &operator=(const TypesParser &) = delete;
public: public:
TypesParser(unsigned BlockID, BlockParserBaseClass *EnclosingParser) TypesParser(unsigned BlockID, BlockParserBaseClass *EnclosingParser)
: BlockParserBaseClass(BlockID, EnclosingParser), : BlockParserBaseClass(BlockID, EnclosingParser),
...@@ -911,6 +919,10 @@ void TypesParser::ProcessRecord() { ...@@ -911,6 +919,10 @@ void TypesParser::ProcessRecord() {
/// Parses the globals block (i.e. global variable declarations and /// Parses the globals block (i.e. global variable declarations and
/// corresponding initializers). /// corresponding initializers).
class GlobalsParser : public BlockParserBaseClass { class GlobalsParser : public BlockParserBaseClass {
GlobalsParser() = delete;
GlobalsParser(const GlobalsParser &) = delete;
GlobalsParser &operator=(const GlobalsParser &) = delete;
public: public:
GlobalsParser(unsigned BlockID, BlockParserBaseClass *EnclosingParser) GlobalsParser(unsigned BlockID, BlockParserBaseClass *EnclosingParser)
: BlockParserBaseClass(BlockID, EnclosingParser), : BlockParserBaseClass(BlockID, EnclosingParser),
...@@ -1064,6 +1076,7 @@ void GlobalsParser::ProcessRecord() { ...@@ -1064,6 +1076,7 @@ void GlobalsParser::ProcessRecord() {
/// Base class for parsing a valuesymtab block in the bitcode file. /// Base class for parsing a valuesymtab block in the bitcode file.
class ValuesymtabParser : public BlockParserBaseClass { class ValuesymtabParser : public BlockParserBaseClass {
ValuesymtabParser() = delete;
ValuesymtabParser(const ValuesymtabParser &) = delete; ValuesymtabParser(const ValuesymtabParser &) = delete;
void operator=(const ValuesymtabParser &) = delete; void operator=(const ValuesymtabParser &) = delete;
...@@ -1125,6 +1138,7 @@ void ValuesymtabParser::ProcessRecord() { ...@@ -1125,6 +1138,7 @@ void ValuesymtabParser::ProcessRecord() {
/// Parses function blocks in the bitcode file. /// Parses function blocks in the bitcode file.
class FunctionParser : public BlockParserBaseClass { class FunctionParser : public BlockParserBaseClass {
FunctionParser() = delete;
FunctionParser(const FunctionParser &) = delete; FunctionParser(const FunctionParser &) = delete;
FunctionParser &operator=(const FunctionParser &) = delete; FunctionParser &operator=(const FunctionParser &) = delete;
...@@ -2626,6 +2640,7 @@ void FunctionParser::ProcessRecord() { ...@@ -2626,6 +2640,7 @@ void FunctionParser::ProcessRecord() {
/// Parses constants within a function block. /// Parses constants within a function block.
class ConstantsParser : public BlockParserBaseClass { class ConstantsParser : public BlockParserBaseClass {
ConstantsParser() = delete;
ConstantsParser(const ConstantsParser &) = delete; ConstantsParser(const ConstantsParser &) = delete;
ConstantsParser &operator=(const ConstantsParser &) = delete; ConstantsParser &operator=(const ConstantsParser &) = delete;
...@@ -2754,6 +2769,7 @@ void ConstantsParser::ProcessRecord() { ...@@ -2754,6 +2769,7 @@ void ConstantsParser::ProcessRecord() {
// Parses valuesymtab blocks appearing in a function block. // Parses valuesymtab blocks appearing in a function block.
class FunctionValuesymtabParser : public ValuesymtabParser { class FunctionValuesymtabParser : public ValuesymtabParser {
FunctionValuesymtabParser() = delete;
FunctionValuesymtabParser(const FunctionValuesymtabParser &) = delete; FunctionValuesymtabParser(const FunctionValuesymtabParser &) = delete;
void operator=(const FunctionValuesymtabParser &) = delete; void operator=(const FunctionValuesymtabParser &) = delete;
...@@ -2839,6 +2855,10 @@ bool FunctionParser::ParseBlock(unsigned BlockID) { ...@@ -2839,6 +2855,10 @@ bool FunctionParser::ParseBlock(unsigned BlockID) {
/// Parses the module block in the bitcode file. /// Parses the module block in the bitcode file.
class ModuleParser : public BlockParserBaseClass { class ModuleParser : public BlockParserBaseClass {
ModuleParser() = delete;
ModuleParser(const ModuleParser &) = delete;
ModuleParser &operator=(const ModuleParser &) = delete;
public: public:
ModuleParser(unsigned BlockID, TopLevelParser *Context) ModuleParser(unsigned BlockID, TopLevelParser *Context)
: BlockParserBaseClass(BlockID, Context), : BlockParserBaseClass(BlockID, Context),
...@@ -2876,6 +2896,7 @@ private: ...@@ -2876,6 +2896,7 @@ private:
}; };
class ModuleValuesymtabParser : public ValuesymtabParser { class ModuleValuesymtabParser : public ValuesymtabParser {
ModuleValuesymtabParser() = delete;
ModuleValuesymtabParser(const ModuleValuesymtabParser &) = delete; ModuleValuesymtabParser(const ModuleValuesymtabParser &) = delete;
void operator=(const ModuleValuesymtabParser &) = delete; void operator=(const ModuleValuesymtabParser &) = delete;
......
...@@ -26,11 +26,12 @@ class MemoryBuffer; ...@@ -26,11 +26,12 @@ class MemoryBuffer;
namespace Ice { namespace Ice {
class PNaClTranslator : public Translator { class PNaClTranslator : public Translator {
PNaClTranslator() = delete;
PNaClTranslator(const PNaClTranslator &) = delete; PNaClTranslator(const PNaClTranslator &) = delete;
PNaClTranslator &operator=(const PNaClTranslator &) = delete; PNaClTranslator &operator=(const PNaClTranslator &) = delete;
public: public:
PNaClTranslator(GlobalContext *Ctx) : Translator(Ctx) {} explicit PNaClTranslator(GlobalContext *Ctx) : Translator(Ctx) {}
// Reads the PNaCl bitcode file and translates to ICE, which is then // Reads the PNaCl bitcode file and translates to ICE, which is then
// converted to machine code. Sets ErrorStatus to 1 if any errors // converted to machine code. Sets ErrorStatus to 1 if any errors
......
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