[PATCH 2/2] add remove_use()

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

 



Add an helper to remove the usage of a pseudo like kill_use() do
but without trying to kill (recursively!) the defining instruction
if the usage drop to zero.

This function is meant to be used when it is not yet safe to
kill instructions. If the usage drop to zero, nothing special is
done, the instruction becomes dead and will be eliminated later.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 flow.h     | 1 +
 simplify.c | 8 ++++++++
 2 files changed, 9 insertions(+)

diff --git a/flow.h b/flow.h
index fe3581b5f..14cc144cc 100644
--- a/flow.h
+++ b/flow.h
@@ -23,6 +23,7 @@ extern int simplify_instruction(struct instruction *);
 
 extern void kill_bb(struct basic_block *);
 extern void kill_use(pseudo_t *);
+extern void remove_use(pseudo_t *);
 extern void kill_unreachable_bbs(struct entrypoint *ep);
 
 extern int kill_insn(struct instruction *, int force);
diff --git a/simplify.c b/simplify.c
index 247c591d7..5025bab97 100644
--- a/simplify.c
+++ b/simplify.c
@@ -209,6 +209,14 @@ void kill_use(pseudo_t *usep)
 	}
 }
 
+// Like kill_use() but do not (recursively) kill dead instructions
+void remove_use(pseudo_t *usep)
+{
+	pseudo_t p = *usep;
+	*usep = VOID;
+	__remove_usage(p, usep, 0);
+}
+
 static void kill_use_list(struct pseudo_list *list)
 {
 	pseudo_t p;
-- 
2.16.2

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