rename write to assembler for builders
This commit is contained in:
parent
82ea5730f3
commit
1b8f15a3fc
@ -85,33 +85,33 @@ module Asm
|
|||||||
builder.rd = reg_ref(args[0])
|
builder.rd = reg_ref(args[0])
|
||||||
builder.rn = reg_ref(args[1])
|
builder.rn = reg_ref(args[1])
|
||||||
builder.build_operand args[2]
|
builder.build_operand args[2]
|
||||||
builder.write io, as
|
builder.assemble io, as
|
||||||
when :cmn, :cmp, :teq, :tst
|
when :cmn, :cmp, :teq, :tst
|
||||||
builder = NormalBuilder.new(OPC_DATA_PROCESSING, OPCODES[opcode], 1)
|
builder = NormalBuilder.new(OPC_DATA_PROCESSING, OPCODES[opcode], 1)
|
||||||
builder.cond = COND_BITS[@cond]
|
builder.cond = COND_BITS[@cond]
|
||||||
builder.rn = reg_ref(args[0])
|
builder.rn = reg_ref(args[0])
|
||||||
builder.rd = 0
|
builder.rd = 0
|
||||||
builder.build_operand args[1]
|
builder.build_operand args[1]
|
||||||
builder.write io, as
|
builder.assemble io, as
|
||||||
when :mov, :mvn
|
when :mov, :mvn
|
||||||
builder = NormalBuilder.new(OPC_DATA_PROCESSING, OPCODES[opcode], s)
|
builder = NormalBuilder.new(OPC_DATA_PROCESSING, OPCODES[opcode], s)
|
||||||
builder.cond = COND_BITS[@cond]
|
builder.cond = COND_BITS[@cond]
|
||||||
builder.rn = 0
|
builder.rn = 0
|
||||||
builder.rd = reg_ref(args[0])
|
builder.rd = reg_ref(args[0])
|
||||||
builder.build_operand args[1]
|
builder.build_operand args[1]
|
||||||
builder.write io, as
|
builder.assemble io, as
|
||||||
when :strb, :str
|
when :strb, :str
|
||||||
builder = MemoryAccessBuilder.new(OPC_MEMORY_ACCESS, (opcode == :strb ? 1 : 0), 0)
|
builder = MemoryAccessBuilder.new(OPC_MEMORY_ACCESS, (opcode == :strb ? 1 : 0), 0)
|
||||||
builder.cond = COND_BITS[@cond]
|
builder.cond = COND_BITS[@cond]
|
||||||
builder.rd = reg_ref(args[1])
|
builder.rd = reg_ref(args[1])
|
||||||
builder.build_operand args[0]
|
builder.build_operand args[0]
|
||||||
builder.write io, as, @ast_asm, self
|
builder.assemble io, as, @ast_asm, self
|
||||||
when :ldrb, :ldr
|
when :ldrb, :ldr
|
||||||
builder = MemoryAccessBuilder.new(OPC_MEMORY_ACCESS, (opcode == :ldrb ? 1 : 0), 1)
|
builder = MemoryAccessBuilder.new(OPC_MEMORY_ACCESS, (opcode == :ldrb ? 1 : 0), 1)
|
||||||
builder.cond = COND_BITS[@cond]
|
builder.cond = COND_BITS[@cond]
|
||||||
builder.rd = reg_ref(args[0])
|
builder.rd = reg_ref(args[0])
|
||||||
builder.build_operand args[1]
|
builder.build_operand args[1]
|
||||||
builder.write io, as, @ast_asm, self
|
builder.assemble io, as, @ast_asm, self
|
||||||
when :push, :pop
|
when :push, :pop
|
||||||
# downward growing, decrement before memory access
|
# downward growing, decrement before memory access
|
||||||
# official ARM style stack as used by gas
|
# official ARM style stack as used by gas
|
||||||
@ -123,7 +123,7 @@ module Asm
|
|||||||
builder.cond = COND_BITS[@cond]
|
builder.cond = COND_BITS[@cond]
|
||||||
builder.rn = 13 # sp
|
builder.rn = 13 # sp
|
||||||
builder.build_operand args
|
builder.build_operand args
|
||||||
builder.write io, as
|
builder.assemble io, as
|
||||||
when :b, :bl
|
when :b, :bl
|
||||||
arg = args[0]
|
arg = args[0]
|
||||||
if (arg.is_a?(Asm::NumLiteralNode))
|
if (arg.is_a?(Asm::NumLiteralNode))
|
||||||
|
@ -65,7 +65,7 @@ module Asm
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def write(io, as, ast_asm, inst)
|
def assemble(io, as, generator, inst)
|
||||||
#not sure about these 2 constants. They produce the correct output for str r0 , r1
|
#not sure about these 2 constants. They produce the correct output for str r0 , r1
|
||||||
# but i can't help thinking that that is because they are not used in that instruction and
|
# but i can't help thinking that that is because they are not used in that instruction and
|
||||||
# so it doesn't matter. Will see
|
# so it doesn't matter. Will see
|
||||||
@ -79,7 +79,7 @@ module Asm
|
|||||||
if (@use_addrtable_reloc)
|
if (@use_addrtable_reloc)
|
||||||
# closest_addrtable = Asm::Arm.closest_addrtable(as)
|
# closest_addrtable = Asm::Arm.closest_addrtable(as)
|
||||||
if (@addrtable_reloc_target.is_a?(Asm::LabelRefNode))
|
if (@addrtable_reloc_target.is_a?(Asm::LabelRefNode))
|
||||||
obj = ast_asm.object_for_label(@addrtable_reloc_target.label, inst)
|
obj = generator.object_for_label(@addrtable_reloc_target.label, inst)
|
||||||
ref_label = closest_addrtable.add_label(obj)
|
ref_label = closest_addrtable.add_label(obj)
|
||||||
elsif (@addrtable_reloc_target.is_a?(Asm::NumLiteralNode))
|
elsif (@addrtable_reloc_target.is_a?(Asm::NumLiteralNode))
|
||||||
ref_label = closest_addrtable.add_const(@addrtable_reloc_target.value)
|
ref_label = closest_addrtable.add_const(@addrtable_reloc_target.value)
|
||||||
|
@ -88,7 +88,7 @@ module Asm
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def write(io, as)
|
def assemble(io, as)
|
||||||
val = operand | (rd << 12) | (rn << 12+4) |
|
val = operand | (rd << 12) | (rn << 12+4) |
|
||||||
(s << 12+4+4) | (opcode << 12+4+4+1) |
|
(s << 12+4+4) | (opcode << 12+4+4+1) |
|
||||||
(i << 12+4+4+1+4) | (inst_class << 12+4+4+1+4+1) |
|
(i << 12+4+4+1+4) | (inst_class << 12+4+4+1+4+1) |
|
||||||
|
@ -37,7 +37,7 @@ module Asm
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def write(io, as)
|
def assemble(io, as)
|
||||||
val = operand | (rn << 16) | (store_load << 16+4) |
|
val = operand | (rn << 16) | (store_load << 16+4) |
|
||||||
(write_base << 16+4+1) | (s << 16+4+1+1) | (up_down << 16+4+1+1+1) |
|
(write_base << 16+4+1) | (s << 16+4+1+1) | (up_down << 16+4+1+1+1) |
|
||||||
(pre_post_index << 16+4+1+1+1+1) | (inst_class << 16+4+1+1+1+1+2) |
|
(pre_post_index << 16+4+1+1+1+1) | (inst_class << 16+4+1+1+1+1+2) |
|
||||||
|
Loading…
Reference in New Issue
Block a user