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: Linus Torvalds <torvalds@linux-foundation.org>,
	Christopher Li <sparse@chrisli.org>,
	Dibyendu Majumdar <mobile@majumdar.org.uk>,
	Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Subject: [RFC PATCH 00/14] rework of cast operations
Date: Thu, 17 Aug 2017 06:05:15 +0200	[thread overview]
Message-ID: <20170817040529.7289-1-luc.vanoostenryck@gmail.com> (raw)

The goal of this series is to specialize the few cast
instuctions into more specialized ones so that the
precise nature of the operations is fully specified
by the instruction and thus no additional need to be
done later.

With this series we have:
- TRUNC, for int to smaller size int
- ZEXT,  for int to bigger int with zero extend
- SEXT,  for int to bigger int with sign extend
- PTRTU, for pointer to same sized [unsigned] int
- UTPTR, for pointer from same sized [unsigned] int
- PTRCAST, for pointer to pointer
- FCVT[US], for float to unsigned/signed integer
- [US]CVTF, for float from unsigned/signed integer
- FCVTF, for float to float

Also:
- for these casts, void pointer are treated as unsigned integers
- casts from int to same sized int are trated as NOP and never
  generated.


There are few points I'm not yet decided about, especially thinking
about what would be needed to to [type based] analysis:
- maybe we should no drop the NOP and have a real NOPCAST ?
- this NOPCAST may then be used for floats and pointers too?
- this NOPCAST could then be simplified away when needed
- PTRTU & UTPTR are in the same situation:
  - are they needed?
  - when can we simplified them away?
- it may be good to split FCVTF into: FTRUNC, NOPCAST & TEXT
- is it still good to treat void pointers the same as some integer?

----------------------------------------------------------------
This series is also available in the git repository at:

  git://github.com/lucvoo/sparse.git cast-rework

----------------------------------------------------------------
Luc Van Oostenryck (14):
      add documentation for IR instructions
      cast: add tests for warnings issued by sparse -v
      cast: prepare finer grained cast instructions
      cast: specialize FPCAST into [USF]CVTF
      cast: handle NO-OP casts
      cast: specialize floats to integer conversion
      cast: specialize casts from unsigned to pointers
      cast: make [u]intptr_ctype alias of [s]size_t_ctype
      cast: make pointer casts always size preserving
      cast: temporary simplify handling cast to/from void*
      cast: specialize cast from pointers
      cast: add support for -Wpointer-to-int-cast
      cast: make casts from pointer always size preserving
      cast: specialize integer casts

 Documentation/IR.md                    | 330 +++++++++++++++++++++++++++++++++
 cse.c                                  |  10 +-
 example.c                              |  22 ++-
 lib.c                                  |   4 +
 lib.h                                  |   2 +
 linearize.c                            | 165 ++++++++++++++---
 linearize.h                            |  11 +-
 liveness.c                             |  10 +-
 simplify.c                             |  54 +++---
 sparse-llvm.c                          |  21 ++-
 sparse.c                               |   5 +-
 symbol.h                               |   3 +
 validation/bitfield-size.c             |   5 +-
 validation/builtin-bswap-variable.c    |   4 +-
 validation/cast-kinds-check.c          |  19 ++
 validation/cast-kinds.c                | 181 ++++++++++--------
 validation/cast-weirds.c               |  51 +++++
 validation/compound-assign-type.c      |   3 +-
 validation/linear/bitfield-init-zero.c |   8 +-
 validation/memops-volatile.c           |   4 +-
 validation/optim/bool-simplify.c       |   4 +-
 21 files changed, 757 insertions(+), 159 deletions(-)
 create mode 100644 Documentation/IR.md
 create mode 100644 validation/cast-kinds-check.c
 create mode 100644 validation/cast-weirds.c

             reply	other threads:[~2017-08-17  4:05 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-17  4:05 Luc Van Oostenryck [this message]
2017-08-17  4:05 ` [RFC PATCH 01/14] add documentation for IR instructions Luc Van Oostenryck
2017-08-21 12:18   ` Christopher Li
2017-08-17  4:05 ` [RFC PATCH 02/14] cast: add tests for warnings issued by sparse -v Luc Van Oostenryck
2017-08-17  4:05 ` [RFC PATCH 03/14] cast: prepare finer grained cast instructions Luc Van Oostenryck
2017-08-17  4:05 ` [RFC PATCH 04/14] cast: specialize FPCAST into [USF]CVTF Luc Van Oostenryck
2017-08-17  4:05 ` [RFC PATCH 05/14] cast: handle NO-OP casts Luc Van Oostenryck
2017-08-17  4:05 ` [RFC PATCH 06/14] cast: specialize floats to integer conversion Luc Van Oostenryck
2017-08-17  4:05 ` [RFC PATCH 07/14] cast: specialize casts from unsigned to pointers Luc Van Oostenryck
2017-08-17  4:05 ` [RFC PATCH 08/14] cast: make [u]intptr_ctype alias of [s]size_t_ctype Luc Van Oostenryck
2017-08-17  4:05 ` [RFC PATCH 09/14] cast: make pointer casts always size preserving Luc Van Oostenryck
2017-08-17  4:05 ` [RFC PATCH 10/14] cast: temporary simplify handling cast to/from void* Luc Van Oostenryck
2017-08-17  4:05 ` [RFC PATCH 11/14] cast: specialize cast from pointers Luc Van Oostenryck
2017-08-17  4:05 ` [RFC PATCH 12/14] cast: add support for -Wpointer-to-int-cast Luc Van Oostenryck
2017-08-17  4:05 ` [RFC PATCH 13/14] cast: make casts from pointer always size preserving Luc Van Oostenryck
2017-08-17  4:05 ` [RFC PATCH 14/14] cast: specialize integer casts 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=20170817040529.7289-1-luc.vanoostenryck@gmail.com \
    --to=luc.vanoostenryck@gmail.com \
    --cc=linux-sparse@vger.kernel.org \
    --cc=mobile@majumdar.org.uk \
    --cc=sparse@chrisli.org \
    --cc=torvalds@linux-foundation.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).