aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2019-01-18 04:07:42 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2019-09-27 03:29:34 +0200
commit75bcc7dc0fe1f09ae0340ed928f8f4033bd0ba9e (patch)
tree1d70f6d967e389c44688d9684a3a0d3a7d60b883
parent2112249916c16b88591739fbc9f36400e9c009cd (diff)
downloadsparse-75bcc7dc0fe1f09ae0340ed928f8f4033bd0ba9e.tar.gz
asm: fix liveness memory operand
Since memory operands are only some kind of reference, the pseudo in an output operand is not defined by the statement, the reference is only used. Fix the liveness processing accordingly. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--linearize.c1
-rw-r--r--linearize.h1
-rw-r--r--liveness.c5
3 files changed, 6 insertions, 1 deletions
diff --git a/linearize.c b/linearize.c
index 68be3ab1..09b1c7ee 100644
--- a/linearize.c
+++ b/linearize.c
@@ -2101,6 +2101,7 @@ static void add_asm_output(struct entrypoint *ep, struct instruction *insn, stru
linearize_store_gen(ep, pseudo, &ad);
}
rule = __alloc_asm_constraint(0);
+ rule->is_memory = op->is_memory;
rule->ident = op->name;
rule->constraint = op->constraint ? op->constraint->string->data : "";
use_pseudo(insn, pseudo, &rule->pseudo);
diff --git a/linearize.h b/linearize.h
index 89da3db6..76efd0b4 100644
--- a/linearize.h
+++ b/linearize.h
@@ -68,6 +68,7 @@ struct asm_constraint {
pseudo_t pseudo;
const char *constraint;
const struct ident *ident;
+ unsigned int is_memory:1;
};
DECLARE_ALLOCATOR(asm_constraint);
diff --git a/liveness.c b/liveness.c
index 93a7cc30..33cd0483 100644
--- a/liveness.c
+++ b/liveness.c
@@ -39,7 +39,10 @@ static void asm_liveness(struct basic_block *bb, struct instruction *insn,
} END_FOR_EACH_PTR(entry);
FOR_EACH_PTR(insn->asm_rules->outputs, entry) {
- def(bb, entry->pseudo);
+ if (entry->is_memory)
+ use(bb, entry->pseudo);
+ else
+ def(bb, entry->pseudo);
} END_FOR_EACH_PTR(entry);
}