This is the mail archive of the gcc@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]

casesi pattern failure


Hello everybody,

I'm trying to use casesi on my architecture. It is supposed to be compilated 
into:

jumplist indexvar label1, label2, ... labeli

For now I'm just trying to get the casesi pattern to be generated and to 
match. I've written a first basic pattern inspired by the ARM port:

(define_insn "casesi"
 [(parallel [(set (pc)
	       (if_then_else
		(leu (match_operand:SI 0 "general_operand" "")
		     (match_operand:SI 2 "const_int_operand" ""))
		(mem:SI (plus:SI (match_dup 0)
				 (label_ref (match_operand 3 "" ""))))
		(label_ref (match_operand 4 "" ""))))
	      (use (label_ref (match_dup 3)))
              (use (match_operand:SI 1 "const_int_operand" ""))])]
              ""
              {
                printf("Matched CaseSI!\n");
                return "Jumplist";
              })

This pattern is not enough to work, but as I said I just wanted to test. When 
I compile a file that make use of casesi, I can see that the correct insn is 
generated. However, after that I get:

../../testsuite/functions.c:77: internal compiler error: in insn_extract, at 
insn-extract.c:123

The gdb backtrace:
#0  fancy_abort (file=0x83a12a5 "insn-extract.c", line=123,
    function=0x83a1298 "insn_extract") at ../../gcc/gcc/diagnostic.c:666
#1  0x08334d2d in insn_extract (insn=0x402ca100) at insn-extract.c:123
#2  0x0825529d in extract_insn (insn=0x402ca100) at ../../gcc/gcc/recog.c:2070
#3  0x0825808a in scan_one_insn (insn=0x402ca100, pass=0)
    at ../../gcc/gcc/regclass.c:1031
#4  0x08258807 in regclass (f=0x40267820, nregs=65, dump=0x0)
    at ../../gcc/gcc/regclass.c:1236
#5  0x082a9824 in rest_of_handle_old_regalloc (decl=0x402bff30,
    insns=0x40267820, rebuild_notes=0xbfffebb0) at ../../gcc/gcc/toplev.c:2130
#6  0x082abc06 in rest_of_compilation (decl=0x402bff30)
    at ../../gcc/gcc/toplev.c:3301
#7  0x082f7a2d in tree_rest_of_compilation (fndecl=0x402bff30)
    at ../../gcc/gcc/tree-optimize.c:173
#8  0x0807b1d5 in c_expand_body_1 (fndecl=0x402bff30, nested_p=0)
    at ../../gcc/gcc/c-decl.c:6179
#9  0x0807b3e2 in c_expand_body (fndecl=0x402bff30)
    at ../../gcc/gcc/c-decl.c:6212
#10 0x082f9ca7 in cgraph_expand_function (node=0x402c74a4)
    at ../../gcc/gcc/cgraphunit.c:357
#11 0x082f91fd in cgraph_finalize_function (decl=0x402bff30, body=0x402c171c)
    at ../../gcc/gcc/cgraphunit.c:118
#12 0x0807b091 in finish_function () at ../../gcc/gcc/c-decl.c:6139
#13 0x0804eed0 in yyparse () at c-parse.y:385
#14 0x08058d4d in c_parse_file () at c-parse.y:3015
#15 0x080bef37 in c_common_parse_file (set_yydebug=0)
    at ../../gcc/gcc/c-opts.c:1210
#16 0x082a903b in compile_file () at ../../gcc/gcc/toplev.c:1737
#17 0x082ad5cb in do_compile () at ../../gcc/gcc/toplev.c:4412
#18 0x082ad660 in toplev_main (argc=7, argv=0xbffff634)
    at ../../gcc/gcc/toplev.c:4452
#19 0x080e2a86 in main (argc=7, argv=0xbffff634) at ../../gcc/gcc/main.c:35
#20 0x4011aa17 in __libc_start_main () from /lib/i686/libc.so.6


Looking at insn-extract.c, I can't find a case branch for the casesi pattern. 
I don't know much about what insn-extract is supposed to do, but it looks 
like that either it needs an entry about casesi, which has not been generated 
by genextract, either it has been called without a good reason.

I really don't know what could go wrong. Every other patterns I write are 
working perfectly. Can someone show me what I did wrong?

Thanks in advance,
Alex.


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