Wiring up the LIR flow.
This commit is contained in:
67
src/alloy/backend/x64/lowering/lowering_table.h
Normal file
67
src/alloy/backend/x64/lowering/lowering_table.h
Normal file
@@ -0,0 +1,67 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* Xenia : Xbox 360 Emulator Research Project *
|
||||
******************************************************************************
|
||||
* Copyright 2013 Ben Vanik. All rights reserved. *
|
||||
* Released under the BSD license - see LICENSE in the root for more details. *
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef ALLOY_BACKEND_X64_X64_LOWERING_LOWERING_TABLE_H_
|
||||
#define ALLOY_BACKEND_X64_X64_LOWERING_LOWERING_TABLE_H_
|
||||
|
||||
#include <alloy/core.h>
|
||||
#include <alloy/backend/x64/lir/lir_instr.h>
|
||||
#include <alloy/hir/instr.h>
|
||||
|
||||
|
||||
namespace alloy {
|
||||
namespace backend {
|
||||
namespace x64 {
|
||||
class X64Backend;
|
||||
namespace lir { class LIRBuilder; }
|
||||
namespace lowering {
|
||||
|
||||
|
||||
class LoweringTable {
|
||||
public:
|
||||
LoweringTable(X64Backend* backend);
|
||||
~LoweringTable();
|
||||
|
||||
int Initialize();
|
||||
|
||||
int Process(lir::LIRBuilder* 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);
|
||||
|
||||
private:
|
||||
X64Backend* backend_;
|
||||
FnWrapper* lookup_[hir::__OPCODE_MAX_VALUE];
|
||||
};
|
||||
|
||||
|
||||
} // namespace lowering
|
||||
} // namespace x64
|
||||
} // namespace backend
|
||||
} // namespace alloy
|
||||
|
||||
|
||||
#endif // ALLOY_BACKEND_X64_X64_LOWERING_LOWERING_TABLE_H_
|
||||
Reference in New Issue
Block a user