[RFC PATCH 18/48] dump-ir: use defines

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

 



---
 lib.c       | 5 +++--
 lib.h       | 4 ++++
 linearize.c | 4 ++--
 3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/lib.c b/lib.c
index a0ed29c3e..e1454661b 100644
--- a/lib.c
+++ b/lib.c
@@ -725,11 +725,12 @@ static char **handle_switch_ftabstop(char *arg, char **next)
 static char **handle_switch_fdump(char *arg, char **next)
 {
 	if (!strncmp(arg, "ir", 2)) {
+		fdump_ir = DUMP_IR_LINEARIZE;
 		arg += 2;
 		if (*arg == '\0')
-			fdump_ir = 1;
+			fdump_ir = DUMP_IR_LINEARIZE;
 		else if (!strcmp(arg, "=only"))
-			fdump_ir = 2;
+			fdump_ir |= DUMP_IR_ONLY;
 		else
 			goto err;
 	}
diff --git a/lib.h b/lib.h
index ccac27d0b..d0b699535 100644
--- a/lib.h
+++ b/lib.h
@@ -107,6 +107,10 @@ extern void expression_error(struct expression *, const char *, ...) FORMAT_ATTR
 #define	ERROR_PREV_PHASE	(1 << 1)
 extern int has_error;
 
+#define	DUMP_IR_ONLY		(1 << 0)
+#define	DUMP_IR_LINEARIZE	(1 << 1)
+#define	DUMP_IR_STOP(F,D)	(((F) & DUMP_IR_ONLY) && ((F) < ((D) << 1)))
+
 extern void add_pre_buffer(const char *fmt, ...) FORMAT_ATTR(1);
 
 extern int preprocess_only;
diff --git a/linearize.c b/linearize.c
index 85acfd9c1..d5606b708 100644
--- a/linearize.c
+++ b/linearize.c
@@ -2262,8 +2262,8 @@ static struct entrypoint *linearize_fn(struct symbol *sym, struct symbol *base_t
 		add_one_insn(ep, insn);
 	}
 
-	if (fdump_ir) {
-		if (fdump_ir == 2)
+	if (fdump_ir & DUMP_IR_LINEARIZE) {
+		if (DUMP_IR_STOP(fdump_ir, DUMP_IR_LINEARIZE))
 			return ep;
 		show_entry(ep);
 	}
-- 
2.14.0

--
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