[PATCH 1/3] add helper replace_with_value()

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

 



During simplification, it's relatively common to have to replace
an instruction with pseudo corresponding to a known value.
The pseudo can be created with value_pseudo() and the replacement
can be made via replace_with_pseudo() but the combination
of the two is a bit long.

So, create an helper doing both sat once: replace_with_value().

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 simplify.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/simplify.c b/simplify.c
index f6b79685f439..0c75b3fadcab 100644
--- a/simplify.c
+++ b/simplify.c
@@ -465,6 +465,11 @@ static int replace_with_pseudo(struct instruction *insn, pseudo_t pseudo)
 	return REPEAT_CSE;
 }
 
+static inline int replace_with_value(struct instruction *insn, long long val)
+{
+	return replace_with_pseudo(insn, value_pseudo(val));
+}
+
 static inline int def_opcode(pseudo_t p)
 {
 	if (p->type != PSEUDO_REG)
-- 
2.28.0




[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