Running clang-format on alloy.
All except x64_sequences, which needs work.
This commit is contained in:
@@ -21,22 +21,23 @@ namespace BE {
|
||||
#include <beaengine/BeaEngine.h>
|
||||
}
|
||||
|
||||
using namespace alloy;
|
||||
using namespace alloy::backend;
|
||||
using namespace alloy::backend::x64;
|
||||
using namespace alloy::hir;
|
||||
namespace alloy {
|
||||
namespace backend {
|
||||
namespace x64 {
|
||||
|
||||
// TODO(benvanik): remove when enums redefined.
|
||||
using namespace alloy::runtime;
|
||||
|
||||
using alloy::hir::HIRBuilder;
|
||||
using alloy::runtime::DebugInfo;
|
||||
using alloy::runtime::Function;
|
||||
using alloy::runtime::FunctionInfo;
|
||||
|
||||
X64Assembler::X64Assembler(X64Backend* backend) :
|
||||
x64_backend_(backend),
|
||||
emitter_(0), allocator_(0),
|
||||
Assembler(backend) {
|
||||
}
|
||||
X64Assembler::X64Assembler(X64Backend* backend)
|
||||
: x64_backend_(backend), emitter_(0), allocator_(0), Assembler(backend) {}
|
||||
|
||||
X64Assembler::~X64Assembler() {
|
||||
alloy::tracing::WriteEvent(EventType::AssemblerDeinit({
|
||||
}));
|
||||
alloy::tracing::WriteEvent(EventType::AssemblerDeinit({}));
|
||||
|
||||
delete emitter_;
|
||||
delete allocator_;
|
||||
@@ -51,8 +52,7 @@ int X64Assembler::Initialize() {
|
||||
allocator_ = new XbyakAllocator();
|
||||
emitter_ = new X64Emitter(x64_backend_, allocator_);
|
||||
|
||||
alloy::tracing::WriteEvent(EventType::AssemblerInit({
|
||||
}));
|
||||
alloy::tracing::WriteEvent(EventType::AssemblerInit({}));
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -62,10 +62,9 @@ void X64Assembler::Reset() {
|
||||
Assembler::Reset();
|
||||
}
|
||||
|
||||
int X64Assembler::Assemble(
|
||||
FunctionInfo* symbol_info, HIRBuilder* builder,
|
||||
uint32_t debug_info_flags, DebugInfo* debug_info,
|
||||
Function** out_function) {
|
||||
int X64Assembler::Assemble(FunctionInfo* symbol_info, HIRBuilder* builder,
|
||||
uint32_t debug_info_flags, DebugInfo* debug_info,
|
||||
Function** out_function) {
|
||||
SCOPE_profile_cpu_f("alloy");
|
||||
|
||||
int result = 0;
|
||||
@@ -73,13 +72,12 @@ int X64Assembler::Assemble(
|
||||
// Lower HIR -> x64.
|
||||
void* machine_code = 0;
|
||||
size_t code_size = 0;
|
||||
result = emitter_->Emit(builder,
|
||||
debug_info_flags, debug_info,
|
||||
machine_code, code_size);
|
||||
result = emitter_->Emit(builder, debug_info_flags, debug_info, machine_code,
|
||||
code_size);
|
||||
XEEXPECTZERO(result);
|
||||
|
||||
// Stash generated machine code.
|
||||
if (debug_info_flags & DEBUG_INFO_MACHINE_CODE_DISASM) {
|
||||
if (debug_info_flags & DebugInfoFlags::DEBUG_INFO_MACHINE_CODE_DISASM) {
|
||||
DumpMachineCode(debug_info, machine_code, code_size, &string_buffer_);
|
||||
debug_info->set_machine_code_disasm(string_buffer_.ToString());
|
||||
string_buffer_.Reset();
|
||||
@@ -100,10 +98,8 @@ XECLEANUP:
|
||||
return result;
|
||||
}
|
||||
|
||||
void X64Assembler::DumpMachineCode(
|
||||
DebugInfo* debug_info,
|
||||
void* machine_code, size_t code_size,
|
||||
StringBuffer* str) {
|
||||
void X64Assembler::DumpMachineCode(DebugInfo* debug_info, void* machine_code,
|
||||
size_t code_size, StringBuffer* str) {
|
||||
BE::DISASM disasm;
|
||||
xe_zero_struct(&disasm, sizeof(disasm));
|
||||
disasm.Archi = 64;
|
||||
@@ -113,8 +109,8 @@ void X64Assembler::DumpMachineCode(
|
||||
uint64_t prev_source_offset = 0;
|
||||
while (disasm.EIP < eip_end) {
|
||||
// Look up source offset.
|
||||
auto map_entry = debug_info->LookupCodeOffset(
|
||||
disasm.EIP - (BE::UIntPtr)machine_code);
|
||||
auto map_entry =
|
||||
debug_info->LookupCodeOffset(disasm.EIP - (BE::UIntPtr)machine_code);
|
||||
if (map_entry) {
|
||||
if (map_entry->source_offset == prev_source_offset) {
|
||||
str->Append(" ");
|
||||
@@ -134,3 +130,7 @@ void X64Assembler::DumpMachineCode(
|
||||
disasm.EIP += len;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace x64
|
||||
} // namespace backend
|
||||
} // namespace alloy
|
||||
|
||||
Reference in New Issue
Block a user