aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2021-02-20 06:26:59 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2021-02-21 14:05:12 +0100
commit8af0e8a2ebcf53dde914c9e84f09bc0c46d73d81 (patch)
tree3f9aa7f2297145106e25136894305a2b8b04b618
parent2494587e823700458923052b17b0b981be92d776 (diff)
downloadsparse-8af0e8a2ebcf53dde914c9e84f09bc0c46d73d81.tar.gz
reorg dominates()
To prepare the handling of OP_ASM instructions, reorganize the opcode tests to use a switch. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--flow.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/flow.c b/flow.c
index bda277aa..5751ce75 100644
--- a/flow.c
+++ b/flow.c
@@ -490,12 +490,15 @@ static inline int distinct_symbols(pseudo_t a, pseudo_t b)
*/
int dominates(pseudo_t pseudo, struct instruction *insn, struct instruction *dom, int local)
{
- int opcode = dom->opcode;
-
- if (opcode == OP_CALL || opcode == OP_ENTRY)
+ switch (dom->opcode) {
+ case OP_CALL: case OP_ENTRY:
return local ? 0 : -1;
- if (opcode != OP_LOAD && opcode != OP_STORE)
+ case OP_LOAD: case OP_STORE:
+ break;
+ default:
return 0;
+ }
+
if (dom->src != pseudo) {
if (local)
return 0;