From: "Christopher Li" <sparse@chrisli.org>
To: David Given <dg@cowlark.com>
Cc: linux-sparse@vger.kernel.org
Subject: Re: [PATCH 03/15] Add type information to struct instruction.
Date: Tue, 23 Dec 2008 19:09:44 -0800 [thread overview]
Message-ID: <70318cbf0812231909i812a363s353d26572c8fddd2@mail.gmail.com> (raw)
In-Reply-To: <4950CA43.6090101@cowlark.com>
[-- Attachment #1: Type: text/plain, Size: 1289 bytes --]
On Tue, Dec 23, 2008 at 3:23 AM, David Given <dg@cowlark.com> wrote:
> I'm sure there's a better way of doing it, but I just couldn't find one!
> So if you can think of any way to clean all this up I'd be delighted.
> The underlying issue, BTW, is that OP_LOAD doesn't carry enough
> information in its arguments to determine the type of the instruction.
OK, if it is just for OP_LOAD. Will this attached patch solve your problem?
Instead of adding type to every instruction. It just add that for the OP_LOAD
instruction in insn->orig_type. If that works for you. I am very glad to reclaim
the space back on instruction structure.
> Incidentally, speaking of distinguishing arguments, one of the issues I
> have with Clue is that sparse can't distinguish between parameters of
> the different types but the same size in some situations --- e.g.:
>
> extern void foo(float i);
> ...
> foo(5);
>
> ...will call foo() with an *integer* parameter rather than a float one.
> This is preventing me doing certain optimisations (like being able to
> store ints in ints rather than doubles!). Is this related?
I think sparse should do the proper cast for you when you call
the function call. If it does not, that is a bug and we can fix it.
Please let me know if you can use the patch.
Chris
[-- Attachment #2: load_type --]
[-- Type: application/octet-stream, Size: 1133 bytes --]
Make type information only for OP_LOAD
Index: sparse/linearize.c
===================================================================
--- sparse.orig/linearize.c
+++ sparse/linearize.c
@@ -55,9 +55,7 @@ static inline int type_size(struct symbo
static struct instruction *alloc_typed_instruction(int opcode, struct symbol *type)
{
- struct instruction *insn = alloc_instruction(opcode, type_size(type));
- insn->type = type;
- return insn;
+ return alloc_instruction(opcode, type_size(type));
}
static struct entrypoint *alloc_entrypoint(void)
@@ -915,6 +913,7 @@ static pseudo_t add_load(struct entrypoi
insn->target = new;
insn->offset = ad->offset;
+ insn->orig_type = ad->source_type;
use_pseudo(insn, ad->address, &insn->src);
add_one_insn(ep, insn);
return new;
Index: sparse/linearize.h
===================================================================
--- sparse.orig/linearize.h
+++ sparse/linearize.h
@@ -71,7 +71,6 @@ struct instruction {
size:24;
struct basic_block *bb;
struct position pos;
- struct symbol *type;
union {
pseudo_t target;
pseudo_t cond; /* for branch and switch */
next prev parent reply other threads:[~2008-12-24 3:09 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-15 0:25 [PATCH 00/15] Trivial sparse patches Alexey Zaytsev
2008-12-15 0:25 ` [PATCH 01/15] Evaluate iterator symbols Alexey Zaytsev
2008-12-15 0:26 ` [PATCH 02/15] Unhardcode byte size being 8 bits Alexey Zaytsev
2008-12-15 0:26 ` [PATCH 03/15] Add type information to struct instruction Alexey Zaytsev
2008-12-23 3:21 ` Christopher Li
2008-12-23 4:46 ` Alexey Zaytsev
2008-12-23 5:38 ` Christopher Li
2008-12-23 11:23 ` David Given
2008-12-24 3:09 ` Christopher Li [this message]
2008-12-24 23:01 ` David Given
2008-12-24 23:27 ` Christopher Li
2008-12-24 4:53 ` Alexey Zaytsev
2008-12-15 0:26 ` [PATCH 04/15] Replace the -specs cgcc option with -target Alexey Zaytsev
2008-12-15 0:26 ` [PATCH 05/15] Remove pre_buffer Alexey Zaytsev
2008-12-15 0:26 ` [PATCH 06/15] Sparc64 (Sparc V9, LP64) support Alexey Zaytsev
2008-12-15 0:26 ` [PATCH 07/15] OpenBSD support Alexey Zaytsev
2008-12-15 0:26 ` [PATCH 08/15] Make show_symbol newline-consistent Alexey Zaytsev
2008-12-15 0:27 ` [PATCH 09/15] Handle a terminal -o option properly Alexey Zaytsev
2008-12-15 0:27 ` [PATCH 10/15] Looks more evident this way Alexey Zaytsev
2008-12-15 0:27 ` [PATCH 11/15] Mark handle_switch as static and don't export it from lib.h Alexey Zaytsev
2008-12-15 0:27 ` [PATCH 12/15] Handle missing argument to -D Alexey Zaytsev
2008-12-15 0:27 ` [PATCH 13/15] Gdb macros to get a better look at some sparse data structures Alexey Zaytsev
2008-12-15 0:27 ` [PATCH 14/15] A slightly edited irc discussion with Josh Triplett Alexey Zaytsev
2008-12-15 0:27 ` [PATCH 15/15] Warning should be enough for an unhandled transparent union Alexey Zaytsev
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=70318cbf0812231909i812a363s353d26572c8fddd2@mail.gmail.com \
--to=sparse@chrisli.org \
--cc=dg@cowlark.com \
--cc=linux-sparse@vger.kernel.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).