Ugh. Replacing the fancy templates with hand coded sequences for now.

This commit is contained in:
Ben Vanik
2014-01-02 00:00:14 -08:00
parent 3e4f93a6a9
commit 125e7278c6
22 changed files with 784 additions and 771 deletions

View File

@@ -33,28 +33,18 @@ public:
int Process(hir::HIRBuilder* hir_builder, lir::LIRBuilder* lir_builder);
public:
class FnWrapper {
public:
FnWrapper() : next(0) {}
virtual bool operator()(lir::LIRBuilder* builder, hir::Instr*& instr) const = 0;
FnWrapper* next;
};
template<typename T>
class TypedFnWrapper : public FnWrapper {
public:
TypedFnWrapper(T fn) : fn_(fn) {}
virtual bool operator()(lir::LIRBuilder* builder, hir::Instr*& instr) const {
return fn_(builder, instr);
}
private:
T fn_;
};
void AddSequence(hir::Opcode starting_opcode, FnWrapper* fn);
typedef bool(*sequence_fn_t)(lir::LIRBuilder& lb, hir::Instr*& instr);
void AddSequence(hir::Opcode starting_opcode, sequence_fn_t fn);
private:
class sequence_fn_entry_t {
public:
sequence_fn_t fn;
sequence_fn_entry_t* next;
};
X64Backend* backend_;
FnWrapper* lookup_[hir::__OPCODE_MAX_VALUE];
sequence_fn_entry_t* lookup_[hir::__OPCODE_MAX_VALUE];
};