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: fix c/6344


On Mon, Apr 22, 2002 at 03:07:13PM -0400, David Edelsohn wrote:
> 	If you can give me a little more detail about what you are
> recommending, I will be happy to pursue this.

Examine, for instance, how SYMBOL_REF is handled in the Alpha port
with TARGET_EXPLICIT_RELOCS.  There we actually have three cases:

 (1) Local symbol in the small data area,
 (2) Local symbol not in small data area,
 (3) Global symbol.

Case 1 is in reality

	lda	dest, foo($gp)	!gprel

	(set dest (lo_sum pic_offset_table_rtx (symbol_ref "foo")))

Case 2 is in reality

	ldah	tmp, foo($gp)	!gprelhigh
	lda	dest, foo(tmp)	!gprellow

	(set temp (plus pic_offset_table_rtx (high (symbol_ref "foo"))))
	(set dest (lo_sum temp (symbol_ref "foo")))

Case 3 is in reality

	ldq	dest, foo($gp)	!literal

	(set dest (mem (plus pic_offset_table_rtx
			     (unspec [(symbol_ref "foo")]))))

However, before reload cases 1 and 3 are represented as a plain
SYMBOL_REF, and case 2 uses just HIGH rather than the PLUS.

This was initially done to fix gcc.dg/20020103-1.c, but it turns
out to help all of the early passes that want to talk about 
address constants as constants.

Anyway, there are a set of splitters that run after reload that
transform all of the bare SYMBOL_REF and HIGH references into
the post-reload form which properly references the PIC register.
In fact, *all* references to the PIC register are generated in
post-reload splitters/peepholes, since the code that manipulates
the PIC register around calls are exposed here as well.


r~


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