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]

GCC does not cope with my code


Hi.

I'm currently developing tools that generate C++ code. The generated
code contains a bunch of macros which are expanded by the preprocessor.
No problem up to here. Now I'd like to compile the resulting file with
g++, but it takes ages until I get the object file. It gets worse, if I
try to optimize the code generation via -O (of course it gets). The
problem is that the (source) file (after the macro expansion) isn't
really large, it's below 700 kB. If the file gets above 700 kB, the
compiler crashes with the famous signal 11 internal compiler error.

I compiled even bigger source files with g++, so it can't be the file
size which confuses the compiler. So I end up with the following
question:

What is wrong with the generated source file that the compiler doesn't
cope with it?

or:

What changes can I apply to the _code_ to reduce compile time/make it
possible to compile the file?

I used gcc version 2.95.2 on a Sparc ULTRA-10 running Solaris 2.7. I
attached an extract of the file I'd like to compile to this posting.

I would appreciate if anybody had an idea about that!

Greetings,

Gunnar
//
// The file mainly looks like the following lines:
//

void ARM7_model::execute_program_block_005()
{
  register long oldPC;
  switch(PC)
    {
    case 0x00001798: oldPC = PC; {  ; { instruction_counter++; {  ; { {  ; { barrel_shifter_operand2_bus = rot_imm(0    , 0    , 0    ); }  ; }     ; {  ; { R[0x3]     = barrel_shifter_operand2_bus; if (& R[0x3]     == &R[15]) R[0x3]     -=4; }  ; }     ; }  ; }     ; }  ; }    ; cycle++; PC += 4; if (PC != (oldPC + 4)) break;
    case 0x0000179c: oldPC = PC; {  ; { instruction_counter++; {  ; { {  ; { offset_bus = 0    ; }  ; }     ; {  ; { address_bus = R[0xd]     + offset_bus; }  ; }     ; {  ; { store_word(address_bus,R[0x3]    ); }  ; }     ; }  ; }     ; }  ; }    ; cycle++; PC += 4; if (PC != (oldPC + 4)) break;
    case 0x000017a0: oldPC = PC; {  ; { instruction_counter++; {  ; { {  ; { barrel_shifter_operand2_bus = rot_imm(0x0000004c    , 0    , 0    ); }  ; }     ; {  ; { R[0x3]     = add_val(R[0xd]    , barrel_shifter_operand2_bus, 0, 0    );	if (& R[0x3]     == &R[15]) R[0x3]     -=4; }  ; }     ; }  ; }     ; }  ; }    ; cycle++; PC += 4; if (PC != (oldPC + 4)) break;
    case 0x000017a4: oldPC = PC; {  ; { instruction_counter++; {  ; { {  ; { barrel_shifter_operand2_bus = rot_imm(0x0000001c    , 0    , 0    ); }  ; }     ; {  ; { R[0x2]     = barrel_shifter_operand2_bus; if (& R[0x2]     == &R[15]) R[0x2]     -=4; }  ; }     ; }  ; }     ; }  ; }    ; cycle++; PC += 4; if (PC != (oldPC + 4)) break;
    case 0x000017a8: oldPC = PC; {  ; { instruction_counter++; {  ; { {  ; { barrel_shifter_operand2_bus = rot_imm(0x00000064    , 0    , 0    ); }  ; }     ; {  ; { R[0x1]     = barrel_shifter_operand2_bus; if (& R[0x1]     == &R[15]) R[0x1]     -=4; }  ; }     ; }  ; }     ; }  ; }    ; cycle++; PC += 4; if (PC != (oldPC + 4)) break;
    case 0x000017ac: oldPC = PC; {  ; { instruction_counter++; {  ; { {  ; { barrel_shifter_operand2_bus = rot_imm(0x0000000b    , 0    , 0    ); }  ; }     ; {  ; { R[0x0]     = barrel_shifter_operand2_bus; if (& R[0x0]     == &R[15]) R[0x0]     -=4; }  ; }     ; }  ; }     ; }  ; }    ; cycle++; PC += 4; if (PC != (oldPC + 4)) break;
    case 0x000017b0: oldPC = PC; {  ; { instruction_counter++; {  ; { R[14] = PC + 4; PC += ((signed int )(( (0x000009d4     << 2) ) << (32-( 26 ))) >> (32-( 26 )))  + 4; }  ; }     ; }  ; }    ; cycle++; PC += 4; if (PC != (oldPC + 4)) break;
    case 0x000017b4: oldPC = PC; {  ; { instruction_counter++; {  ; { {  ; { offset_bus = 0    ; }  ; }     ; {  ; { address_bus = R[0x4]     + offset_bus; }  ; }     ; {  ; { store_byte(address_bus,R[0x5]    ); }  ; }     ; }  ; }     ; }  ; }    ; cycle++; PC += 4; if (PC != (oldPC + 4)) break;
    case 0x000017b8: oldPC = PC; {  ; { instruction_counter++; {  ; { PC += ((signed int )(( (0x00ffff90     << 2) ) << (32-( 26 ))) >> (32-( 26 )))  + 4; }  ; }     ; }  ; }    ; cycle++; PC += 4; if (PC != (oldPC + 4)) break;
    case 0x000017bc: oldPC = PC; {  ; { instruction_counter++; {  ; { {  ; { offset_bus = 0x000003f0    ; }  ; }     ; {  ; { address_bus = R[0x3]     - offset_bus; }  ; }     ; {  ; { load_word(address_bus,R[0x0]    ); }  ; }     ; }  ; }     ; }  ; }    ; cycle++; PC += 4; if (PC != (oldPC + 4)) break;
    case 0x000017c0: oldPC = PC; {  ; { instruction_counter++; {  ; { {  ; { barrel_shifter_operand2_bus = rot_imm(0    , 0    , 1    ); }  ; }     ; {  ; { unsigned int  test_and; test_and = sub_val(R[0x0]    , barrel_shifter_operand2_bus, 0, 1    );	if (&test_and == &R[15]) test_and -=4; update_cpsr_lu(test_and); }  ; }     ; }  ; }     ; }  ; }    ; cycle++; PC += 4; if (PC != (oldPC + 4)) break;
    case 0x000017c4: oldPC = PC; {  ; { instruction_counter++; if(((CPSR & 0x40000000) == 0x40000000) ) {  ; { PC += ((signed int )(( (0x00000028     << 2) ) << (32-( 26 ))) >> (32-( 26 )))  + 4; }  ; }     ; }  ; }    ; cycle++; PC += 4; if (PC != (oldPC + 4)) break;
    case 0x000017c8: oldPC = PC; {  ; { instruction_counter++; {  ; { {  ; { barrel_shifter_operand2_bus = rot_imm(0x00000001    , 0    , 1    ); }  ; }     ; {  ; { R[0x0]     = sub_val(R[0x0]    , barrel_shifter_operand2_bus,0, 1    );	if (& R[0x0]     == &R[15]) R[0x0]     -=4; update_cpsr_lu(R[0x0]    ); }  ; }     ; }  ; }     ; }  ; }    ; cycle++; PC += 4; if (PC != (oldPC + 4)) break;
    case 0x000017cc: oldPC = PC; {  ; { instruction_counter++; {  ; { {  ; { offset_bus = 0x000003f0    ; }  ; }     ; {  ; { address_bus = R[0x3]     - offset_bus; }  ; }     ; {  ; { store_word(address_bus,R[0x0]    ); }  ; }     ; }  ; }     ; }  ; }    ; cycle++; PC += 4; if (PC != (oldPC + 4)) break;
    case 0x000017d0: oldPC = PC; {  ; { instruction_counter++; if(! ((CPSR & 0x40000000) == 0x40000000) ) {  ; { PC += ((signed int )(( (0x00000025     << 2) ) << (32-( 26 ))) >> (32-( 26 )))  + 4; }  ; }     ; }  ; }    ; cycle++; PC += 4; if (PC != (oldPC + 4)) break;
    case 0x000017d4: oldPC = PC; {  ; { instruction_counter++; {  ; { {  ; { offset_bus = 0x0000002c    ; }  ; }     ; {  ; { address_bus = R[0xd]     + offset_bus; }  ; }     ; {  ; { store_word(address_bus,R[0x1]    ); }  ; }     ; }  ; }     ; }  ; }    ; cycle++; PC += 4; if (PC != (oldPC + 4)) break;
    case 0x000017d8: oldPC = PC; {  ; { instruction_counter++; {  ; { {  ; { offset_bus = 0x00000030    ; }  ; }     ; {  ; { address_bus = R[0xd]     + offset_bus; }  ; }     ; {  ; { store_word(address_bus,R[0xe]    ); }  ; }     ; }  ; }     ; }  ; }    ; cycle++; PC += 4; if (PC != (oldPC + 4)) break;
    case 0x000017dc: oldPC = PC; {  ; { instruction_counter++; {  ; { {  ; { offset_bus = 0x00000034    ; }  ; }     ; {  ; { address_bus = R[0xd]     + offset_bus; }  ; }     ; {  ; { store_word(address_bus,R[0x1]    ); }  ; }     ; }  ; }     ; }  ; }    ; cycle++; PC += 4; if (PC != (oldPC + 4)) break;
    case 0x000017e0: oldPC = PC; {  ; { instruction_counter++; {  ; { {  ; { offset_bus = 0x00000038    ; }  ; }     ; {  ; { address_bus = R[0xd]     + offset_bus; }  ; }     ; {  ; { store_word(address_bus,R[0x1]    ); }  ; }     ; }  ; }     ; }  ; }    ; cycle++; PC += 4; if (PC != (oldPC + 4)) break;
    case 0x000017e4: oldPC = PC; {  ; { instruction_counter++; {  ; { {  ; { offset_bus = 0x0000003c    ; }  ; }     ; {  ; { address_bus = R[0xd]     + offset_bus; }  ; }     ; {  ; { store_word(address_bus,R[0xc]    ); }  ; }     ; }  ; }     ; }  ; }    ; cycle++; PC += 4; if (PC != (oldPC + 4)) break;
    case 0x000017e8: oldPC = PC; {  ; { instruction_counter++; {  ; { {  ; { offset_bus = 0x00000040    ; }  ; }     ; {  ; { address_bus = R[0xd]     + offset_bus; }  ; }     ; {  ; { store_word(address_bus,R[0x2]    ); }  ; }     ; }  ; }     ; }  ; }    ; cycle++; PC += 4; if (PC != (oldPC + 4)) break;
    case 0x000017ec: oldPC = PC; {  ; { instruction_counter++; {  ; { {  ; { offset_bus = 0x00000044    ; }  ; }     ; {  ; { address_bus = R[0xd]     + offset_bus; }  ; }     ; {  ; { store_word(address_bus,R[0x2]    ); }  ; }     ; }  ; }     ; }  ; }    ; cycle++; PC += 4; if (PC != (oldPC + 4)) break;
    case 0x000017f0: oldPC = PC; {  ; { instruction_counter++; {  ; { {  ; { offset_bus = 0x00000048    ; }  ; }     ; {  ; { address_bus = R[0xd]     + offset_bus; }  ; }     ; {  ; { store_word(address_bus,R[0x2]    ); }  ; }     ; }  ; }     ; }  ; }    ; cycle++; PC += 4; if (PC != (oldPC + 4)) break;
    case 0x000017f4: oldPC = PC; {  ; { instruction_counter++; {  ; { {  ; { offset_bus = 0x0000004c    ; }  ; }     ; {  ; { address_bus = R[0xd]     + offset_bus; }  ; }     ; {  ; { store_word(address_bus,R[0x1]    ); }  ; }     ; }  ; }     ; }  ; }    ; cycle++; PC += 4; if (PC != (oldPC + 4)) break;
    case 0x000017f8: oldPC = PC; {  ; { instruction_counter++; {  ; { {  ; { offset_bus = 0x00000050    ; }  ; }     ; {  ; { address_bus = R[0xd]     + offset_bus; }  ; }     ; {  ; { store_word(address_bus,R[0x5]    ); }  ; }     ; }  ; }     ; }  ; }    ; cycle++; PC += 4; if (PC != (oldPC + 4)) break;
    case 0x000017fc: oldPC = PC; {  ; { instruction_counter++; {  ; { {  ; { barrel_shifter_operand2_bus = rot_imm(0x00000003    , 0    , 0    ); }  ; }     ; {  ; { R[0x0]     = barrel_shifter_operand2_bus; if (& R[0x0]     == &R[15]) R[0x0]     -=4; }  ; }     ; }  ; }     ; }  ; }    ; cycle++; PC += 4; if (PC != (oldPC + 4)) break;
    case 0x00001800: oldPC = PC; {  ; { instruction_counter++; {  ; { {  ; { offset_bus = 0x00000054    ; }  ; }     ; {  ; { address_bus = R[0xd]     + offset_bus; }  ; }     ; {  ; { store_word(address_bus,R[0x0]    ); }  ; }     ; }  ; }     ; }  ; }    ; cycle++; PC += 4; if (PC != (oldPC + 4)) break;
    case 0x00001804: oldPC = PC; {  ; { instruction_counter++; {  ; { {  ; { barrel_shifter_operand2_bus = rot_imm(0x00000005    , 0    , 0    ); }  ; }     ; {  ; { R[0x0]     = barrel_shifter_operand2_bus; if (& R[0x0]     == &R[15]) R[0x0]     -=4; }  ; }     ; }  ; }     ; }  ; }    ; cycle++; PC += 4; if (PC != (oldPC + 4)) break;
    case 0x00001808: oldPC = PC; {  ; { instruction_counter++; {  ; { {  ; { offset_bus = 0x00000058    ; }  ; }     ; {  ; { address_bus = R[0xd]     + offset_bus; }  ; }     ; {  ; { store_word(address_bus,R[0x0]    ); }  ; }     ; }  ; }     ; }  ; }    ; cycle++; PC += 4; if (PC != (oldPC + 4)) break;
    case 0x0000180c: oldPC = PC; {  ; { instruction_counter++; {  ; { {  ; { barrel_shifter_operand2_bus = rot_imm(0x00000007    , 0    , 0    ); }  ; }     ; {  ; { R[0x0]     = barrel_shifter_operand2_bus; if (& R[0x0]     == &R[15]) R[0x0]     -=4; }  ; }     ; }  ; }     ; }  ; }    ; cycle++; PC += 4; if (PC != (oldPC + 4)) break;
    case 0x00001810: oldPC = PC; {  ; { instruction_counter++; {  ; { {  ; { offset_bus = 0x0000005c    ; }  ; }     ; {  ; { address_bus = R[0xd]     + offset_bus; }  ; }     ; {  ; { store_word(address_bus,R[0x0]    ); }  ; }     ; }  ; }     ; }  ; }    ; cycle++; PC += 4; if (PC != (oldPC + 4)) break;
    case 0x00001814: oldPC = PC; {  ; { instruction_counter++; {  ; { {  ; { offset_bus = 0x00000060    ; }  ; }     ; {  ; { address_bus = R[0xd]     + offset_bus; }  ; }     ; {  ; { store_word(address_bus,R[0xc]    ); }  ; }     ; }  ; }     ; }  ; }    ; cycle++; PC += 4; if (PC != (oldPC + 4)) break;
    case 0x00001818: oldPC = PC; {  ; { instruction_counter++; {  ; { {  ; { offset_bus = 0x00000064    ; }  ; }     ; {  ; { address_bus = R[0xd]     + offset_bus; }  ; }     ; {  ; { store_word(address_bus,R[0xc]    ); }  ; }     ; }  ; }     ; }  ; }    ; cycle++; PC += 4; if (PC != (oldPC + 4)) break;
    case 0x0000181c: oldPC = PC; {  ; { instruction_counter++; {  ; { {  ; { barrel_shifter_operand2_bus = rot_imm(0x0000002c    , 0    , 0    ); }  ; }     ; {  ; { R[0x0]     = add_val(R[0xd]    , barrel_shifter_operand2_bus, 0, 0    );	if (& R[0x0]     == &R[15]) R[0x0]     -=4; }  ; }     ; }  ; }     ; }  ; }    ; cycle++; PC += 4; if (PC != (oldPC + 4)) break;
    case 0x00001820: oldPC = PC; {  ; { instruction_counter++; {  ; { {  ; { barrel_shifter_operand2_bus = rot_imm(0x00000010    , 0    , 0    ); }  ; }     ; {  ; { R[0x1]     = add_val(R[0x0]    , barrel_shifter_operand2_bus, 0, 0    );	if (& R[0x1]     == &R[15]) R[0x1]     -=4; }  ; }     ; }  ; }     ; }  ; }    ; cycle++; PC += 4; if (PC != (oldPC + 4)) break;
    case 0x00001824: oldPC = PC; {  ; { instruction_counter++; {  ; { {  ; { {  ; { barrel_shifter_operand2_bus = imm_lsl(R[0xd]    , 0    , 0    ); }  ; }     ; }  ; }     ; {  ; { R[0x0]     = barrel_shifter_operand2_bus; if (& R[0x0]     == &R[15]) R[0x0]     -=4; }  ; }     ; }  ; }     ; }  ; }    ; cycle++; PC += 4; if (PC != (oldPC + 4)) break;
    case 0x00001828: oldPC = PC; {  ; { instruction_counter++; {  ; { {  ; { barrel_shifter_operand2_bus = rot_imm(0x0000002c    , 0    , 0    ); }  ; }     ; {  ; { R[0x2]     = barrel_shifter_operand2_bus; if (& R[0x2]     == &R[15]) R[0x2]     -=4; }  ; }     ; }  ; }     ; }  ; }    ; cycle++; PC += 4; if (PC != (oldPC + 4)) break;
    case 0x0000182c: oldPC = PC; {  ; { instruction_counter++; {  ; { R[14] = PC + 4; PC += ((signed int )(( (0x000023a8     << 2) ) << (32-( 26 ))) >> (32-( 26 )))  + 4; }  ; }     ; }  ; }    ; cycle++; PC += 4; if (PC != (oldPC + 4)) break;
    case 0x00001830: oldPC = PC; {  ; { instruction_counter++; {  ; { {  ; { barrel_shifter_operand2_bus = rot_imm(0x0000002c    , 0    , 0    ); }  ; }     ; {  ; { R[0x3]     = add_val(R[0xd]    , barrel_shifter_operand2_bus, 0, 0    );	if (& R[0x3]     == &R[15]) R[0x3]     -=4; }  ; }     ; }  ; }     ; }  ; }    ; cycle++; PC += 4; if (PC != (oldPC + 4)) break;
    case 0x00001834: oldPC = PC; {  ; { instruction_counter++; {  ; { {  ; { unsigned int*  save_register[16]; int current_pos = 0; if(0x00000001    ) save_register[current_pos++] = &R[0]; if(0x00000001    ) save_register[current_pos++] = &R[1]; if(0x00000001    ) save_register[current_pos++] = &R[2]; if(0x00000001    ) save_register[current_pos++] = &R[3]; if(0    ) save_register[current_pos++] = &R[4]; if(0    ) save_register[current_pos++] = &R[5]; if(0    ) save_register[current_pos++] = &R[6]; if(0    ) save_register[current_pos++] = &R[7]; if(0    ) save_register[current_pos++] = &R[8]; if(0    ) save_register[current_pos++] = &R[9]; if(0    ) save_register[current_pos++] = &R[10]; if(0    ) save_register[current_pos++] = &R[11]; if(0    ) save_register[current_pos++] = &R[12]; if(0    ) save_register[current_pos++] = &R[13]; if(0    ) save_register[current_pos++] = &R[14]; if(0    ) save_register[current_pos++] = &R[15]; for(int i=0; i < current_pos; i++) { reg = save_register[i]; address_bus = R[0x3]     + (4*i); {  ; { load_word(address_bus,*reg); }  ; }     ; } }  ; }     ; }  ; }     ; }  ; }    ; cycle++; PC += 4; if (PC != (oldPC + 4)) break;
    case 0x00001838: oldPC = PC; {  ; { instruction_counter++; {  ; { R[14] = PC + 4; PC += ((signed int )(( (0x00fffde0     << 2) ) << (32-( 26 ))) >> (32-( 26 )))  + 4; }  ; }     ; }  ; }    ; cycle++; PC += 4; if (PC != (oldPC + 4)) break;
    case 0x0000183c: oldPC = PC; {  ; { instruction_counter++; {  ; { {  ; { offset_bus = 0    ; }  ; }     ; {  ; { address_bus = R[0x4]     + offset_bus; }  ; }     ; {  ; { load_byte(address_bus,R[0x5]    ); }  ; }     ; }  ; }     ; }  ; }    ; cycle++; PC += 4; if (PC != (oldPC + 4)) break;

      //
      // ... and so on up to a total file size of about 700 kB.
      //

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