Compiler
description
Transcript of Compiler
Compiler• RealView
Development Suite 4.0
• Supported ARM architecture- ARMv4 – ARMv7
Sample Codefactorial.c
int main(){ int i, x; int ans; for (x = 0, i=0; i<4; i++){ x = x + 5; } ans = x; for (x = 0, i=0; i<3; i++){ x = x + ans; } ans = x; for (x = 0, i=0; i<2; i++){ x = x + ans; } ans = x; for (x = 0, i=0; i<1; i++){ x = x + ans; } ans = x; return 0;}
factorial.s
; generated by ARM C/C++ Compiler, RVCT4.0 [Build 400]; commandline armcc [--c99 -c --asm -ofactorial.o --cpu=4T ..\factorial.c]
main PROC MOV r0,#0|L1.4| ADD r0,r0,#1 CMP r0,#4 BLT |L1.4| MOV r0,#0|L1.20| ADD r0,r0,#1 CMP r0,#3 BLT |L1.20| MOV r0,#0|L1.36| ADD r0,r0,#1 CMP r0,#2 BLT |L1.36| MOV r0,#0|L1.52| ADD r0,r0,#1 CMP r0,#1 BLT |L1.52| MOV r0,#0 BX lr ENDP
Default ARM architecture: ARM7TDMI
Problems Encountered
• Acquiring a full version of the tool• Compiling the test program (radix.c)