Commit c441b8f2 authored by Matthias Braun's avatar Matthias Braun
Browse files

shorter version of fehler56

[r15450]
parent 642522bd
typedef union rtunion_def
{
int rtwint;
int rtint;
char *str;
struct rtx_def *rtx;
} rtunion;
typedef struct rtx_def
{
unsigned short code;
int mode : 8;
unsigned int jump : 1;
unsigned int call : 1;
unsigned int unchanging : 1;
unsigned int volatil : 1;
unsigned int in_struct : 1;
unsigned int used : 1;
unsigned int integrated : 1;
rtunion fld[1];
int rtint;
} *rtx;
enum machine_mode {
DImode = 6,
HImode = 2,
QImode = 1,
VOIDmode = 0
};
#define GET_MODE(RTX) ((RTX)->mode)
#define PUT_MODE(RTX, MODE) ((RTX)->mode = (MODE))
struct rtx_def bla;
int b1, b2, b3, b4;
void t(int num_eliminable, int n_reloads) {
register rtx insn = &bla;
......@@ -40,24 +14,15 @@ void t(int num_eliminable, int n_reloads) {
if(num_eliminable)
did_elimination = rand();
#if 0
b1 = did_elimination;
b2 = n_reloads;
b3 = GET_MODE(insn);
#endif
PUT_MODE(insn, (did_elimination ? QImode
: n_reloads ? HImode
: GET_MODE (insn) == DImode ? DImode
: VOIDmode));
insn->mode = did_elimination ? 42 : insn->mode == 6 ? 6 : 0;
}
int main()
{
bla.fld[0].rtint = 8;
bla.mode = DImode;
printf("Before: %d %d\n", bla.mode, bla.fld[0].rtint);
bla.rtint = 8;
bla.mode = 6;
printf("Before: %d %d\n", bla.mode, bla.rtint);
t(0, 1);
printf("After: %d %d\n", bla.mode, bla.fld[0].rtint);
printf("After: %d %d\n", bla.mode, bla.rtint);
return 0;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment