0x-omicron / py-dcpu-c-compiler

C to DCPU-16 compiler written in python.
Other
15 stars 0 forks source link

Output Code with Labels #1

Open kevinastock opened 12 years ago

kevinastock commented 12 years ago

Assembers can better optimize code using labels whenever possible (by using short literals and relative PC changes). Based on the README the output code uses only absolute values which is impossible to optimize, but it would be ideal if all basic block entry points were marked with labels and any SET PC, xxx or JSR xxx used those labels.

0x-omicron commented 12 years ago

The output right now is generated straight to the instructions -- it doesn't generate the .asm files. I got those from running a disassembler on the output of the program.

But I agree with you in two ways: (1) there should be an option to output to .asm instead of .out, and labels should be used there, and (2) the generated .out files should be optimized anyways; another assembler shouldn't be able to do any better.