[PATCH 1/6] new helper: def_opcode()

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

 



Getting the opcode corresponding to the instruction defining
a pseudo *if* the psedudo has such an instruction (PSEUDO_REG)
is an common operation in the simplification phase.

Add a helper, def_opcode() to make the code a bit easier to read.

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

diff --git a/simplify.c b/simplify.c
index e3bc33996..6c05eb04d 100644
--- a/simplify.c
+++ b/simplify.c
@@ -370,6 +370,13 @@ static int replace_with_pseudo(struct instruction *insn, pseudo_t pseudo)
 	return REPEAT_CSE;
 }
 
+static inline int def_opcode(pseudo_t p)
+{
+	if (p->type != PSEUDO_REG)
+		return OP_BADOP;
+	return p->def->opcode;
+}
+
 static unsigned int value_size(long long value)
 {
 	value >>= 8;
-- 
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