Expressions
3-26
3.9.3
Well-Defined Expressions
Some assembler directives require well-defined expressions as operands.
Well-defined expressions contain only symbols or assembly-time constants
that are defined before they are encountered in the expression. The evaluation
of a well-defined expression must be absolute.
Example 3–3. Well-Defined Expressions
(a) Valid well-defined expressions
.data
label1
.word
0
.word
1
.word
2
label2
.word
3
X
.set
50h
goodsym1 .set
100h + X
: Because value of X is defined before
; referenced, this is a valid well-defined
; expression
goodsym2 .set
$
; All references to previously defined local
goodsym3 .set
label1
: labels, including the current SPC ($), are
; considered to be well-defined.
goodsym4 .set
label2 – label1
; Although label1 and label2 are not
; absolute symbols, because they are local
; labels defined in the same section, their
; difference can be computed by the assembler.
; The difference is absolute, so the
; expression is well-defined.
(b) Invalid well-defined expressions
.global Y
badsym1
.set
Y
; Because Y is external and is not defined in
badsym2
.set
50h + Y
; the current file, its value is unknown to
; the assembler. Therefore, it cannot be used
; where a well-defined expression is needed.
badsym3
.set
50h + Z
; Although Z is defined in the current file,
Z
.set
60h
; its definition appears after the expression
; in which it is used. All symbols and
; constants that appear in well-defined
; expressions must be defined before they are
; referenced.
Summary of Contents for TMS320C54x
Page 38: ......
Page 39: ......
Page 40: ......
Page 41: ......
Page 42: ......
Page 43: ......
Page 44: ......
Page 45: ......
Page 46: ......
Page 47: ......
Page 48: ......
Page 49: ......
Page 50: ......
Page 51: ......
Page 52: ......
Page 53: ......
Page 54: ......
Page 55: ......
Page 56: ......
Page 57: ......
Page 58: ......
Page 59: ......
Page 60: ......
Page 61: ......
Page 62: ......
Page 276: ......
Page 277: ......
Page 278: ......
Page 279: ......
Page 280: ......
Page 281: ......
Page 282: ......
Page 283: ......
Page 284: ......
Page 285: ......
Page 286: ......
Page 287: ......
Page 288: ......
Page 289: ......
Page 290: ......
Page 291: ......
Page 292: ......
Page 293: ......
Page 294: ......
Page 295: ......
Page 296: ......
Page 297: ......
Page 298: ......
Page 299: ......
Page 300: ......
Page 301: ......
Page 302: ......