diff --git a/src/alloy/arena.cc b/src/alloy/arena.cc index d3a8992d8..66632e57d 100644 --- a/src/alloy/arena.cc +++ b/src/alloy/arena.cc @@ -9,6 +9,8 @@ #include +#include + namespace alloy { Arena::Arena(size_t chunk_size) diff --git a/src/alloy/backend/ivm/ivm_assembler.h b/src/alloy/backend/ivm/ivm_assembler.h index 446361647..eda2e864c 100644 --- a/src/alloy/backend/ivm/ivm_assembler.h +++ b/src/alloy/backend/ivm/ivm_assembler.h @@ -12,6 +12,7 @@ #include +#include #include namespace alloy { diff --git a/src/alloy/backend/ivm/ivm_intcode.cc b/src/alloy/backend/ivm/ivm_intcode.cc index 91181a9e7..a0d566a90 100644 --- a/src/alloy/backend/ivm/ivm_intcode.cc +++ b/src/alloy/backend/ivm/ivm_intcode.cc @@ -9,6 +9,7 @@ #include +#include #include #include #include diff --git a/src/alloy/backend/x64/x64_assembler.h b/src/alloy/backend/x64/x64_assembler.h index 769bee9db..9959a1135 100644 --- a/src/alloy/backend/x64/x64_assembler.h +++ b/src/alloy/backend/x64/x64_assembler.h @@ -14,6 +14,7 @@ #include +#include #include namespace alloy { diff --git a/src/alloy/backend/x64/x64_code_cache_win.cc b/src/alloy/backend/x64/x64_code_cache_win.cc index b5355cc46..f3e96455b 100644 --- a/src/alloy/backend/x64/x64_code_cache_win.cc +++ b/src/alloy/backend/x64/x64_code_cache_win.cc @@ -9,6 +9,8 @@ #include +#include + namespace alloy { namespace backend { namespace x64 { diff --git a/src/alloy/core.h b/src/alloy/core.h index 3d60666da..47633f886 100644 --- a/src/alloy/core.h +++ b/src/alloy/core.h @@ -20,82 +20,4 @@ #include #include -#include - -#include -#include -#include - -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_ diff --git a/src/alloy/frontend/ppc/ppc_context.h b/src/alloy/frontend/ppc/ppc_context.h index d1d28860a..6833f46cd 100644 --- a/src/alloy/frontend/ppc/ppc_context.h +++ b/src/alloy/frontend/ppc/ppc_context.h @@ -11,6 +11,7 @@ #define ALLOY_FRONTEND_PPC_PPC_CONTEXT_H_ #include +#include namespace alloy { namespace runtime { diff --git a/src/alloy/frontend/ppc/ppc_disasm.cc b/src/alloy/frontend/ppc/ppc_disasm.cc index 41f8c928a..8c832ce2f 100644 --- a/src/alloy/frontend/ppc/ppc_disasm.cc +++ b/src/alloy/frontend/ppc/ppc_disasm.cc @@ -9,6 +9,9 @@ #include +#include +#include + namespace alloy { namespace frontend { namespace ppc { diff --git a/src/alloy/frontend/ppc/ppc_hir_builder.cc b/src/alloy/frontend/ppc/ppc_hir_builder.cc index 38f72daab..0c466bd9e 100644 --- a/src/alloy/frontend/ppc/ppc_hir_builder.cc +++ b/src/alloy/frontend/ppc/ppc_hir_builder.cc @@ -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(); } diff --git a/src/alloy/frontend/ppc/ppc_hir_builder.h b/src/alloy/frontend/ppc/ppc_hir_builder.h index 1a7f8e8d0..120bc4d3c 100644 --- a/src/alloy/frontend/ppc/ppc_hir_builder.h +++ b/src/alloy/frontend/ppc/ppc_hir_builder.h @@ -11,6 +11,7 @@ #define ALLOY_FRONTEND_PPC_PPC_HIR_BUILDER_H_ #include +#include #include #include #include @@ -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_; diff --git a/src/alloy/frontend/ppc/ppc_instr.cc b/src/alloy/frontend/ppc/ppc_instr.cc index 251d07afe..df3a59206 100644 --- a/src/alloy/frontend/ppc/ppc_instr.cc +++ b/src/alloy/frontend/ppc/ppc_instr.cc @@ -12,6 +12,7 @@ #include #include +#include namespace alloy { namespace frontend { diff --git a/src/alloy/frontend/ppc/ppc_instr.h b/src/alloy/frontend/ppc/ppc_instr.h index 80b8cc3d1..6baf95464 100644 --- a/src/alloy/frontend/ppc/ppc_instr.h +++ b/src/alloy/frontend/ppc/ppc_instr.h @@ -10,11 +10,15 @@ #ifndef ALLOY_FRONTEND_PPC_PPC_INSTR_H_ #define ALLOY_FRONTEND_PPC_PPC_INSTR_H_ -#include - #include #include +#include + +namespace alloy { +class StringBuffer; +} // namespace alloy + namespace alloy { namespace frontend { namespace ppc { diff --git a/src/alloy/frontend/ppc/ppc_scanner.h b/src/alloy/frontend/ppc/ppc_scanner.h index deb51dcdf..769b879d6 100644 --- a/src/alloy/frontend/ppc/ppc_scanner.h +++ b/src/alloy/frontend/ppc/ppc_scanner.h @@ -10,6 +10,8 @@ #ifndef ALLOY_FRONTEND_PPC_PPC_SCANNER_H_ #define ALLOY_FRONTEND_PPC_PPC_SCANNER_H_ +#include + #include #include diff --git a/src/alloy/frontend/ppc/ppc_translator.h b/src/alloy/frontend/ppc/ppc_translator.h index 22011d449..5b359f836 100644 --- a/src/alloy/frontend/ppc/ppc_translator.h +++ b/src/alloy/frontend/ppc/ppc_translator.h @@ -13,6 +13,7 @@ #include #include +#include #include #include #include diff --git a/src/alloy/hir/block.h b/src/alloy/hir/block.h index 4d2df2e9a..f79147697 100644 --- a/src/alloy/hir/block.h +++ b/src/alloy/hir/block.h @@ -10,6 +10,7 @@ #ifndef ALLOY_HIR_BLOCK_H_ #define ALLOY_HIR_BLOCK_H_ +#include #include XEDECLARECLASS1(llvm, BitVector); diff --git a/src/alloy/hir/hir_builder.cc b/src/alloy/hir/hir_builder.cc index 1ba6ce55d..11d9b836a 100644 --- a/src/alloy/hir/hir_builder.cc +++ b/src/alloy/hir/hir_builder.cc @@ -9,6 +9,7 @@ #include +#include #include #include #include diff --git a/src/alloy/hir/hir_builder.h b/src/alloy/hir/hir_builder.h index 9d01a69b6..4d6d53e7c 100644 --- a/src/alloy/hir/hir_builder.h +++ b/src/alloy/hir/hir_builder.h @@ -10,6 +10,8 @@ #ifndef ALLOY_HIR_HIR_BUILDER_H_ #define ALLOY_HIR_HIR_BUILDER_H_ +#include + #include #include #include @@ -17,6 +19,10 @@ #include #include +namespace alloy { +class StringBuffer; +} // namespace alloy + namespace alloy { namespace hir { diff --git a/src/alloy/hir/value.h b/src/alloy/hir/value.h index 38e4947e9..f88f5d6cd 100644 --- a/src/alloy/hir/value.h +++ b/src/alloy/hir/value.h @@ -11,8 +11,11 @@ #define ALLOY_HIR_VALUE_H_ #include +#include +#include #include #include +#include namespace alloy { namespace hir { diff --git a/src/alloy/memory.cc b/src/alloy/memory.cc index c334c31a4..b744a24b9 100644 --- a/src/alloy/memory.cc +++ b/src/alloy/memory.cc @@ -9,7 +9,7 @@ #include -#include +#include namespace alloy { diff --git a/src/alloy/runtime/debugger.h b/src/alloy/runtime/debugger.h index 1b09f3ab3..971443605 100644 --- a/src/alloy/runtime/debugger.h +++ b/src/alloy/runtime/debugger.h @@ -16,6 +16,7 @@ #include #include +#include namespace alloy { namespace runtime { diff --git a/src/alloy/runtime/entry_table.cc b/src/alloy/runtime/entry_table.cc index aa0a41cbb..043623f4d 100644 --- a/src/alloy/runtime/entry_table.cc +++ b/src/alloy/runtime/entry_table.cc @@ -9,6 +9,8 @@ #include +#include + namespace alloy { namespace runtime { diff --git a/src/alloy/runtime/module.cc b/src/alloy/runtime/module.cc index bf953bf1e..8184e2d53 100644 --- a/src/alloy/runtime/module.cc +++ b/src/alloy/runtime/module.cc @@ -13,6 +13,7 @@ #include #include +#include namespace alloy { namespace runtime { diff --git a/src/alloy/runtime/runtime.cc b/src/alloy/runtime/runtime.cc index bca91c686..8f9ebd832 100644 --- a/src/alloy/runtime/runtime.cc +++ b/src/alloy/runtime/runtime.cc @@ -12,6 +12,7 @@ #include #include +#include // TODO(benvanik): based on compiler support #include diff --git a/src/alloy/runtime/thread_state.cc b/src/alloy/runtime/thread_state.cc index c2469b3c5..80b5ad71a 100644 --- a/src/alloy/runtime/thread_state.cc +++ b/src/alloy/runtime/thread_state.cc @@ -10,6 +10,7 @@ #include #include +#include namespace alloy { namespace runtime { diff --git a/src/alloy/sources.gypi b/src/alloy/sources.gypi index c912345b5..0854a8bc1 100644 --- a/src/alloy/sources.gypi +++ b/src/alloy/sources.gypi @@ -14,6 +14,7 @@ 'string_buffer.cc', 'string_buffer.h', 'type_pool.h', + 'vec128.h', ], 'conditions': [ diff --git a/src/alloy/type_pool.h b/src/alloy/type_pool.h index 57be0b36e..6483c9514 100644 --- a/src/alloy/type_pool.h +++ b/src/alloy/type_pool.h @@ -11,6 +11,7 @@ #define ALLOY_TYPE_POOL_H_ #include +#include #include diff --git a/src/alloy/vec128.h b/src/alloy/vec128.h new file mode 100644 index 000000000..7d251b0ff --- /dev/null +++ b/src/alloy/vec128.h @@ -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 + +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_ diff --git a/src/poly/poly.h b/src/poly/poly.h index b7af898ff..5b5c4b92e 100644 --- a/src/poly/poly.h +++ b/src/poly/poly.h @@ -15,6 +15,7 @@ #include #include #include +#include #include #include diff --git a/src/xenia/gpu/shader_resource.h b/src/xenia/gpu/shader_resource.h index b591bfaf2..85414daf8 100644 --- a/src/xenia/gpu/shader_resource.h +++ b/src/xenia/gpu/shader_resource.h @@ -10,6 +10,8 @@ #ifndef XENIA_GPU_SHADER_RESOURCE_H_ #define XENIA_GPU_SHADER_RESOURCE_H_ +#include + #include #include #include diff --git a/src/xenia/hid/input_system.h b/src/xenia/hid/input_system.h index a86fc8525..cb8d33019 100644 --- a/src/xenia/hid/input_system.h +++ b/src/xenia/hid/input_system.h @@ -10,6 +10,8 @@ #ifndef XENIA_HID_INPUT_SYSTEM_H_ #define XENIA_HID_INPUT_SYSTEM_H_ +#include + #include #include diff --git a/src/xenia/kernel/async_request.h b/src/xenia/kernel/async_request.h index 40317ea4a..0af0ac6f2 100644 --- a/src/xenia/kernel/async_request.h +++ b/src/xenia/kernel/async_request.h @@ -10,6 +10,8 @@ #ifndef XENIA_KERNEL_XBOXKRNL_ASYNC_REQUEST_H_ #define XENIA_KERNEL_XBOXKRNL_ASYNC_REQUEST_H_ +#include + #include #include diff --git a/src/xenia/kernel/fs/devices/disc_image_entry.h b/src/xenia/kernel/fs/devices/disc_image_entry.h index 4ed31b5ef..bbe788a3b 100644 --- a/src/xenia/kernel/fs/devices/disc_image_entry.h +++ b/src/xenia/kernel/fs/devices/disc_image_entry.h @@ -10,6 +10,8 @@ #ifndef XENIA_KERNEL_FS_DEVICES_DISC_IMAGE_ENTRY_H_ #define XENIA_KERNEL_FS_DEVICES_DISC_IMAGE_ENTRY_H_ +#include + #include #include diff --git a/src/xenia/kernel/fs/devices/stfs_container_entry.h b/src/xenia/kernel/fs/devices/stfs_container_entry.h index 2f9129595..8858a3441 100644 --- a/src/xenia/kernel/fs/devices/stfs_container_entry.h +++ b/src/xenia/kernel/fs/devices/stfs_container_entry.h @@ -10,6 +10,8 @@ #ifndef XENIA_KERNEL_FS_DEVICES_STFS_CONTAINER_ENTRY_H_ #define XENIA_KERNEL_FS_DEVICES_STFS_CONTAINER_ENTRY_H_ +#include + #include #include