Commit 7c251dbb authored by David Schleef's avatar David Schleef

arm: implement load/store of b, l

parent 01535dcd
......@@ -93,8 +93,12 @@ void orc_arm_emit_push (OrcCompiler *compiler, int regs);
void orc_arm_emit_pop (OrcCompiler *compiler, int regs);
void orc_arm_emit_branch (OrcCompiler *compiler, int cond, int label);
void orc_arm_loadb (OrcCompiler *compiler, int dest, int src1, int offset);
void orc_arm_storeb (OrcCompiler *compiler, int dest, int offset, int src1);
void orc_arm_loadw (OrcCompiler *compiler, int dest, int src1, int offset);
void orc_arm_storew (OrcCompiler *compiler, int dest, int offset, int src1);
void orc_arm_loadl (OrcCompiler *compiler, int dest, int src1, int offset);
void orc_arm_storel (OrcCompiler *compiler, int dest, int offset, int src1);
void orc_arm_emit_load_reg (OrcCompiler *compiler, int dest, int src1, int offset);
void orc_arm_emit_store_reg (OrcCompiler *compiler, int src, int dest, int offset);
......
......@@ -146,12 +146,13 @@ orc_arm_load_constants (OrcCompiler *compiler)
if (compiler->vars[i].name == NULL) continue;
switch (compiler->vars[i].vartype) {
case ORC_VAR_TYPE_CONST:
//orc_arm_emit_loadiw (compiler, compiler->vars[i].alloc,
// (int)compiler->vars[i].value);
orc_arm_emit_load_imm (compiler, compiler->vars[i].alloc,
(int)compiler->vars[i].value);
break;
case ORC_VAR_TYPE_PARAM:
//orc_arm_emit_loadw (compiler, compiler->vars[i].alloc,
// (int)ORC_STRUCT_OFFSET(OrcExecutor, params[i]), compiler->exec_reg);
orc_arm_loadw (compiler, compiler->vars[i].alloc,
compiler->exec_reg,
(int)ORC_STRUCT_OFFSET(OrcExecutor, params[i]));
break;
case ORC_VAR_TYPE_SRC:
case ORC_VAR_TYPE_DEST:
......@@ -180,7 +181,8 @@ orc_arm_emit_load_src (OrcCompiler *compiler, OrcVariable *var)
ptr_reg = var->ptr_register;
}
switch (var->size << compiler->loop_shift) {
//case 1:
case 1:
orc_arm_loadb (compiler, var->alloc, ptr_reg, 0);
//orc_arm_emit_mov_memoffset_reg (compiler, 1, 0, ptr_reg, X86_ECX);
//orc_arm_emit_mov_reg_arm (compiler, X86_ECX, var->alloc);
break;
......@@ -189,7 +191,8 @@ orc_arm_emit_load_src (OrcCompiler *compiler, OrcVariable *var)
//orc_arm_emit_mov_memoffset_reg (compiler, 2, 0, ptr_reg, X86_ECX);
//orc_arm_emit_mov_reg_arm (compiler, X86_ECX, var->alloc);
break;
//case 4:
case 4:
orc_arm_loadl (compiler, var->alloc, ptr_reg, 0);
//orc_arm_emit_mov_memoffset_arm (compiler, 4, 0, ptr_reg, var->alloc);
break;
//case 8:
......@@ -216,6 +219,7 @@ orc_arm_emit_store_dest (OrcCompiler *compiler, OrcVariable *var)
}
switch (var->size << compiler->loop_shift) {
case 1:
orc_arm_storeb (compiler, ptr_reg, 0, var->alloc);
//orc_arm_emit_mov_orc_arm_reg (compiler, var->alloc, X86_ECX);
//orc_arm_emit_mov_reg_memoffset (compiler, 1, X86_ECX, 0, ptr_reg);
break;
......@@ -225,6 +229,7 @@ orc_arm_emit_store_dest (OrcCompiler *compiler, OrcVariable *var)
//orc_arm_emit_mov_reg_memoffset (compiler, 2, X86_ECX, 0, ptr_reg);
break;
case 4:
orc_arm_storel (compiler, ptr_reg, 0, var->alloc);
//orc_arm_emit_mov_orc_arm_memoffset (compiler, 4, var->alloc, 0, ptr_reg,
// var->is_aligned, var->is_uncached);
break;
......
......@@ -78,6 +78,74 @@ arm_rule_ ## opcode (OrcCompiler *p, void *user, OrcInstruction *insn) \
orc_arm_emit(p,orc_arm_mull (0x00800090,cond,S,RdH,RdL,Rm,Rs)); \
} while (0)
void
orc_arm_loadb (OrcCompiler *compiler, int dest, int src1, int offset)
{
orc_uint32 code;
code = 0xe5d00000;
code |= (src1&0xf) << 16;
code |= (dest&0xf) << 12;
code |= (offset&0xf0) << 4;
code |= offset&0x0f;
ORC_ASM_CODE(compiler," ldrb %s, [%s, #%d]\n",
orc_arm_reg_name (dest),
orc_arm_reg_name (src1), offset);
orc_arm_emit (compiler, code);
}
void
orc_arm_storeb (OrcCompiler *compiler, int dest, int offset, int src1)
{
orc_uint32 code;
code = 0xe5c00000;
code |= (dest&0xf) << 16;
code |= (src1&0xf) << 12;
code |= (offset&0xf0) << 4;
code |= offset&0x0f;
ORC_ASM_CODE(compiler," strb %s, [%s, #%d]\n",
orc_arm_reg_name (src1),
orc_arm_reg_name (dest), offset);
orc_arm_emit (compiler, code);
}
void
orc_arm_loadl (OrcCompiler *compiler, int dest, int src1, int offset)
{
orc_uint32 code;
code = 0xe5900000;
code |= (src1&0xf) << 16;
code |= (dest&0xf) << 12;
code |= (offset&0xf0) << 4;
code |= offset&0x0f;
ORC_ASM_CODE(compiler," ldr %s, [%s, #%d]\n",
orc_arm_reg_name (dest),
orc_arm_reg_name (src1), offset);
orc_arm_emit (compiler, code);
}
void
orc_arm_storel (OrcCompiler *compiler, int dest, int offset, int src1)
{
orc_uint32 code;
code = 0xe5800000;
code |= (dest&0xf) << 16;
code |= (src1&0xf) << 12;
code |= (offset&0xf0) << 4;
code |= offset&0x0f;
ORC_ASM_CODE(compiler," str %s, [%s, #%d]\n",
orc_arm_reg_name (src1),
orc_arm_reg_name (dest), offset);
orc_arm_emit (compiler, code);
}
void
orc_arm_loadw (OrcCompiler *compiler, int dest, int src1, int offset)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment