Moving some util types into poly.

This commit is contained in:
Ben Vanik
2015-03-22 22:12:37 -07:00
parent b392afbfae
commit 59395318f3
54 changed files with 280 additions and 242 deletions

View File

@@ -9,13 +9,13 @@
#include "alloy/backend/x64/x64_assembler.h"
#include "alloy/reset_scope.h"
#include "alloy/backend/x64/x64_backend.h"
#include "alloy/backend/x64/x64_emitter.h"
#include "alloy/backend/x64/x64_function.h"
#include "alloy/hir/hir_builder.h"
#include "alloy/hir/label.h"
#include "alloy/runtime/runtime.h"
#include "poly/reset_scope.h"
#include "xenia/profiling.h"
namespace BE {
@@ -67,7 +67,7 @@ int X64Assembler::Assemble(FunctionInfo* symbol_info, HIRBuilder* builder,
SCOPE_profile_cpu_f("alloy");
// Reset when we leave.
make_reset_scope(this);
poly::make_reset_scope(this);
// Lower HIR -> x64.
void* machine_code = 0;
@@ -97,7 +97,7 @@ int X64Assembler::Assemble(FunctionInfo* symbol_info, HIRBuilder* builder,
}
void X64Assembler::DumpMachineCode(DebugInfo* debug_info, void* machine_code,
size_t code_size, StringBuffer* str) {
size_t code_size, poly::StringBuffer* str) {
BE::DISASM disasm = {0};
disasm.Archi = 64;
disasm.Options = BE::Tabulation + BE::MasmSyntax + BE::PrefixedNumeral;

View File

@@ -13,7 +13,7 @@
#include <memory>
#include "alloy/backend/assembler.h"
#include "alloy/string_buffer.h"
#include "poly/string_buffer.h"
namespace alloy {
namespace backend {
@@ -39,14 +39,14 @@ class X64Assembler : public Assembler {
private:
void DumpMachineCode(runtime::DebugInfo* debug_info, void* machine_code,
size_t code_size, StringBuffer* str);
size_t code_size, poly::StringBuffer* str);
private:
X64Backend* x64_backend_;
std::unique_ptr<X64Emitter> emitter_;
std::unique_ptr<XbyakAllocator> allocator_;
StringBuffer string_buffer_;
poly::StringBuffer string_buffer_;
};
} // namespace x64

View File

@@ -20,6 +20,7 @@
#include "alloy/runtime/runtime.h"
#include "alloy/runtime/symbol_info.h"
#include "alloy/runtime/thread_state.h"
#include "poly/vec128.h"
#include "xdb/protocol.h"
#include "xenia/profiling.h"
@@ -31,6 +32,10 @@ namespace x64 {
using namespace alloy::hir;
using namespace alloy::runtime;
using poly::vec128b;
using poly::vec128f;
using poly::vec128i;
using namespace Xbyak;
using alloy::hir::HIRBuilder;
using alloy::hir::Instr;

View File

@@ -11,6 +11,7 @@
#define ALLOY_BACKEND_X64_X64_EMITTER_H_
#include "alloy/hir/value.h"
#include "poly/arena.h"
#include "third_party/xbyak/xbyak/xbyak.h"
namespace alloy {
@@ -30,6 +31,8 @@ namespace alloy {
namespace backend {
namespace x64 {
using vec128_t = poly::vec128_t;
class X64Backend;
class X64CodeCache;
@@ -193,7 +196,7 @@ class X64Emitter : public Xbyak::CodeGenerator {
hir::Instr* current_instr_;
size_t source_map_count_;
Arena source_map_arena_;
poly::Arena source_map_arena_;
size_t stack_size_;

View File

@@ -39,6 +39,8 @@ using namespace Xbyak;
using namespace alloy::hir;
using namespace alloy::runtime;
using poly::vec128b;
typedef bool (*SequenceSelectFn)(X64Emitter&, const Instr*, const Instr**);
std::unordered_multimap<uint32_t, SequenceSelectFn> sequence_table;