TC-Y Code to Write
Tip
Information on ARM assembly instructions may be found in the ARM Architecture Reference Manual.
- src/target/arm/arm-matcher.cc
target::arm::ArmMatcher
is the functor used for instruction selection pattern-matching.- src/target/arm/arm-assembly.cc
ArmAssembly::cjump_build
translates conditional branch instructions (branch if equal, if lower than, etc.) into ARM assembly.- Runtime
You have to complete the implementation of the runtime in
src/target/arm/runtime.s
:- strcmp
- streq
Warning
Strings are implemented as 4 bytes to encode the length, and then a 0-terminated C-like string. You should rely on the initial encoded length, which is always present for compliance.
See the example below on how the string data is represented (
l0
):hello-world-arm.tigprint("Hello Tiger!")
tc --target-arm --inst-display hello-world-arm.tig | head -n 6$ tc --target-arm --inst-display hello-world-arm.tig | head -n 6 # Tiger final assembler ouput. .data l0: .word 12 .asciz "Hello Tiger!" $ echo $? 0
String data representation (assuming little endian) Address (
l0
+)0x00
0x01
0x02
0x03
0x04
0x05
…
0x10
Value
0x00
0x00
0x00
0x0c
'H'
'e'
…
'\0'
- src/target/arm/arm-codegen.cc (Optional)
Completing the
Codegen::rewrite_program
routine will be needed during register allocation only, see TC-9, Register Allocation.