<div dir="ltr"><div>I noticed that macro's in assembler code is not expanded before the code is parsed. Is there are technical reason this is not done, or is it merely a historical artefact?</div><div><br></div><div>My question is prompted by the latest assembler code modifications to accommodate avrtiny subarch in the AVR RTL, where the following type of snippets are used in several places to accommodate the differences in registers:<br></div><div>{$ifdef CPUAVR_16_REGS}<br>  in r16,63<br>{$else CPUAVR_16_REGS}<br>  in r0,63<br>{$endif CPUAVR_16_REGS}</div><div><br></div><div>It would seem neater to use a macro (defined by compiler in this case) to indicate which register should be used as temp reg (similar to GCC):</div><div><div>{$ifdef CPUAVR_16_REGS}<br></div><div>  {$define AVR_TEMPREG := r16}<br></div><div>{$else CPUAVR_16_REGS}<br></div><div>  {$define AVR_TEMPREG := r0}<br></div><div>{$endif CPUAVR_16_REGS}</div><div><br></div><div>The assembler code can then more cleanly be written without further conditional checks by using the macro:</div><div>  in AVR_TEMPREG, 63<br></div></div><div><br></div><div>Similarly reference to the zero register (r1 or r17) can benefit from being defined through a macro.<br></div></div>