Moving byte order/memory access to poly.
This commit is contained in:
@@ -1343,7 +1343,9 @@ int InstrEmit_vsldoi_(PPCHIRBuilder& f, uint32_t vd, uint32_t va, uint32_t vb,
|
||||
// (ABCD ABCD) << 4b = (BCDA)
|
||||
// (VA << SH) OR (VB >> (16 - SH))
|
||||
vec128_t shift = *((vec128_t*)(__vsldoi_table[sh]));
|
||||
for (int i = 0; i < 4; ++i) shift.i4[i] = XESWAP32BE(shift.i4[i]);
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
shift.i4[i] = poly::byte_swap(shift.i4[i]);
|
||||
}
|
||||
Value* control = f.LoadConstant(shift);
|
||||
Value* v = f.Permute(control, f.LoadVR(va), f.LoadVR(vb), INT8_TYPE);
|
||||
f.StoreVR(vd, v);
|
||||
|
||||
@@ -81,7 +81,7 @@ int PPCHIRBuilder::Emit(FunctionInfo* symbol_info, bool with_debug_info) {
|
||||
for (uint64_t address = start_address, offset = 0; address <= end_address;
|
||||
address += 4, offset++) {
|
||||
i.address = address;
|
||||
i.code = XEGETUINT32BE(p + address);
|
||||
i.code = poly::load_and_swap<uint32_t>(p + address);
|
||||
// TODO(benvanik): find a way to avoid using the opcode tables.
|
||||
i.type = GetInstrType(i.code);
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <alloy/frontend/ppc/ppc_frontend.h>
|
||||
#include <alloy/frontend/ppc/ppc_instr.h>
|
||||
#include <alloy/runtime/runtime.h>
|
||||
#include <poly/memory.h>
|
||||
|
||||
namespace alloy {
|
||||
namespace frontend {
|
||||
@@ -58,7 +59,7 @@ int PPCScanner::FindExtents(FunctionInfo* symbol_info) {
|
||||
InstrData i;
|
||||
while (true) {
|
||||
i.address = address;
|
||||
i.code = XEGETUINT32BE(p + address);
|
||||
i.code = poly::load_and_swap<uint32_t>(p + address);
|
||||
|
||||
// If we fetched 0 assume that we somehow hit one of the awesome
|
||||
// 'no really we meant to end after that bl' functions.
|
||||
@@ -291,7 +292,7 @@ std::vector<BlockInfo> PPCScanner::FindBlocks(FunctionInfo* symbol_info) {
|
||||
InstrData i;
|
||||
for (uint64_t address = start_address; address <= end_address; address += 4) {
|
||||
i.address = address;
|
||||
i.code = XEGETUINT32BE(p + address);
|
||||
i.code = poly::load_and_swap<uint32_t>(p + address);
|
||||
if (!i.code) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ void PPCTranslator::DumpSource(runtime::FunctionInfo* symbol_info,
|
||||
for (uint64_t address = start_address, offset = 0; address <= end_address;
|
||||
address += 4, offset++) {
|
||||
i.address = address;
|
||||
i.code = XEGETUINT32BE(p + address);
|
||||
i.code = poly::load_and_swap<uint32_t>(p + address);
|
||||
// TODO(benvanik): find a way to avoid using the opcode tables.
|
||||
i.type = GetInstrType(i.code);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user