aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Documentation
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2017-08-15 11:24:01 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-06-23 07:46:40 +0200
commit01951278a60490735677920c86f139d627b22dbf (patch)
tree44e9168eacaf2053a4b96bc52a4fb38b288e07a2 /Documentation
parentbf21036518acf0c3069c9c9e12b13fd09c8cdceb (diff)
downloadsparse-dev-01951278a60490735677920c86f139d627b22dbf.tar.gz
cast: specialize integer casts
Casts to integer used to be done with only 2 instructions: OP_CAST & OP_SCAST. Those are not very convenient as they don't reflect the real operations that need to be done. This patch specialize these instructions in: - OP_TRUNC, for casts to a smaller type - OP_ZEXT, for casts that need a zero extension - OP_SEXT, for casts that need a sign extension - Integer-to-integer casts of the same size are considered as a NOPs and are, in fact, never emitted. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/IR.rst11
1 files changed, 7 insertions, 4 deletions
diff --git a/Documentation/IR.rst b/Documentation/IR.rst
index 1cce2de1..ff0ccdf2 100644
--- a/Documentation/IR.rst
+++ b/Documentation/IR.rst
@@ -267,11 +267,14 @@ They all have the following signature:
Currently, a cast to a void pointer is treated like a cast to
an unsigned integer of the same size.
-.. op:: OP_CAST
- Cast to unsigned integer.
+.. op:: OP_TRUNC
+ Cast from integer to an integer of a smaller size.
-.. op:: OP_SCAST
- Cast to signed integer.
+.. op:: OP_SEXT
+ Cast from integer to an integer of a bigger size with sign extension.
+
+.. op:: OP_ZEXT
+ Cast from integer to an integer of a bigger size with zero extension.
.. op:: OP_UTPTR
Cast from pointer-sized unsigned integer to pointer type.