Other Parts Discussed in Thread: AM3359
Tool/software: TI C/C++ Compiler
clpru version: ti-cgt-pru_2.1.4
During development of a pseudo-op macro, one often finds it necessary to use the Substitution Symbol Functions such as $isdefed(arg) used to differentiate between a constant and an assembly label symbol. The code below shows the pseudo-op MOV macro instruction used before and after the label "MY_LABEL".
MOV r31, MY_LABEL
MY_LABEL:
MOV r31, MY_LABEL
Use of the function $isdefed("MY_LABEL") in the MOV pseudo-op before "MY_LABEL" results in $isdefed("MY_LABEL") == 0, while in the MOV pseudo-op after "MY_LABEL" results in $isdefed("MY_LABEL") == 1. This appears to suggest that macro expansion takes place within a single pass parser. A robust assembler might want to parse label symbols in a first pass to obtain a complete symbol table prior to op-code evaluation.
Also I have noticed that $isreg(arg) is non-functional.