aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Documentation
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-08-23 16:43:08 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-11-01 00:40:57 +0100
commit226b62bc2ee4779447ce788d83aa0b409e384ec8 (patch)
treeace913c378dd4085c34112c9e8602a7b39f75c27 /Documentation
parent594c7389969f79919f1170693c970fb25b8bfe4d (diff)
downloadsparse-dev-226b62bc2ee4779447ce788d83aa0b409e384ec8.tar.gz
eval_insn: give an explicit type to compare's operands
The return type of IR instructions is stored in the field ::type of struct instruction and this struct has no space to hold the type of the operand(s). This is not a problem for most instructions because there is an easy way to get the operands' type. For example, for binops both types must be the same so they are used interchangeably. However, for compare instructions both types can be different and there is no easy way to get the type of the operands. Currently, this is ignored and creates some errors. It also blocks simplifications that need this type information. But compares instructions need only 2 operands, there is thus one 'slot' left. So, use this slot for the operands' type. This solves the current errors, allows new simplifications and has very little impact on existing code. Of course, this type information needs now to be tracked and adjusted whenever the operands change or an instruction is changed into a compare. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/IR.rst1
1 files changed, 1 insertions, 0 deletions
diff --git a/Documentation/IR.rst b/Documentation/IR.rst
index ff5af1c5..6330ee9c 100644
--- a/Documentation/IR.rst
+++ b/Documentation/IR.rst
@@ -134,6 +134,7 @@ They all have the following signature:
* .src1, .src2: operands (types must be compatible)
* .target: result of the operation (0/1 valued integer)
* .type: type of .target, must be an integral type
+ * .itype: type of the input operands
.. op:: OP_SET_EQ
Compare equal.