0

I'm graduate student in Korea and interested in the optimization eliminating mov instruction during compile time.

Especially, in ARM ISA, I have observed that the mov instruction is used to handle stack operation (push or pop) and PC address handling for procedure call.

During compile time, mov instructions can be eliminated by using high optimization level, but the mov instruction in ARM architecture is used to handle procedure call. Thus, I think that they cannot be eliminated unlike general mov instruction for inter-register data copy.

Can these mov instructions for procedure call be eliminated during compile time? It there anybody who knows these concepts or sources?

I can't find such information...


Modified at 2017. 10. 24.

When I build the source code with gcc compiler, I could find that there are still mov instructions that handle stack pointer and frame pointer.

To cut a long story short, I want to know specific case that mov instructions are never eliminated by compiler optimization or somethings. I suggest there must be that case.

  • If your compiler conforms to the ABI, no. If your compiler doesn't conform to the ABI and can see the entire program, then potentially yes. – EOF Oct 11 '17 at 15:36
  • push and pop are psuedo instructions for stm/ldm. – old_timer Oct 11 '17 at 17:38
  • which arm instruction set are you talking about? – old_timer Oct 11 '17 at 17:39
  • and how do you plan to survive without mov? and what compiler as this is highly compiler specific. just get gcc and look at or modify the sources, this has nothing to do with the instruction set it has to do with the compiler. – old_timer Oct 11 '17 at 17:39
  • It must be problem specific. Good assembly programmers don't use mov very often, but sometimes it's either impossible or way too inefficient otherwise. – Jake 'Alquimista' LEE Oct 15 '17 at 07:02
  • A cheap trick would be: add/sub y, x, #0; instead of mov y, x; But what's the point? – Jake 'Alquimista' LEE Oct 15 '17 at 07:04
  • Neither push/pop nor procedure calls are related to 'mov' in any way. Aren't you mistaking 'mov' for something else? Pleas be more specific. – Jake 'Alquimista' LEE Oct 15 '17 at 07:06
  • LTO (link time optimization) and `static` will eliminate the need for a compiler to generate ABI prologue and epilogue. This means that the SSA labeling can be used across functions and no `mov` will be needed. At some point the ABI (and MOV) maybe desired as the code could be used in some *updated* manner (shared library, etc) where the compiler can not determine register usage by callers. – artless noise Oct 16 '17 at 13:23

0 Answers0