[JIT] New opcodes: OPCODE_LOAD_OFFSET and OPCODE_STORE_OFFSET
These take full advantage of x86 addressing, and eliminate extra add operations.
This commit is contained in:
@@ -1232,6 +1232,25 @@ void HIRBuilder::StoreMmio(cpu::MMIORange* mmio_range, uint32_t address,
|
||||
i->set_src3(value);
|
||||
}
|
||||
|
||||
Value* HIRBuilder::LoadOffset(Value* address, Value* offset, TypeName type,
|
||||
uint32_t load_flags) {
|
||||
ASSERT_ADDRESS_TYPE(address);
|
||||
Instr* i = AppendInstr(OPCODE_LOAD_OFFSET_info, load_flags, AllocValue(type));
|
||||
i->set_src1(address);
|
||||
i->set_src2(offset);
|
||||
i->src3.value = NULL;
|
||||
return i->dest;
|
||||
}
|
||||
|
||||
void HIRBuilder::StoreOffset(Value* address, Value* offset, Value* value,
|
||||
uint32_t store_flags) {
|
||||
ASSERT_ADDRESS_TYPE(address);
|
||||
Instr* i = AppendInstr(OPCODE_STORE_OFFSET_info, store_flags);
|
||||
i->set_src1(address);
|
||||
i->set_src2(offset);
|
||||
i->set_src3(value);
|
||||
}
|
||||
|
||||
Value* HIRBuilder::Load(Value* address, TypeName type, uint32_t load_flags) {
|
||||
ASSERT_ADDRESS_TYPE(address);
|
||||
Instr* i = AppendInstr(OPCODE_LOAD_info, load_flags, AllocValue(type));
|
||||
|
||||
@@ -147,6 +147,11 @@ class HIRBuilder {
|
||||
Value* LoadMmio(cpu::MMIORange* mmio_range, uint32_t address, TypeName type);
|
||||
void StoreMmio(cpu::MMIORange* mmio_range, uint32_t address, Value* value);
|
||||
|
||||
Value* LoadOffset(Value* address, Value* offset, TypeName type,
|
||||
uint32_t load_flags = 0);
|
||||
void StoreOffset(Value* address, Value* offset, Value* value,
|
||||
uint32_t store_flags = 0);
|
||||
|
||||
Value* Load(Value* address, TypeName type, uint32_t load_flags = 0);
|
||||
void Store(Value* address, Value* value, uint32_t store_flags = 0);
|
||||
void Memset(Value* address, Value* value, Value* length);
|
||||
|
||||
@@ -152,6 +152,8 @@ enum Opcode {
|
||||
OPCODE_CONTEXT_BARRIER,
|
||||
OPCODE_LOAD_MMIO,
|
||||
OPCODE_STORE_MMIO,
|
||||
OPCODE_LOAD_OFFSET,
|
||||
OPCODE_STORE_OFFSET,
|
||||
OPCODE_LOAD,
|
||||
OPCODE_STORE,
|
||||
OPCODE_MEMSET,
|
||||
|
||||
@@ -231,6 +231,18 @@ DEFINE_OPCODE(
|
||||
OPCODE_SIG_X_O_O_V,
|
||||
OPCODE_FLAG_MEMORY)
|
||||
|
||||
DEFINE_OPCODE(
|
||||
OPCODE_LOAD_OFFSET,
|
||||
"load_offset",
|
||||
OPCODE_SIG_V_V_V,
|
||||
OPCODE_FLAG_MEMORY)
|
||||
|
||||
DEFINE_OPCODE(
|
||||
OPCODE_STORE_OFFSET,
|
||||
"store_offset",
|
||||
OPCODE_SIG_X_V_V_V,
|
||||
OPCODE_FLAG_MEMORY)
|
||||
|
||||
DEFINE_OPCODE(
|
||||
OPCODE_LOAD,
|
||||
"load",
|
||||
|
||||
Reference in New Issue
Block a user