This is the mail archive of the gcc@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: Help with another constraint


On Wed, Dec 12, 2007 at 12:06:04AM -0500, Balaji V. Iyer wrote:
> Hello Everyone,
>     I got past that negdi2 and some errors..now I am trying to compile
> some linux module, and it says I am not able to find this constraint:
> 
> init/main.c: In function 'start_kernel':
> init/main.c:441: error: insn does not satisfy its constraints:
> (insn 112 110 478 12 (set (mem:QI (reg/v/f:SI 16 r16 [orig:72 line.183 ]
> [72]) [0 S1 A8])
>         (const_int 0 [0x0])) 16 {movqi} (nil)
>     (nil))
> init/main.c:441: internal compiler error: in
> reload_cse_simplify_operands, at postreload.c:391
> Please submit a full bug report,
> 
> Here is what I have for movqi:

   The movxx patterns are special and you'll need to hold the compiler's
hands a little. Since your target can't move immediates directly to memory,
you have to ask for a secondary reload to an intermediate register. Use the
target hook TARGET_SECONDARY_RELOAD.

   When you've got the secondary reloads working, you can likely improve
code quality:

1) Use a movqi expander to expand the instructions correctly to begin with.
For example, if operand 0 is in memory and operand 1 is an immediate, use

	operands[1] = force_reg (QImode, operands[1]);

Rename the "movqi" insn to "*movqi".

> (define_insn "movqi"
>   [(set (match_operand:QI 0 "nonimmediate_operand" "=p,q,m,m,p,q,p,q")
>         (match_operand:QI 1 "general_operand"       "m,m,p,q,p,q,I,I"))]
>   ""
    ^^
2) Reject operand combinations that aren't supported, such as operand 0
being in memory and operand 1 being an immediate.

   You can look at other RISC targets (e.g. ARM, PA-RISC, MIPS, SPARC, Alpha
or RS6000) for examples.

>   "*

   New ports should not use the old-style "* ... " C-blocks. Use { ... } as
documented. Then you'll also avoid the \" and \\ sequences.

>   switch(which_alternative)
>    {
>      case 0:
>      case 1:
>        return \"l.lbz   \\t%0,%1\";
>      case 2:
>      case 3:
>        return \"l.sb    \\t%0,%1\";
>      case 4:
>      case 5:
>        return \"l.ori   \\t%0,%1,0\\t # move reg to reg\";
>      case 6:
>      case 7:
>        return \"l.addi  \\t%0,r0,%1\\t # move immediate\";
>      default:
>        return \"invalid alternative\";
>    }

   Presumably you've temporarily coded it this way for debugging purposes.
If not, use the normal way:

   "@
    l.lbz ...
    l.sb ...
    ..."

> To give a quick explanation: 
> p = register numbers between 0-31 (inclusive)
> q = register numbers between 32-63 (inclusive)

   You use them in pairs a lot. Define a register class which consists of
registers 0-64 and use that in your constraints.
 
-- 
Rask Ingemann Lambertsen
Danish law requires addresses in e-mail to be logged and stored for a year


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