aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2019-12-19 14:58:49 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-09-05 13:32:09 +0200
commitcedc66458dddf88ccd18971518a3772c8d755de6 (patch)
treece0360f59908a10c19c9eb9cced13f4267a11256
parent101649206777f00be5c23f60f87f01066ad64ece (diff)
downloadsparse-cedc66458dddf88ccd18971518a3772c8d755de6.tar.gz
add helper replace_with_value()
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@gmail.com>
-rw-r--r--simplify.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/simplify.c b/simplify.c
index f6b79685..0c75b3fa 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)