3 ms·
How is an assembly code generator different than a compiler?
by rthomas6 11y ago
How is an assembly code generator different than a compiler?
- z92 11y agoAssembly code then has to be compiled into machine code to create the executable.
- lfowles 11y agoTo expand a bit in terrible pseudocode that I sort of remember from Atmel ucs: Assembly: mov 0x1,reg2 # put 1 in register 2 Machine Code: 0xAC12 # Move an immediate value into register 2 Assembly: mov *reg2,reg1 # put contents of address in reg2 in reg1 Machine Code: 0xBF201 # Move an indirect value, offset 0, address in reg2 to reg1 It's a much more straightforward transformation than the one from C->ASM though. Edit: This link might make more sense... the difference is mainly between the mnemonic and the encoding: http://www.mrc.uidaho.edu/mrc/people/jff/digital/MIPSir.html http://www.mrc.uidaho.edu/mrc/people/jff/digital/MIPSir.html You'll also notice there are explicit instructions for immediate ops, but no two assembly schemes seem to share the same level of abstraction.
- Marat_Dukhan 11y agoEarlier versions of PeachPy generated assembly source that had to be compiled with NASM or GNU assembler. Now PeachPy can directly generate object files, and it would be fair to call it a compiler, but I like the old name