On Wed, Apr 12, 2006 at 07:47:32AM +0200, Frank Riese wrote: > On Monday 10 April 2006 19:48, you wrote: > > Can it at least add (small) immediates to registers? > > Nope, sry. The only instructions that take other arguments than registers are > the aforementioned LDL/LDH (load low/high), branch instructions (they take a > memory address) and four bit operations which can mask, invert, set or delete > a bit in a register.
This will increase the probability of reload failures when storing through a pointer, because of the need for an extra register to hold the offset in some cases. For example int x, *p; p[15] = x; /* p not used after this */ LDL R[4], 30 LDH R[4], 0 ADD R[3], R[3], R[4] STO R[3], R[2] > > #define GO_IF_LEGITIMATE_ADDRESS(XMODE, X, LABEL) \ > > if (REG_P (X)) \ > > goto LABEL; > > I tried that out today. I wasn't sure about the exact contexts in which this > macro is used. It seems to work fine, though. Various parts of GCC (combine and reload, for example) build memory addresses and will use this macro to verify that they are supported. Predicates such as memory_operand, nonimmediate_operand and general_operand use it to check memory operands for supported addresses. For example, combine might try to generate an insn such as (set (reg:HI 20) (mem:HI (plus:HI (reg:HI 21) (reg:HI 22)))) out of (set (reg:HI 23) (plus:HI (reg:HI 21) (reg:HI 22))) (set (reg:HI 20) (mem:HI (reg:HI 23))) but this will be rejected by GO_IF_LEGITIMATE_ADDRESS() in your case. > $ gcc function1.c > > [...] > function1.c: In function 'main': > function1.c:10: internal compiler error: Segmentation fault > > (gdb) bt > #0 0x0829028f in htab_find_slot (htab=0x5b52202c, element=0xbf805284, > insert=INSERT) at ../../gcc-4.0.2/libiberty/hashtab.c:707 I have no idea. I haven't seen such a failure before. > > 1) Does BP really have to be fixed? You are sufficiently desparate for > > registers than you'll not fix BP unless the hardware itself mandates this. > > I thought it needs to be fixed if I want to set it aside as the frame > pointer. See the macros FRAME_POINTER_REQUIRED and ELIMINABLE_REGS. You want the former to be 0 and the latter to contain an elimination of FRAME_POINTER_REGNUM into STACK_POINTER_REGNUM. Also check CAN_DEBUG_WITHOUT_FP. [not making BP fixed] > Can I do the same thing with SP? I don't know. The difficulty is somewhere between nontrivial and impossible. Don't try this at first. -- Rask Ingemann Lambertsen