Starting to split up alloy/core.h.

This commit is contained in:
Ben Vanik 2014-07-14 19:18:42 -07:00
parent e9284dfaed
commit ce70978ef6
33 changed files with 146 additions and 89 deletions

View File

@ -9,6 +9,8 @@
#include <alloy/arena.h>
#include <poly/poly.h>
namespace alloy {
Arena::Arena(size_t chunk_size)

View File

@ -12,6 +12,7 @@
#include <alloy/core.h>
#include <alloy/arena.h>
#include <alloy/backend/assembler.h>
namespace alloy {

View File

@ -9,6 +9,7 @@
#include <alloy/backend/ivm/ivm_intcode.h>
#include <poly/poly.h>
#include <alloy/hir/label.h>
#include <alloy/runtime/runtime.h>
#include <alloy/runtime/symbol_info.h>

View File

@ -14,6 +14,7 @@
#include <alloy/core.h>
#include <alloy/string_buffer.h>
#include <alloy/backend/assembler.h>
namespace alloy {

View File

@ -9,6 +9,8 @@
#include <alloy/backend/x64/x64_code_cache.h>
#include <poly/poly.h>
namespace alloy {
namespace backend {
namespace x64 {

View File

@ -20,82 +20,4 @@
#include <xenia/string.h>
#include <xenia/types.h>
#include <poly/poly.h>
#include <alloy/arena.h>
#include <alloy/delegate.h>
#include <alloy/string_buffer.h>
namespace alloy {
typedef struct XECACHEALIGN vec128_s {
union {
struct {
float x;
float y;
float z;
float w;
};
struct {
uint32_t ix;
uint32_t iy;
uint32_t iz;
uint32_t iw;
};
float f4[4];
uint32_t i4[4];
uint16_t s8[8];
uint8_t b16[16];
struct {
uint64_t low;
uint64_t high;
};
};
bool operator==(const vec128_s& b) const {
return low == b.low && high == b.high;
}
} vec128_t;
XEFORCEINLINE vec128_t vec128i(uint32_t x, uint32_t y, uint32_t z, uint32_t w) {
vec128_t v;
v.i4[0] = x;
v.i4[1] = y;
v.i4[2] = z;
v.i4[3] = w;
return v;
}
XEFORCEINLINE vec128_t vec128f(float x, float y, float z, float w) {
vec128_t v;
v.f4[0] = x;
v.f4[1] = y;
v.f4[2] = z;
v.f4[3] = w;
return v;
}
XEFORCEINLINE vec128_t vec128b(uint8_t x0, uint8_t x1, uint8_t x2, uint8_t x3,
uint8_t y0, uint8_t y1, uint8_t y2, uint8_t y3,
uint8_t z0, uint8_t z1, uint8_t z2, uint8_t z3,
uint8_t w0, uint8_t w1, uint8_t w2, uint8_t w3) {
vec128_t v;
v.b16[0] = x3;
v.b16[1] = x2;
v.b16[2] = x1;
v.b16[3] = x0;
v.b16[4] = y3;
v.b16[5] = y2;
v.b16[6] = y1;
v.b16[7] = y0;
v.b16[8] = z3;
v.b16[9] = z2;
v.b16[10] = z1;
v.b16[11] = z0;
v.b16[12] = w3;
v.b16[13] = w2;
v.b16[14] = w1;
v.b16[15] = w0;
return v;
}
} // namespace alloy
#endif // ALLOY_CORE_H_

View File

@ -11,6 +11,7 @@
#define ALLOY_FRONTEND_PPC_PPC_CONTEXT_H_
#include <alloy/core.h>
#include <alloy/vec128.h>
namespace alloy { namespace runtime {

View File

@ -9,6 +9,9 @@
#include <alloy/frontend/ppc/ppc_disasm.h>
#include <poly/poly.h>
#include <alloy/string_buffer.h>
namespace alloy {
namespace frontend {
namespace ppc {

View File

@ -31,11 +31,9 @@ using alloy::runtime::Runtime;
using alloy::runtime::FunctionInfo;
PPCHIRBuilder::PPCHIRBuilder(PPCFrontend* frontend)
: HIRBuilder(), frontend_(frontend) {
comment_buffer_ = new StringBuffer(4096);
}
: HIRBuilder(), frontend_(frontend), comment_buffer_(4096) {}
PPCHIRBuilder::~PPCHIRBuilder() { delete comment_buffer_; }
PPCHIRBuilder::~PPCHIRBuilder() = default;
void PPCHIRBuilder::Reset() {
start_address_ = 0;
@ -100,9 +98,9 @@ int PPCHIRBuilder::Emit(FunctionInfo* symbol_info, bool with_debug_info) {
if (label) {
AnnotateLabel(address, label);
}
comment_buffer_->Reset();
DisasmPPC(i, comment_buffer_);
Comment("%.8X %.8X %s", address, i.code, comment_buffer_->GetString());
comment_buffer_.Reset();
DisasmPPC(i, &comment_buffer_);
Comment("%.8X %.8X %s", address, i.code, comment_buffer_.GetString());
first_instr = last_instr();
}

View File

@ -11,6 +11,7 @@
#define ALLOY_FRONTEND_PPC_PPC_HIR_BUILDER_H_
#include <alloy/core.h>
#include <alloy/string_buffer.h>
#include <alloy/hir/hir_builder.h>
#include <alloy/runtime/function.h>
#include <alloy/runtime/symbol_info.h>
@ -78,7 +79,7 @@ class PPCHIRBuilder : public hir::HIRBuilder {
PPCFrontend* frontend_;
// Reset whenever needed:
StringBuffer* comment_buffer_;
StringBuffer comment_buffer_;
// Reset each Emit:
bool with_debug_info_;

View File

@ -12,6 +12,7 @@
#include <sstream>
#include <alloy/frontend/ppc/ppc_instr_tables.h>
#include <poly/poly.h>
namespace alloy {
namespace frontend {

View File

@ -10,11 +10,15 @@
#ifndef ALLOY_FRONTEND_PPC_PPC_INSTR_H_
#define ALLOY_FRONTEND_PPC_PPC_INSTR_H_
#include <alloy/core.h>
#include <string>
#include <vector>
#include <alloy/core.h>
namespace alloy {
class StringBuffer;
} // namespace alloy
namespace alloy {
namespace frontend {
namespace ppc {

View File

@ -10,6 +10,8 @@
#ifndef ALLOY_FRONTEND_PPC_PPC_SCANNER_H_
#define ALLOY_FRONTEND_PPC_PPC_SCANNER_H_
#include <vector>
#include <alloy/core.h>
#include <alloy/runtime/symbol_info.h>

View File

@ -13,6 +13,7 @@
#include <memory>
#include <alloy/core.h>
#include <alloy/string_buffer.h>
#include <alloy/backend/assembler.h>
#include <alloy/compiler/compiler.h>
#include <alloy/runtime/symbol_info.h>

View File

@ -10,6 +10,7 @@
#ifndef ALLOY_HIR_BLOCK_H_
#define ALLOY_HIR_BLOCK_H_
#include <alloy/arena.h>
#include <alloy/core.h>
XEDECLARECLASS1(llvm, BitVector);

View File

@ -9,6 +9,7 @@
#include <alloy/hir/hir_builder.h>
#include <alloy/string_buffer.h>
#include <alloy/hir/block.h>
#include <alloy/hir/instr.h>
#include <alloy/hir/label.h>

View File

@ -10,6 +10,8 @@
#ifndef ALLOY_HIR_HIR_BUILDER_H_
#define ALLOY_HIR_HIR_BUILDER_H_
#include <vector>
#include <alloy/core.h>
#include <alloy/hir/block.h>
#include <alloy/hir/instr.h>
@ -17,6 +19,10 @@
#include <alloy/hir/opcodes.h>
#include <alloy/hir/value.h>
namespace alloy {
class StringBuffer;
} // namespace alloy
namespace alloy {
namespace hir {

View File

@ -11,8 +11,11 @@
#define ALLOY_HIR_VALUE_H_
#include <alloy/core.h>
#include <alloy/arena.h>
#include <alloy/vec128.h>
#include <alloy/backend/machine_info.h>
#include <alloy/hir/opcodes.h>
#include <poly/poly.h>
namespace alloy {
namespace hir {

View File

@ -9,7 +9,7 @@
#include <alloy/memory.h>
#include <poly/memory.h>
#include <poly/poly.h>
namespace alloy {

View File

@ -16,6 +16,7 @@
#include <unordered_map>
#include <alloy/core.h>
#include <alloy/delegate.h>
namespace alloy {
namespace runtime {

View File

@ -9,6 +9,8 @@
#include <alloy/runtime/entry_table.h>
#include <poly/poly.h>
namespace alloy {
namespace runtime {

View File

@ -13,6 +13,7 @@
#include <sstream>
#include <alloy/runtime/runtime.h>
#include <poly/poly.h>
namespace alloy {
namespace runtime {

View File

@ -12,6 +12,7 @@
#include <gflags/gflags.h>
#include <alloy/runtime/module.h>
#include <poly/poly.h>
// TODO(benvanik): based on compiler support
#include <alloy/backend/ivm/ivm_backend.h>

View File

@ -10,6 +10,7 @@
#include <alloy/runtime/thread_state.h>
#include <alloy/runtime/runtime.h>
#include <poly/poly.h>
namespace alloy {
namespace runtime {

View File

@ -14,6 +14,7 @@
'string_buffer.cc',
'string_buffer.h',
'type_pool.h',
'vec128.h',
],
'conditions': [

View File

@ -11,6 +11,7 @@
#define ALLOY_TYPE_POOL_H_
#include <mutex>
#include <vector>
#include <alloy/core.h>

87
src/alloy/vec128.h Normal file
View File

@ -0,0 +1,87 @@
/**
******************************************************************************
* 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_VEC128_H_
#define ALLOY_VEC128_H_
#include <alloy/core.h>
namespace alloy {
typedef struct XECACHEALIGN vec128_s {
union {
struct {
float x;
float y;
float z;
float w;
};
struct {
uint32_t ix;
uint32_t iy;
uint32_t iz;
uint32_t iw;
};
float f4[4];
uint32_t i4[4];
uint16_t s8[8];
uint8_t b16[16];
struct {
uint64_t low;
uint64_t high;
};
};
bool operator==(const vec128_s& b) const {
return low == b.low && high == b.high;
}
} vec128_t;
XEFORCEINLINE vec128_t vec128i(uint32_t x, uint32_t y, uint32_t z, uint32_t w) {
vec128_t v;
v.i4[0] = x;
v.i4[1] = y;
v.i4[2] = z;
v.i4[3] = w;
return v;
}
XEFORCEINLINE vec128_t vec128f(float x, float y, float z, float w) {
vec128_t v;
v.f4[0] = x;
v.f4[1] = y;
v.f4[2] = z;
v.f4[3] = w;
return v;
}
XEFORCEINLINE vec128_t vec128b(uint8_t x0, uint8_t x1, uint8_t x2, uint8_t x3,
uint8_t y0, uint8_t y1, uint8_t y2, uint8_t y3,
uint8_t z0, uint8_t z1, uint8_t z2, uint8_t z3,
uint8_t w0, uint8_t w1, uint8_t w2, uint8_t w3) {
vec128_t v;
v.b16[0] = x3;
v.b16[1] = x2;
v.b16[2] = x1;
v.b16[3] = x0;
v.b16[4] = y3;
v.b16[5] = y2;
v.b16[6] = y1;
v.b16[7] = y0;
v.b16[8] = z3;
v.b16[9] = z2;
v.b16[10] = z1;
v.b16[11] = z0;
v.b16[12] = w3;
v.b16[13] = w2;
v.b16[14] = w1;
v.b16[15] = w0;
return v;
}
} // namespace alloy
#endif // ALLOY_VEC128_H_

View File

@ -15,6 +15,7 @@
#include <poly/config.h>
#include <poly/cxx_compat.h>
#include <poly/math.h>
#include <poly/memory.h>
#include <poly/platform.h>
#include <poly/threading.h>

View File

@ -10,6 +10,8 @@
#ifndef XENIA_GPU_SHADER_RESOURCE_H_
#define XENIA_GPU_SHADER_RESOURCE_H_
#include <vector>
#include <xenia/gpu/buffer_resource.h>
#include <xenia/gpu/resource.h>
#include <xenia/gpu/xenos/ucode.h>

View File

@ -10,6 +10,8 @@
#ifndef XENIA_HID_INPUT_SYSTEM_H_
#define XENIA_HID_INPUT_SYSTEM_H_
#include <vector>
#include <xenia/core.h>
#include <xenia/xbox.h>

View File

@ -10,6 +10,8 @@
#ifndef XENIA_KERNEL_XBOXKRNL_ASYNC_REQUEST_H_
#define XENIA_KERNEL_XBOXKRNL_ASYNC_REQUEST_H_
#include <vector>
#include <xenia/common.h>
#include <xenia/core.h>

View File

@ -10,6 +10,8 @@
#ifndef XENIA_KERNEL_FS_DEVICES_DISC_IMAGE_ENTRY_H_
#define XENIA_KERNEL_FS_DEVICES_DISC_IMAGE_ENTRY_H_
#include <vector>
#include <xenia/common.h>
#include <xenia/core.h>

View File

@ -10,6 +10,8 @@
#ifndef XENIA_KERNEL_FS_DEVICES_STFS_CONTAINER_ENTRY_H_
#define XENIA_KERNEL_FS_DEVICES_STFS_CONTAINER_ENTRY_H_
#include <vector>
#include <xenia/common.h>
#include <xenia/core.h>