Re:ASM
by stephencanon on Friday April 12, 2013 @11:52AM
(#5539178)
There is a one-to-one map between a mnemonic plus its operands and the resulting opcode, which is the relevant criteria. The use of macros doesn’t change this (though the use of pseudo-instructions can, if they force islands to be created for constants or jump tables).
Re:ASM
by CountHackulus on Friday April 12, 2013 @12:09PM
(#5539295)
For nearly any other assembly language, like say System 390 or PowerPC, it's a straightforward 1-1 mapping. Macros and pseudo instructions more fall into the real of text pre-processing than compiling.
Nit-pick Power is many to one, not one-to-one (there is no "shift" machine code, but there is a rotate-and-mask machine code that shift operators are translated into).
Re:ASM
by CountHackulus on Saturday April 20, 2013 @12:27AM
(#5580202)
I've written part of a compiler for Power and never used the shift machine code, maybe it's just the setup I was using, but I use rlwinm[.] all the time.
Its not quite a one-to-one mapping though.
For example, there are assembly instructions which map to more than one opcode, depending on how it is used and opcodes can have various flags that change its encoding (prefixes and such), like the MOV x86 instruction. Beyond that, it is also rare to find assembly code which does not make use of macros or assembler-implemented pseudo instructions.
http://stackoverflow.com/questions/2546715/how-to-analysis-h...