linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: linux-sparse@vger.kernel.org
Cc: Christopher Li <sparse@chrisli.org>,
	Dibyendu Majumdar <mobile@majumdar.org.uk>,
	Jeff Garzik <jeff@garzik.org>, Pekka Enberg <penberg@kernel.org>,
	Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Subject: [PATCH v4 11/63] add doc about sparse's instructions/IR
Date: Tue, 21 Mar 2017 01:15:15 +0100	[thread overview]
Message-ID: <20170321001607.75169-12-luc.vanoostenryck@gmail.com> (raw)
In-Reply-To: <20170321001607.75169-1-luc.vanoostenryck@gmail.com>

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 Documentation/instructions.txt | 270 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 270 insertions(+)
 create mode 100644 Documentation/instructions.txt

diff --git a/Documentation/instructions.txt b/Documentation/instructions.txt
new file mode 100644
index 000000000..db30e52f7
--- /dev/null
+++ b/Documentation/instructions.txt
@@ -0,0 +1,270 @@
+This brievely describe which field of struct instruction is
+used by which operation.
+
+== Terminator ==
+=== OP_RET ===
+Return from subroutine.
+- .src : returned value (NULL if void)
+- .type: type of .src
+
+=== OP_BR ===
+Unconditional branch
+- .bb_true: destination basic block
+
+=== OP_CBR ===
+Conditional branch
+- .cond: condition
+- .type: type of .cond, must be an integral type
+- .bb_true, .bb_false: destination basic blocks
+
+=== OP_SWITCH ===
+Switch / multi-branch
+- .cond: condition
+- .type: type of .cond, must be an integral type
+- .multijmp_list: pairs of case-value - destination basic block
+
+=== OP_COMPUTEDGOTO ===
+Computed goto / branch to register
+- .target: target address
+- .type: type of .target	FIXME
+- .multijmp_list: list of possible destination basic blocks
+
+== Arithmetic binops ==
+They all follow the same signature:
+- .src1, .src1: operands (types must be compatible with .target)
+- .target: result of the operation
+- .type: type of .target
+
+=== OP_ADD ===
+Addition.
+
+=== OP_SUB ===
+Subtraction.
+
+=== OP_MULU ===
+Multiplication (unsigned ints & floating-points)
+
+=== OP_MULS, ===
+Multiplication (signed ints)
+
+=== OP_DIVU ===
+Division (unsigned ints & floating-points)
+
+=== OP_DIVS, ===
+Division (signed ints)
+
+=== OP_MODU ===
+Modulo (unsigned division remainder, integer only)
+
+=== OP_MODS, ===
+Modulo (signed division remainder, integer only)
+
+=== OP_SHL ===
+Shift left (integer only)
+
+=== OP_LSR ===
+Logical Shift right (integer only)
+
+=== OP_ASR, ===
+Arithmetic Shift right (integer only)
+
+== Logical ==
+They all follow the same signature:
+- .src1, .src2: operands (types must be compatible with .target)
+- .target: result of the operation
+- .type: type of .target, must be an integral type
+
+=== OP_AND ===
+=== OP_OR ===
+=== OP_XOR ===
+
+== Boolean ==
+=== OP_AND_BOOL ===
+=== OP_OR_BOOL ===
+
+== Comparison ==
+- .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
+
+=== OP_SET_EQ ===
+Compare equal.
+
+=== OP_SET_NE ===
+Compare not-equal.
+
+=== OP_SET_LE ===
+Compare less-than-or-equal (signed).
+
+=== OP_SET_GE ===
+Compare greater-than-or-equal (signed).
+
+=== OP_SET_LT ===
+Compare less-than (signed).
+
+=== OP_SET_GT ===
+Compare greater-than (signed).
+
+=== OP_SET_B ===
+Compare less-than (unsigned).
+
+=== OP_SET_A ===
+Compare greater-than (unsigned).
+
+=== OP_SET_BE ===
+Compare less-than-or-equal (unsigned).
+
+=== OP_SET_AE ===
+Compare greater-than-or-equal (unsigned).
+
+== Unary trinary ops ==
+=== OP_NOT ===
+Logical not.
+- .src: operand (type must be compatible with .target)
+- .target: result of the operation
+- .type: type of .target, must be an integral type
+
+=== OP_NEG ===
+Arithmetic negation.
+- .src: operand (type must be compatible with .target)
+- .target: result of the operation
+- .type: type of .target
+
+=== OP_COPY ===
+Copy (only needed after out-of-SSA).
+- .src: operand (type must be compatible with .target)
+- .target: result of the operation
+- .type: type of .target
+
+=== OP_SEL ===
+- .src1: condition, must be of integral type
+- .src2, .src3: operands (types must be compatible with .target)
+- .target: result of the operation
+- .type: type of .target
+
+== Type conversion ==
+They all follow the same signature:
+- .src: source value
+- .orig_type: type of .src
+- .target: result value
+- .type: type of .target
+
+=== OP_CAST ===
+Cast to unsigned integer (and to void pointer).
+
+=== OP_SCAST ===
+Cast to signed integer.
+
+=== OP_FPCAST ===
+Cast to floating-point.
+
+=== OP_PTRCAST ===
+Cast to pointer.
+
+== Memory ==
+=== OP_LOAD ===
+Load.
+- .src: base address to load from
+- .offset: address offset
+- .target: loaded value
+- .type: type of .target
+
+=== OP_STORE ===
+Store.
+- .src: base address to store to
+- .offset: address offset
+- .target: value to be stored
+- .type: type of .target
+
+=== OP_SYMADDR ===
+Symbol's address.
+- .symbol: the symbol
+- .target: symbol's address
+
+=== OP_SETVAL ===
+"Set Value"
+- .val: value's expression
+- .target: the value
+- .type: type of .target
+The expression can be an EXPR_STRING, EXPR_FVALUE or an EXPR_LABEL.
+
+== Other ==
+=== OP_PHI ===
+Phi-node (for SSA form).
+- .phi_list: phi-operands (type must be compatible with .target)
+- .target: "result"
+- .type: type of .target
+
+=== OP_PHISOURCE ===
+Phi-node source.
+Like OP_COPY but exclusively used to create *all* OP_PHI operands.
+
+=== OP_INLINED_CALL ===
+
+=== OP_PUSH ===
+Push argument.
+- .src: argument
+- .type: type of .src
+
+=== OP_CALL ===
+Function call.
+- .func: the function (can be a symbol or a "register")
+- .arguments: list of the associated OP_PUSH instructions
+- .target: function return value (if any)
+- .type: type of .target
+- .fntype: the full function type
+
+=== OP_SLICE ===
+Extract a "slice" from an aggregate.
+- .base: aggregate
+- .from, .len: offet @ size of the slice within the aggregate
+- .target: result
+- .type: type of .target
+
+=== OP_ASM ===
+Inlined assembly code.
+- .string: asm template
+- .asm_rules: asm constraints, rules
+
+== Sparse tagging (line numbers, context, whatever) ==
+=== OP_CONTEXT ===
+Currently only used for lock/unlock tracking.
+- .context_expr: unused
+- .increment: (1 for locking, -1 for unlocking)
+- .check: (ignore the instruction if 0)
+
+=== OP_RANGE ===
+Range checking.
+- .src1: value to be checked
+- .src2, src3: bound of the value (must be constants?)
+- .type: FIXME
+
+== Misc ==
+=== OP_ENTRY ===
+Function entry point (no associated semantic).
+
+=== OP_BADOP ===
+Invalid operation (should never be generated).
+
+=== OP_NOP ===
+No-op (should never be generated).
+
+=== OP_SNOP ===
+Store no-op (removed store operation).
+
+=== OP_LNOP ===
+Load no-op (removed load operation).
+
+=== OP_DEATHNOTE ===
+Annotation telling the pseudo will be death after the next
+instruction (other than some other annotation, that is).
+
+== Unused ==
+=== OP_VANEXT ===
+=== OP_VAARG ===
+=== OP_MALLOC ===
+=== OP_FREE ===
+=== OP_ALLOCA ===
+=== OP_GET_ELEMENT_PTR ===
+=== OP_INVOKE ===
+=== OP_UNWIND ===
-- 
2.12.0


  parent reply	other threads:[~2017-03-21  0:16 UTC|newest]

Thread overview: 77+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-21  0:15 [PATCH v4 00/63] LLVM fixes Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 01/63] only output internal pointer value when verbose is set Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 02/63] allow binop simplification after canonicalization Luc Van Oostenryck
2017-03-24  5:00   ` Christopher Li
2017-03-24  9:43     ` Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 03/63] canonicalize compare instructions Luc Van Oostenryck
2017-03-24  5:12   ` Christopher Li
2017-03-24  8:11     ` Luc Van Oostenryck
2017-03-24 23:47       ` Christopher Li
2017-03-25  0:03         ` Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 04/63] add is_signed_type() Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 05/63] fix usage of inlined calls Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 06/63] inlined calls should not block BB packing Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 07/63] give function's arguments a type via OP_PUSH Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 08/63] give a type to OP_PHISOURCE Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 09/63] give a type to OP_SEL, always Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 10/63] give a type to OP_SWITCH Luc Van Oostenryck
2017-03-21  0:15 ` Luc Van Oostenryck [this message]
2017-03-21  0:15 ` [PATCH v4 12/63] add support for wider type in switch-case Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 13/63] llvm: remove unneeded arg 'module' Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 14/63] llvm: remove unneeded 'generation' Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 15/63] llvm: remove unneeded function::type Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 16/63] llvm: reduce scope of 'bb_nr' Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 17/63] llvm: use pseudo_list_size() instead of open coding it Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 18/63] llvm: give arguments a name Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 19/63] llvm: give a name to call's return values Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 20/63] llvm: avoid useless temp variable Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 21/63] llvm: extract get_sym_value() from pseudo_to_value() Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 22/63] llvm: fix test of floating-point type Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 23/63] llvm: fix translation of PSEUDO_VALs into a ValueRefs Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 24/63] llvm: fix output_op_store() which modify its operand Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 25/63] llvm: fix output_op_[ptr]cast() Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 26/63] llvm: take care of degenerated rvalues Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 27/63] llvm: add test cases for symbol's address Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 28/63] llvm: add test cases for pointers passed as argument Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 29/63] llvm: add test cases for arrays " Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 30/63] llvm: add test cases for degenerated pointers Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 31/63] llvm: add support for OP_NEG Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 32/63] llvm: add support for OP_SETVAL with floats Luc Van Oostenryck
2017-03-24  5:53   ` Christopher Li
2017-03-24  7:48     ` Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 33/63] llvm: add support for OP_SETVAL with labels Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 34/63] llvm: ignore OP_INLINED_CALL Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 35/63] llvm: fix pointer/float mixup in comparisons Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 36/63] llvm: fix type in comparison with an address constant Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 37/63] llvm: give correct type to binops Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 38/63] llvm: adjust OP_RET's type Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 39/63] llvm: variadic functions are not being marked as such Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 40/63] llvm: fix type of switch constants Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 41/63] llvm: make pseudo_name() more flexible Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 42/63] llvm: give a name to all values Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 43/63] llvm: add support for OP_SWITCH with a range Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 44/63] llvm: fix OP_SWITCH has no target Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 45/63] llvm: make value_to_pvalue() more flexible Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 46/63] llvm: make value_to_ivalue() " Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 47/63] llvm: add test case pointer compare with cast Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 48/63] llvm: let pseudo_to_value() directly use the type Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 49/63] llvm: remove unneeded pseudo_to_value() unneeded argument Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 50/63] llvm: introduce get_ioperand() Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 51/63] llvm: fix mutating function pointer Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 52/63] llvm: fix mutated OP_RET Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 53/63] llvm: fix mutated OP_SEL Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 54/63] llvm: fix mutated OP_SWITCH Luc Van Oostenryck
2017-03-21  0:15 ` [PATCH v4 55/63] llvm: fix mutated OP_PHISOURCE Luc Van Oostenryck
2017-03-21  0:16 ` [PATCH v4 56/63] llvm: fix mutated OP_[PTR]CAST Luc Van Oostenryck
2017-03-21  0:16 ` [PATCH v4 57/63] llvm: add support for restricted types Luc Van Oostenryck
2017-03-21  0:16 ` [PATCH v4 58/63] llvm: fix get value from initialized symbol Luc Van Oostenryck
2017-03-21  0:16 ` [PATCH v4 59/63] llvm: fix get value from non-anonymous symbol Luc Van Oostenryck
2017-03-21  0:16 ` [PATCH v4 60/63] llvm: fix type of bitfields Luc Van Oostenryck
2017-03-21  0:16 ` [PATCH v4 61/63] llvm: add support for OP_FPCAST Luc Van Oostenryck
2017-03-21  0:16 ` [PATCH v4 62/63] llvm: add support for cast from floats Luc Van Oostenryck
2017-03-21  0:16 ` [PATCH v4 63/63] llvm: cleanup of output_[ptr]cast() Luc Van Oostenryck
2017-03-21 10:29 ` [PATCH v4 00/63] LLVM fixes Pekka Enberg
2017-03-21 11:24 ` Dibyendu Majumdar
2017-03-21 13:00   ` Luc Van Oostenryck
2017-03-21 13:36     ` Dibyendu Majumdar
2017-03-21 14:55       ` Luc Van Oostenryck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170321001607.75169-12-luc.vanoostenryck@gmail.com \
    --to=luc.vanoostenryck@gmail.com \
    --cc=jeff@garzik.org \
    --cc=linux-sparse@vger.kernel.org \
    --cc=mobile@majumdar.org.uk \
    --cc=penberg@kernel.org \
    --cc=sparse@chrisli.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).