[PATCH 3/3] ir: case OP_UNOP ... OP_UNOP_END

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Now that we have OP_UNOP & OP_UNOP_END, we can convert some long
switch cases by the shorter: case OP_UNOP ... OP_UNOP_END.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 ir.c       |  6 +-----
 liveness.c |  9 +--------
 simplify.c | 14 ++------------
 3 files changed, 4 insertions(+), 25 deletions(-)

diff --git a/ir.c b/ir.c
index 5116beaac..1890eb13c 100644
--- a/ir.c
+++ b/ir.c
@@ -96,11 +96,7 @@ static int validate_insn(struct instruction *insn)
 		err += check_user(insn, insn->src2);
 		/* fall through */
 
-	case OP_CAST:
-	case OP_SCAST:
-	case OP_FPCAST:
-	case OP_PTRCAST:
-	case OP_NOT: case OP_NEG: case OP_FNEG:
+	case OP_UNOP ... OP_UNOP_END:
 	case OP_SLICE:
 	case OP_SYMADDR:
 	case OP_PHISOURCE:
diff --git a/liveness.c b/liveness.c
index e0e583292..4c3339f10 100644
--- a/liveness.c
+++ b/liveness.c
@@ -71,7 +71,7 @@ static void track_instruction_usage(struct basic_block *bb, struct instruction *
 		break;
 
 	/* Uni */
-	case OP_NOT: case OP_NEG: case OP_FNEG:
+	case OP_UNOP ... OP_UNOP_END:
 		USES(src1); DEFINES(target);
 		break;
 
@@ -111,13 +111,6 @@ static void track_instruction_usage(struct basic_block *bb, struct instruction *
 		USES(phi_src);
 		break;
 
-	case OP_CAST:
-	case OP_SCAST:
-	case OP_FPCAST:
-	case OP_PTRCAST:
-		USES(src); DEFINES(target);
-		break;
-
 	case OP_CALL:
 		USES(func);
 		if (insn->target != VOID)
diff --git a/simplify.c b/simplify.c
index eabe63cac..48f6f124d 100644
--- a/simplify.c
+++ b/simplify.c
@@ -251,12 +251,8 @@ int kill_insn(struct instruction *insn, int force)
 		kill_use(&insn->src2);
 		/* fall through */
 
-	case OP_CAST:
-	case OP_SCAST:
-	case OP_FPCAST:
-	case OP_PTRCAST:
+	case OP_UNOP ... OP_UNOP_END:
 	case OP_SETVAL:
-	case OP_NOT: case OP_NEG: case OP_FNEG:
 	case OP_SLICE:
 		kill_use(&insn->src1);
 		break;
@@ -348,14 +344,8 @@ static int replace_with_pseudo(struct instruction *insn, pseudo_t pseudo)
 		kill_use(&insn->src3);
 	case OP_BINARY ... OP_BINCMP_END:
 		kill_use(&insn->src2);
-	case OP_NOT:
-	case OP_NEG:
-	case OP_FNEG:
+	case OP_UNOP ... OP_UNOP_END:
 	case OP_SYMADDR:
-	case OP_CAST:
-	case OP_SCAST:
-	case OP_FPCAST:
-	case OP_PTRCAST:
 		kill_use(&insn->src1);
 		break;
 
-- 
2.17.1

--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux