Commit cc47a84d authored by Andreas Fried's avatar Andreas Fried
Browse files

Add flag outputs to destination address mode instructions.

parent 1338b785
......@@ -34,6 +34,12 @@ enum {
pn_ia32_mem = 2
};
/** proj numbers for nodes with destination address mode */
enum {
pn_ia32_destAM_flags = 1,
pn_ia32_destAM_M = 2
};
extern struct obstack opcodes_obst;
/**
......
# This is the specification for the ia32 assembler Firm-operations
# Note on Proj numbers:
# If possible, Nodes should follow these rules for assigning proj numbers:
# "Normal" instructions:
# 0 => result
# 1 => flags
# 2 => memory
# instructions with destination address mode:
# 0 => unused
# 1 => flags
# 2 => memory
$arch = "ia32";
$mode_xmm = "ia32_mode_float64";
......@@ -159,8 +170,8 @@ my %binop_flags_constructors = (
);
my %binop_mem_constructors = (
"" => { reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] } },
"8bit" => { reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "none" ] } },
"" => { reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none", "flags", "none" ] } },
"8bit" => { reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "none", "flags", "none" ] } },
);
%nodes = (
......@@ -219,9 +230,10 @@ AddMem => {
state => "exc_pinned",
constructors => \%binop_mem_constructors,
ins => [ "base", "index", "mem", "val" ],
outs => [ "unused", "flags", "M" ],
emit => "add%M %#S3, %AM",
latency => 1,
mode => "mode_M",
mode => "mode_T",
modified_flags => $status_flags
},
......@@ -326,9 +338,10 @@ AndMem => {
state => "exc_pinned",
constructors => \%binop_mem_constructors,
ins => [ "base", "index", "mem", "val" ],
outs => [ "unused", "flags", "M" ],
emit => "and%M %#S3, %AM",
latency => 1,
mode => "mode_M",
mode => "mode_T",
modified_flags => $status_flags
},
......@@ -351,9 +364,10 @@ OrMem => {
state => "exc_pinned",
constructors => \%binop_mem_constructors,
ins => [ "base", "index", "mem", "val" ],
outs => [ "unused", "flags", "M" ],
emit => "or%M %#S3, %AM",
latency => 1,
mode => "mode_M",
mode => "mode_T",
modified_flags => $status_flags
},
......@@ -387,9 +401,10 @@ XorMem => {
state => "exc_pinned",
constructors => \%binop_mem_constructors,
ins => [ "base", "index", "mem", "val" ],
outs => [ "unused", "flags", "M" ],
emit => "xor%M %#S3, %AM",
latency => 1,
mode => "mode_M",
mode => "mode_T",
modified_flags => $status_flags
},
......@@ -412,9 +427,10 @@ SubMem => {
state => "exc_pinned",
constructors => \%binop_mem_constructors,
ins => [ "base", "index", "mem", "subtrahend" ],
outs => [ "unused", "flags", "M" ],
emit => "sub%M %#S3, %AM",
latency => 1,
mode => "mode_M",
mode => "mode_T",
modified_flags => $status_flags
},
......@@ -496,11 +512,12 @@ Shl => {
ShlMem => {
irn_flags => [ "rematerializable" ],
state => "exc_pinned",
reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none", "flags", "none" ] },
ins => [ "base", "index", "mem", "count" ],
outs => [ "unused", "flags", "M" ],
emit => "shl%M %<,S3 %AM",
latency => 1,
mode => "mode_M",
mode => "mode_T",
modified_flags => $status_flags
},
......@@ -531,10 +548,11 @@ Shr => {
ShrMem => {
irn_flags => [ "rematerializable" ],
state => "exc_pinned",
reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none", "flags", "none" ] },
ins => [ "base", "index", "mem", "count" ],
outs => [ "unused", "flags", "M" ],
emit => "shr%M %<,S3 %AM",
mode => "mode_M",
mode => "mode_T",
latency => 1,
modified_flags => $status_flags
},
......@@ -566,11 +584,12 @@ Sar => {
SarMem => {
irn_flags => [ "rematerializable" ],
state => "exc_pinned",
reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none", "flags", "none" ] },
ins => [ "base", "index", "mem", "count" ],
outs => [ "unused", "flags", "M" ],
emit => "sar%M %<,S3 %AM",
latency => 1,
mode => "mode_M",
mode => "mode_T",
modified_flags => $status_flags
},
......@@ -589,11 +608,12 @@ Ror => {
RorMem => {
irn_flags => [ "rematerializable" ],
state => "exc_pinned",
reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none", "flags", "none" ] },
ins => [ "base", "index", "mem", "count" ],
outs => [ "unused", "flags", "M" ],
emit => "ror%M %<,S3 %AM",
latency => 1,
mode => "mode_M",
mode => "mode_T",
modified_flags => $status_flags
},
......@@ -612,11 +632,12 @@ Rol => {
RolMem => {
irn_flags => [ "rematerializable" ],
state => "exc_pinned",
reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none", "flags", "none" ] },
ins => [ "base", "index", "mem", "count" ],
outs => [ "unused", "flags", "M" ],
emit => "rol%M %<,S3 %AM",
latency => 1,
mode => "mode_M",
mode => "mode_T",
modified_flags => $status_flags
},
......@@ -635,11 +656,12 @@ Neg => {
NegMem => {
irn_flags => [ "rematerializable" ],
state => "exc_pinned",
reg_req => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
reg_req => { in => [ "gp", "gp", "none" ], out => [ "none", "flags", "none" ] },
ins => [ "base", "index", "mem" ],
outs => [ "unused", "flags", "M" ],
emit => "neg%M %AM",
latency => 1,
mode => "mode_M",
mode => "mode_T",
modified_flags => $status_flags
},
......@@ -673,10 +695,11 @@ Inc => {
IncMem => {
irn_flags => [ "rematerializable" ],
state => "exc_pinned",
reg_req => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
reg_req => { in => [ "gp", "gp", "none" ], out => [ "none", "flags", "none" ] },
ins => [ "base", "index", "mem" ],
outs => [ "unused", "flags", "M" ],
emit => "inc%M %AM",
mode => "mode_M",
mode => "mode_T",
latency => 1,
modified_flags => $status_flags_wo_cf
},
......@@ -696,10 +719,11 @@ Dec => {
DecMem => {
irn_flags => [ "rematerializable" ],
state => "exc_pinned",
reg_req => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
reg_req => { in => [ "gp", "gp", "none" ], out => [ "none", "flags", "none" ] },
ins => [ "base", "index", "mem" ],
outs => [ "unused", "flags", "M" ],
emit => "dec%M %AM",
mode => "mode_M",
mode => "mode_T",
latency => 1,
modified_flags => $status_flags_wo_cf
},
......
......@@ -4483,6 +4483,10 @@ static ir_node *gen_Proj_Store(ir_node *node)
dbg_info *dbgi = get_irn_dbg_info(node);
long pn = get_Proj_proj(node);
if (is_Proj(new_pred)) {
new_pred = get_Proj_pred(new_pred);
}
if (is_ia32_Store(new_pred)) {
switch ((pn_Store)pn) {
case pn_Store_M:
......@@ -4537,7 +4541,11 @@ static ir_node *gen_Proj_Store(ir_node *node)
} else if (get_ia32_op_type(new_pred) == ia32_AddrModeD) {
/* destination address mode */
if (pn == pn_Store_M) {
return new_pred;
if (get_irn_mode(new_pred) == mode_T) {
return new_rd_Proj(dbgi, new_pred, mode_M, pn_ia32_destAM_M);
} else {
return new_pred;
}
}
panic("exception control flow for destination AM not implemented yet");
}
......
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