🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #42776

help with GCC internals

#42776
From: Ward Harriman
Date: Fri, 20 Oct 1995 00:00
84 lines
2722 bytes
I am porting GCC to a new machine....
I am using q395 as the base line.

I have

#define MAX_REGS_PER_ADDRESS 1

and a simple program "test.c"

which is:

int main (b)
     int b;
{
  char array[8];
  return array[b];
}

May machine passes args starting in 'd0, and returns things in 'd0'
and it has a stack pointer d15_sp.

I get test.c.lreg to be:

(insn 17 15 18 (set (reg/i:SI 0 d0)
        (zero_extend:SI (mem/s:QI (plus:SI (plus:SI (reg:SI 13 d13_fp)
                        (reg:SI 0 d0))
                    (const_int -8))))) 2 {zero_extendhisi2} (nil)
    (nil))

(insn 18 17 22 (use (reg/i:SI 0 d0)) -1 (insn_list 17 (nil))
    (expr_list:REG_DEAD (reg/i:SI 0 d0)
        (nil)))

It then goes through frame pointer elimination to get:

(insn 17 15 18 (set (reg/i:SI 0 d0)
        (zero_extend:SI (mem/s:QI (plus:SI (reg:SI 15 d15_sp)
                    (reg:SI 0 d0))))) 2 {zero_extendhisi2} (nil)
    (nil))

(insn 18 17 22 (use (reg/i:SI 0 d0)) -1 (insn_list 17 (nil))
    (expr_list:REG_DEAD (reg/i:SI 0 d0)
        (nil)))

which are the insns send to 'find_reloads'.
This all looks great, but then...

find_reloads_address_1 is handed:

(plus:SI (reg:SI 15 d15_sp)
    (reg:SI 0 d0)) END 

which violates the comment in 'reload.c' which says:

/* Note that we take shortcuts assuming that no multi-reg machine mode
   occurs as part of an address.
   Also, this is not fully machine-customizable; it works for machines
   such as vaxes and 68000's and 32000's, but other possible machines
   could have addressing modes that this does not handle right.  */


Then, find_reloads_address_1 notices that it is a PLUS and notices
that there are two registers.  REG_OK_FOR_INDEX always fails for my machine.
As a result, find_reloads_address_1 enters the code sequence:

	    else if (REG_OK_FOR_BASE_P (op1))
	      {
		find_reloads_address_1 (orig_op0, 1, &XEXP (x, 0), opnum, type, 
					ind_levels);
	      }

find_reloads_address_1 is therefore recursively called with 'context' 1 and with:

(reg:SI 15 d15_sp)

and find_reloads_address_1 detects the 'REG' and calls push_reload with class
INDEX_REG_CLASS which is EMPTY!!!!!!!!!!

death and dismemberment.


How did I get HERE!!!!!!

harriman@wellfleet.com
Technical Details
Message-ID: <9510201528.AA23332@BayNetworks.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,cc243db761a58e7,start
X-Google-Attributes: gid11318c,public
From: harriman@baynetworks.COM (Ward Harriman)
Subject: help with GCC internals
Date: 1995/10/20
Message-ID: <9510201528.AA23332@BayNetworks.com>
X-Deja-AN: 117854676
distribution: gnu
sender: daemon@cis.ohio-state.edu
organization: GNUs Not Usenet
newsgroups: gnu.gcc.help