![Texas Instruments TMS320C2x User Manual Download Page 80](http://html1.mh-extra.com/html/texas-instruments/tms320c2x/tms320c2x_user-manual_1097073080.webp)
Use Caution With asm Statements in Optimized Code
3-11
Optimizing Your Code
3.4.3 Use Caution When Accessing Aliased Variables
Aliasing occurs when you can access a single object in more than one way,
such as when two pointers point to the same object or when a pointer points
to a named object. Aliasing can disrupt optimization, because any indirect ref-
erence could potentially refer to any other object. The optimizer analyzes the
code to determine where aliasing can and cannot occur, then optimizes as
much as possible while still preserving the correctness of the program. The op-
timizer behaves conservatively. If there is a chance that two pointers are point-
ing to the same object, the optimizer assumes that the pointers point to the
same object.
The compiler assumes that if the address of a local variable is passed to a func-
tion, the function might change the local variable by writing through the pointer.
This makes its address unavailable for use elsewhere after returning. For ex-
ample, the called function cannot assign the local variable’s address to a glob-
al variable or return the local variable’s address.
3.4.4 Assume Functions Are Not Interrupts
The
−
oe option assumes that none of the functions in the module are inter-
rupts, can be called by interrupts, or can be otherwise executed in an asynch-
ronous manner. This enables the optimizer to do certain variable allocation op-
timizations. The
−
oe option automatically invokes the optimizer at level 2.
The
−
oe option also presumes that none of the modules are called recursively
(directly or indirectly). Be careful not to combine the use of
−
oe with modules
containing recursive functions.
Summary of Contents for TMS320C2x
Page 8: ...viii...
Page 69: ...2 47 C Compiler Description...
Page 159: ...6 36...
Page 226: ...8 6...