This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH]: PR inline-asm/28686 missing check for asm_clobbered at -O0


On 06 Feb 2007 08:25:18 -0800, Ian Lance Taylor <iant@google.com> wrote:
"Seongbae Park" <seongbae.park@gmail.com> writes:

> +/* Compute ELIMINABLE_REGSET and NO_GLOBAL_ALLOC_REGS,
> +   and while doing so, update REGS_EVER_LIVE as well.
> +   This function takes ASM_CLOBBERED array as an input,
> +   and writes to only those three parameters passed.
> +
> +   The formal parameter LIVE_REGS (the actual parameter is expected
> +   to be REGS_EVER_LIVE) is a set of hard registers
> +   that are actually used within the function.
> +   This function only records hard registers that are clobbered
> +   by asm statements in LIVE_REGS.
> +
> +   The formal parameter ELIM_SET (the actual parameter is expected
> +   to be ELIMINABLE_REGSET) is a set of hard registers
> +   whose reference can be eliminated usually
> +   by replacing it with some other expression.
> +
> +   The formal parameter NO_GLOBAL_SET (the actual parameter is expected
> +   to be NO_GLOBAL_ALLOC_REGS) is a set of hard registers
> +   that are not safe to use across blocks.  */

I think this comment could be clearer.  It should first say what the
function does.  Then it can say how the function is normally called.
For example, something like this, assuming this is accurate:

    Look through the list of eliminable registers.  Add registers
    clobbered by asm statements to LIVE_REGS.  Set ELIM_SET to the set of
    registers which may be eliminated.  Set NO_GLOBAL_SET to the set of
    registers which may not be used across blocks.

ASM_CLOBBERED is the set of registers clobbered by some asm statement.

    This will normally be called with LIVE_REGS as the global variable
    regs_ever_live, ELIM_SET as the file static variable
    eliminable_regset, and NO_GLOBAL_SET as the file static variable
    NO_GLOBAL_ALLOC_REGS.


> +static void > +compute_regsets (char asm_clobbered[FIRST_PSEUDO_REGISTER], > + char live_regs[FIRST_PSEUDO_REGISTER], > + HARD_REG_SET elim_set, > + HARD_REG_SET no_global_set)

You need to pass HARD_REG_SET*, not HARD_REG_SET.  On a target with 32
or fewer hard registers, HARD_REG_SET is not an array.

OK with those changes.

Thanks.

Ian

Thanks for the comment. Updated as suggested, retested on i686-linux, and commited as revision 121663. -- #pragma ident "Seongbae Park, compiler, http://seongbae.blogspot.com";


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]