Re: [PATCH 03/15] Add type information to struct instruction.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I think this patch can have more discussion.

If possible, I would rather no increase the instruction struct size.
It is a very common structure, which responsible for a large part
of the byte code memory usage. There is only one person
(David) can benefit from it so far.

I think what David need is just distinction of int vs pointer.
We can do that by save an array of the known basic types.
Including the abstract pointer type. Then we just use an
index to the array rather than use the raw size directly.

That have the extra benefit of, different architecture can share
the same byte code.

Chris

On Sun, Dec 14, 2008 at 4:26 PM, Alexey Zaytsev
<alexey.zaytsev@xxxxxxxxx> wrote:
> From: David Given <dg@xxxxxxxxxxx>
>
> Currently there is no generic way to derive phy
> type information from the instruction flow.
> ---
>  linearize.c |    4 +++-
>  linearize.h |    1 +
>  2 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/linearize.c b/linearize.c
> index fce1ae8..526a710 100644
> --- a/linearize.c
> +++ b/linearize.c
> @@ -55,7 +55,9 @@ static inline int type_size(struct symbol *type)
>
>  static struct instruction *alloc_typed_instruction(int opcode, struct symbol *type)
>  {
> -       return alloc_instruction(opcode, type_size(type));
> +       struct instruction *insn = alloc_instruction(opcode, type_size(type));
> +       insn->type = type;
> +       return insn;
>  }
>
>  static struct entrypoint *alloc_entrypoint(void)
> diff --git a/linearize.h b/linearize.h
> index 32b1c1a..0c5e4ef 100644
> --- a/linearize.h
> +++ b/linearize.h
> @@ -71,6 +71,7 @@ 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 */
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux