On 09/08/2014 10:24 AM, Chen Gang wrote: > On 09/07/2014 11:17 PM, Chen Gang wrote: >>> On 8/13/14 23:10, Michael Eager wrote: >>>> On 07/06/14 03:26, Chen Gang wrote: >>>>> >>>>> * microblaze/mocroblaze.md (call_value_intern): Use 'SI' instead of >>>>> 'VOID' for operand 1, just like 'call_internal1' has done. >>>>> >>>>> The related warning: >>>>> >>>>> ../../gcc/gcc/config/microblaze/microblaze.md:2172: warning: operand 1 >>>>> missing mode? >>>>> >>>>> >>>>> Signed-off-by: Chen Gang <gang.chen.5...@gmail.com> >>>>> --- >>>>> gcc/config/microblaze/microblaze.md | 2 +- >>>>> 1 file changed, 1 insertion(+), 1 deletion(-) >>>>> >>>>> diff --git a/gcc/config/microblaze/microblaze.md >>>>> b/gcc/config/microblaze/microblaze.md >>>>> index 2bd5d72..9580221 100644 >>>>> --- a/gcc/config/microblaze/microblaze.md >>>>> +++ b/gcc/config/microblaze/microblaze.md >>>>> @@ -2171,7 +2171,7 @@ >>>>> >>>>> (define_insn "call_value_intern" >>>>> [(set (match_operand:VOID 0 "register_operand" "=d") >>>>> - (call (mem (match_operand:VOID 1 "call_insn_operand" "ri")) >>>>> + (call (mem (match_operand:SI 1 "call_insn_operand" "ri")) >>>>> (match_operand:SI 2 "" "i"))) >>>>> (clobber (match_operand:SI 3 "register_operand" "=d"))] >>>>> "" >>>> >>>> This patch causes a test suite regression: >>>> >>>> Executing on host: mb-gcc -fno-diagnostics-show-caret >>>> -fdiagnostics-color=never -O0 -w -c -mno-xl-soft-mul -mxl-barrel-shift >>>> -mcpu=v6.00.a -o calls.o testsuite/gcc.c-torture/compile/calls.c >>>> (timeout = 60) >>>> pid is 24832 -24832 >>>> testsuite/gcc.c-torture/compile/calls.c: In function 'f1': >>>> testsuite/gcc.c-torture/compile/calls.c:6:1: error: unrecognizable insn: >>>> (call_insn 5 2 8 2 (parallel [ >>>> (set (reg:SI 3 r3) >>>> (call (mem:SI (const_int 0 [0]) [0 MEM[(void * (*<T29e>) >>>> (void))0B] S4 A32]) >>>> (const_int 24 [0x18]))) >>>> (clobber (reg:SI 15 r15)) >>>> ]) testsuite/gcc.c-torture/compile/calls.c:5 -1 >>>> (nil) >>>> (nil)) >>>> testsuite/gcc.c-torture/compile/calls.c:6:1: internal compiler error: in >>>> extract_insn, at recog.c:2204 >>>> 0x983018 _fatal_insn(char const*, rtx_def const*, char const*, int, char >>>> const*) >>>> /store/Xilinx/repo/fsf/gcc/gcc/rtl-error.c:109 >>>> 0x983041 _fatal_insn_not_found(rtx_def const*, char const*, int, char >>>> const*) >>>> /store/Xilinx/repo/fsf/gcc/gcc/rtl-error.c:117 >>>> 0x9539cd extract_insn(rtx_def*) >>>> /store/Xilinx/repo/fsf/gcc/gcc/recog.c:2204 >>>> 0x7a5b59 instantiate_virtual_regs_in_insn >>>> /store/Xilinx/repo/fsf/gcc/gcc/function.c:1561 >>>> 0x7aaa78 instantiate_virtual_regs >>>> /store/Xilinx/repo/fsf/gcc/gcc/function.c:1932 >>>> >>
At present, I guess the original code is correct, need not additional fix: "When call call_insn_operand() in gencog(), related 'rtx' mode is VOIDmode (which need VOID, not SI)". For the compiler's warning: "operand 1 is VOIDmode", after give some related test, "operand 1 is VOIDmode" is all OK, the related tests are below: - For almost same definitions, they are OK: - int *(*T)(void); - char *(*T)(int); ... - For incorrect assignments, report related correct warning/error: - char a = ((long long *(*)(short)) 0) (1); - ((long long *(*)(short)) 0) (); ... If what I guess is correct, the below issue can be fixed in the same way, please help check. >> typedef void (*T)(void); >> f1 () >> { >> ((T) 0)(); >> } >> > > Oh, sorry, neither original nor the new one (with this patch) can > recognize the code above. > Need use VOID instead of SI, or when real VOIDmode comes, it does not match SImode, so cause issue. The related test code ('void' will cause CALL instead of SET): typedef void (*T)(void); f1 () { ((T) 0)(); } The related error: [root@localhost gcc]# ./cc1 /tmp/calls.c -o /tmp/1.s f1 Analyzing compilation unit Performing interprocedural optimizations <*free_lang_data> <visibility> <early_local_cleanups> <free-inline-summary> <whole-program> <inline>Assembling functions: f1 /tmp/calls.c: In function 'f1': /tmp/calls.c:5:1: error: unrecognizable insn: } ^ (call_insn 5 2 8 2 (parallel [ (call (mem:SI (const_int 0 [0]) [0 MEM[(void (*<T29c>) (void))0B] S4 A32]) (const_int 24 [0x18])) (clobber (reg:SI 15 r15)) ]) /tmp/calls.c:4 -1 (nil) (nil)) /tmp/calls.c:5:1: internal compiler error: in extract_insn, at recog.c:2204 0xb0e71b _fatal_insn(char const*, rtx_def const*, char const*, int, char const*) ../../gcc/gcc/rtl-error.c:109 0xb0e75c _fatal_insn_not_found(rtx_def const*, char const*, int, char const*) ../../gcc/gcc/rtl-error.c:117 0xac552b extract_insn(rtx_def*) ../../gcc/gcc/recog.c:2204 0x8b919e instantiate_virtual_regs_in_insn ../../gcc/gcc/function.c:1614 0x8ba347 instantiate_virtual_regs ../../gcc/gcc/function.c:1934 0x8ba452 execute ../../gcc/gcc/function.c:1983 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions. diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md index b971737..3b4faf4 100644 --- a/gcc/config/microblaze/microblaze.md +++ b/gcc/config/microblaze/microblaze.md @@ -2062,7 +2062,7 @@ (set_attr "length" "4")]) (define_insn "call_internal1" - [(call (mem (match_operand:SI 0 "call_insn_simple_operand" "ri")) + [(call (mem (match_operand:VOID 0 "call_insn_simple_operand" "ri")) (match_operand:SI 1 "" "i")) (clobber (reg:SI R_SR))] "" Thanks. -- Chen Gang Open share and attitude like air water and life which God blessed