From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Krzysztof Matula" To: Subject: Re: porting GCC Date: Fri, 02 Feb 2001 03:43:00 -0000 Message-id: <009601c08d0d$23fc9160$3704a4c3@adb.pl> References: <200102011109.LAA04253@cam-mail2.cambridge.arm.com> X-SW-Source: 2001-02/msg00059.html ----- Original Message ----- From: "Richard Earnshaw" To: "Krzysztof Matula" Cc: ; Sent: Thursday, February 01, 2001 12:09 Subject: Re: porting GCC > > I am extending one of GCC ports an I have the following problem: > > > > I need to detect all references to to objects in data segment (SYMBOL_REF/v) > > and modify rtx in such way, that the segment base address is added to the > > offset (represented by the symbol itself). Generating such rtx is not a [...] > > I think I have to flag the rtx generated in define_expand in some way and > > setup the predicate used in define_insn to reject unflagged symbol refs... > > > This is similar to the problem faced by many ports when generating PIC > code. The normal approach is to wrap symbol refs in an UNSPEC and then > restrict the recognizer rules to only allow such wrapped symbols. Take a > look at how other machines handle this case for PIC. It worked :) But soon I reached another problem... I am generating several insn-s inside define_expand. The meaning of the code is not exactly the same, as the rtl matched. The problem is that GCC always notes the last insn I generate with REG_EQUAL expression, corresponding to the ORIGINAL code... I don't know how to avoid this... (insn 9 8 11 (set (reg:SI 15) (plus:SI (reg:SI 14) spec:SI[ (symbol_ref/v:SI ("__clz_tab")) ] 3))) -1 (nil) (nil)) (insn 11 9 12 (set (reg:SI 16) (mem:SI (reg:SI 9))) -1 (nil) (nil)) (insn 12 11 14 (set (reg:SI 13) (plus:SI (reg:SI 16) (reg:SI 15))) -1 (nil) (nil)) (insn 14 12 16 (set (reg:SI 13) (reg:SI 13)) -1 (nil) (expr_list:REG_EQUAL (plus:SI (mem:SI (reg:SI 9)) (symbol_ref/v:SI ("__clz_tab"))) (nil))) KM