i960 Processor Compiler User's Guide
12-4
12
Here is an example of how these assumptions are used:
#include <string.h>
...
struct {
int s1;
int s2;
int s3;
} *s; /* (1) *s is assumed to be 16 byte aligned
*/
extern char mybuf[23];
/* (2) mybuf is assumed to be 16 byte aligned */
memcpy (mybuf, s, sizeof (*s));
The compiler would generate:
ldt (s), r
stt r, mybuf
in lieu of the call to memcpy; the memory references would be unaligned
should the assumptions mentioned above prove false.
Volatile Objects
The compiler aggressively attempts to remove redundant memory
references (both loads and stores), and it attempts function inlining across
multiple
.c files. If your program expects actual memory references to be
made at certain points in the program, you must make those references
volatile. Volatile objects are guaranteed to be updated at certain sequence
points in the program (e.g., between semicolons,
&&, ||, ?:, and before
calls).