Common: Add an intrusive list implementation; remove use of boost::intrusive::list.

This commit is contained in:
MerryMage 2016-08-06 22:23:01 +01:00
parent 9264e2e04c
commit 94b99f5949
6 changed files with 289 additions and 7 deletions

View file

@ -10,12 +10,12 @@
#include <memory>
#include <vector>
#include <boost/intrusive/list.hpp>
#include <boost/optional.hpp>
#include <boost/variant.hpp>
#include "common/assert.h"
#include "common/common_types.h"
#include "common/intrusive_list.h"
#include "common/memory_pool.h"
#include "frontend/arm_types.h"
#include "frontend/ir/opcodes.h"
@ -113,8 +113,7 @@ private:
} inner;
};
using InstListLinkMode = boost::intrusive::link_mode<boost::intrusive::normal_link>;
class Inst final : public boost::intrusive::list_base_hook<InstListLinkMode> {
class Inst final : public Common::IntrusiveListNode<Inst> {
public:
Inst(Opcode op) : op(op) {}
@ -242,7 +241,7 @@ public:
boost::optional<Arm::LocationDescriptor> cond_failed = {};
/// List of instructions in this block.
boost::intrusive::list<Inst, InstListLinkMode> instructions;
Common::IntrusiveList<Inst> instructions;
/// Memory pool for instruction list
std::unique_ptr<Common::Pool> instruction_alloc_pool = std::make_unique<Common::Pool>(sizeof(Inst), 4096);
/// Terminal instruction of this block.

View file

@ -353,7 +353,7 @@ IR::Value IREmitter::Inst(IR::Opcode op, std::initializer_list<IR::Value> args)
index++;
});
block.instructions.push_back(*inst);
block.instructions.Append(*inst);
return IR::Value(inst);
}

View file

@ -68,7 +68,7 @@ bool ArmTranslatorVisitor::ConditionPassed(Cond cond) {
// non-AL cond
if (!ir.block.instructions.empty()) {
if (!ir.block.instructions.IsEmpty()) {
// We've already emitted instructions. Quit for now, we'll make a new block here later.
cond_state = ConditionalState::Break;
ir.SetTerm(IR::Term::LinkBlock{ir.current_location});