Add SET_TYPE() and TEST_TYPE() macros.

These macros are used for setting the type of a memory statement,
including SAMPLE, POSITION and REFERENCE.

These types will be used in a future commit for pattern analysis and
storing memory statements.

Note that the TYPE field is before the NEXT field which was previously
first. NEXT has been shifted down by two bits (the width of TYPE).