Trouble with MDs: "const" RTL object stops recognition of RTL expressions by insn patterns
Sergio Ruocco
sergio.ruocco.ml@gmail.com
Tue May 25 17:09:00 GMT 2010
Dear All,
I am porting GCC to a 16 bit micro (with 16 bit bytes, thus
BITS_PER_UNIT=16, 16 bit ints become "QI"s etc).
The port compiles is nearly done and simple C programs, but now chokes
on a trivial line such as:
yyy(&array[4], &e, &p);
with this error:
xxx.c: In function âyyyâ:
xxx.c:193: error: unrecognizable insn:
(insn 183 181 184 4 (set (reg/f:QI 37 [ D.1127 ])
(const:QI (plus:QI (symbol_ref:QI ("digest") [flags 0x2]
<var_decl 0x7fbe4d21f270 digest>)
(const_int 8 [0x8])))) -1 (nil)
(nil))
sha1_16_struct2.c:193: internal compiler error: in extract_insn, at
recog.c:2020
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
I determined that the problem is triggered by the computation of array
address+const (4/8 in this case).
My MD contains:
(define_insn "addqi3"
[(set (match_operand:QI 0 "register_operand" "=r,r")
(plus:QI (match_operand:QI 1 "register_operand" "0,0")
(match_operand:QI 2 "nonmemory_operand" "r,K"))
)]
""
"@
ADD \\t%2 %0
ADDI \\t%h2 %0"
)
which correctly compiles ordinary arithmetic expressions: x = 5+y etc.
However, when a symbol is involved, the addqi3 isns pattern cannot
recognise the RTL: Symbol+Int.
Is maybe the surrounding (const:QI...) the reason why addqi3 does not
match?! Grepping the GCC source I found in rtl.h that CONST is defined as:
....
/* This is used to encapsulate an expression whose value is constant
(such as the sum of a SYMBOL_REF and a CONST_INT) so that it will be
recognized as a constant operand rather than by arithmetic instructions. */
DEF_RTL_EXPR(CONST, "const", "e", RTX_CONST_OBJ)
So, what is my port missing to make it compile such RTL expressions?
I feel that it must be something really trivial which I am overlooking..
Thanks for your help,
Sergio
More information about the Gcc
mailing list