5.4.2 Usage of macro

A macro is described by registering a pattern with a set sequence and by using this pattern. A macro is defined by the user. A macro is defined as follows. The macro body is enclosed by ".macro" and ".endm".

PUSHMAC .macro  REG             ;The following two statements constitute the macro body.
        add     -4, sp
        st.w    REG, 0x0[sp]
.endm

 

If the following description is made after the above definition has been made, the macro is replaced by a code that "stores r19 in the stack".

PUSHMAC r19

 

In other words, the macro is expanded into the following codes.

add     -4, sp
st.w    r19, 0x0[sp]