ir/block: Default ctor and dtor in the cpp file

Prevents potentially inlining allocation code everywhere. While we're at
it, also explicitly delete/default the copy/move constructor/assignment
operators to be explicit about them.
This commit is contained in:
Lioncash 2019-04-15 05:27:32 -04:00 committed by MerryMage
parent 699ad98b2a
commit 9309d95b17
2 changed files with 19 additions and 3 deletions

View file

@ -20,6 +20,16 @@
namespace Dynarmic::IR {
Block::Block(const LocationDescriptor& location)
: location{location}, end_location{location},
instruction_alloc_pool{std::make_unique<Common::Pool>(sizeof(Inst), 4096)} {}
Block::~Block() = default;
Block::Block(Block&&) = default;
Block& Block::operator=(Block&&) = default;
void Block::AppendNewInst(Opcode opcode, std::initializer_list<IR::Value> args) {
PrependNewInst(end(), opcode, args);
}

View file

@ -39,8 +39,14 @@ public:
using reverse_iterator = InstructionList::reverse_iterator;
using const_reverse_iterator = InstructionList::const_reverse_iterator;
explicit Block(const LocationDescriptor& location)
: location(location), end_location(location) {}
explicit Block(const LocationDescriptor& location);
~Block();
Block(const Block&) = delete;
Block& operator=(const Block&) = delete;
Block(Block&&);
Block& operator=(Block&&);
bool empty() const { return instructions.empty(); }
size_type size() const { return instructions.size(); }
@ -145,7 +151,7 @@ private:
/// List of instructions in this block.
InstructionList instructions;
/// Memory pool for instruction list
std::unique_ptr<Common::Pool> instruction_alloc_pool = std::make_unique<Common::Pool>(sizeof(Inst), 4096);
std::unique_ptr<Common::Pool> instruction_alloc_pool;
/// Terminal instruction of this block.
Terminal terminal = Term::Invalid{};