maybe a gcc bug

2005-03-25 Thread zouq

/testcom.c
int main (void)
{
int i,j;
int u[100][100], v[100][100],
p[100][100], unew[100][100],
vnew[100][100],pnew[100][100],
uold[100][100],vold[100][100],
pold[100][100],cu[100][100],
cv[100][100],z[100][100],h[100][100],psi[100][100];

 int tdts8=2;
 int tdtsdx=3;
 int tdtsdy=4;

 for (i=0;i<100;i++)
   for (j=0;j<100;j++)
   {
   unew[i+1][j]=uold[i+1][j]+tdts8*(z[i+1][j]+z[i+1][j])*
(cv[i+1][j+1]+cv[i][j+1]+cv[i][j]+cv[i+1][j])
-tdtsdx*(h[i+1][j]-h[i][j]);
   /*vnew[i][j+1]=vold[i][j+1]-tdts8*(z[i+1][j+1]+z[i][j+1])
*(cu[i+1][j+1]+cu[i][j+1]+cu[i][j]+cu[i+1][j])
-tdtsdy*(h[i][j+1]-h[i][j]);*/
   /*pnew[i][j]=pold[i][j]-tdtsdx*(cu[i+1][j]-cu[i][j])-
tdtsdy*(cv[i][j+1]-cv[i][j]);*/

   }

 for (i=0;i<100;i++)
   for (j=0;j<100;j++)
 printf ("%d\n%d\n%d\n",unew[i][j], vnew[i][j], pnew[i][j]);

 return 1;
}

first i made gcc-4.1-20050320 a cross-compiler for powerpc.
when i compile the above program,  it goes like this:

testcom.c:34: internal compiler error: in schedule_insns, at sched-rgn.c:2549

who can tell me why?
why can it bring compiler error?





about gcc-4.1-20050327

2005-03-27 Thread zouq
i build a crosscompiler for gcc, abi=n32
gcc-4.1-20050327/configure  -target=mips64el-linux
-prefix=/opt/gcc-4.1-20050327/ -enable-languages=c --disable-shared
make

it will error with config/mips/mips.c







Re: about gcc-4.1-20050327

2005-03-28 Thread zouq
- 源邮件 -
主题:   Re: about gcc-4.1-20050327
发件人: "zouq" <[EMAIL PROTECTED]>
日期:   Tue, 三月 29, 2005 8:21 am
收件人: "James E Wilson" <[EMAIL PROTECTED]>
--

en, sorry, because i am not sure about the bug.

1.i configure the gcc as follows:
 gcc-4.1-20050327/configure
 -target=mips64el-linux -prefix=/opt/gcc-4.1-20050327/
 -enable-languages=c --disable-shared

2.while i make it, it stopped with following errors:
/home/cpu/source/gcc-4.1-20050327/gcc/config/mips/mips.c: In function
`mips_gimplify_va_arg_expr':
/home/cpu/source/gcc-4.1-20050327/gcc/config/mips/mips.c:3976: error:
structure has no member named `truthvalue_conversion'

i also tryed to build o32 , it goes the same way as the above one.



> zouq wrote:
>> i build a crosscompiler for gcc, abi=n32 gcc-4.1-20050327/configure
-target=mips64el-linux -prefix=/opt/gcc-4.1-20050327/
>> -enable-languages=c --disable-shared make it will error with
>> config/mips/mips.c
>
> We need more info than what you have provided.  In particular, we need
to know exactly what the error message was.
>
> Please see
> http://gcc.gnu.org/bugs.html
> for info on how to report bugs.
> --
> Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com
>






about new_regalloc

2005-03-30 Thread zouq
in gcc3.4.1,i found rest_of_new_handle_regalloc
why in gcc4.0, it has been removed?
or haved changed its name?




about "Alias Analysis for Intermediate Code"

2005-04-04 Thread zouq
i can`t find it in current gcc version.
pleas do me the favor to tell me about it.




Re: about "Alias Analysis for Intermediate Code"

2005-04-05 Thread zouq
but i don`t understand even if you propagate the alias analysis from the
tree optimizers, the space won1t be saved, you still need many space to
save the info. is it not as expansive as the alias analysis based on the
RTL representation? what has it saved?thank you.

Qo.
Zou

> On Monday 04 April 2005 10:09, zouq wrote:
>> i can`t find it in current gcc version.
>> pleas do me the favor to tell me about it.
>
> I can only guess that you probably mean the Debray alias analysis
> proposed at the GCC summit in 2003.  Follow this link for the paper:
> "http://gcc.fyxm.net/summit/2003/Alias analysis for intermediate code.pdf"
>
> That code was never included because this analysis is *very* expensive,
> and it should be possible to propagate even better alias analysis info
> down from the tree optimizers to RTL.
>
> Gr.
> Steven'
>




about alias analysis

2005-04-05 Thread zouq
i wonder whether there exists or not alias analysis for  scalar variable,
array variable, even pointers.
thank you.




about the parse tree

2005-04-11 Thread zouq
i want very much to learn more about the parse tree in gcc.
but it`s much more complicate than i have thought.
can some one show me some way to learn it a little easier,
i have tried to debug it, but the structure is difficult to understand,
and i can`t find any document about it, except the comment in the source
code.
thanks.



some problem about cross-compile the gcc-2.95.3

2005-04-15 Thread zouq
first i download the release the version of gcc-2.95.3, binutils 2.15,
and i use the o32 lib, include of gcc3.3.3 .
1. compile the binutils and install it
mkdir binutils-build;
cd binutils-build;
../../binutils-2.15/configure --prefix=/opt/gcc --target=mipsel-linux -v;
make;make install;

2. cp -r ../../lib /opt/gcc/mipsel-linux/
   cp -r ../../include /opt/gcc/mipsel-linux/

3. compile the gcc
mkdir gcc-build;
cd gcc-build;
../../gcc-2.95.3/configure --prefix=/opt/gcc --target=mipsel-linux
--enable-languages=c -enable-shared -disable-checking -v;
make;

then the ERROR happened:
make[1]: Entering directory
`/home/mytask/mywork/WHAT_I_HAVE_DONE/mycompile/gcc-2.95.3-build/gcc/gcc'
(cd intl && make all)
make[2]: Entering directory
`/home/mytask/mywork/WHAT_I_HAVE_DONE/mycompile/gcc-2.95.3-build/gcc/gcc/intl'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory
`/home/mytask/mywork/WHAT_I_HAVE_DONE/mycompile/gcc-2.95.3-build/gcc/gcc/intl'
if [ -f libgcc2.ready ] ; then \
true; \
else \
touch libgcc2.ready; \
fi
rm -f tmplibgcc2.a
for name in _muldi3 _divdi3 _moddi3 _udivdi3 _umoddi3 _negdi2 _lshrdi3
_ashldi3 _ashrdi3 _ffsdi2 _udiv_w_sdiv _udivmoddi4 _cmpdi2 _ucmpdi2
_floatdidf _floatdisf _fixunsdfsi _fixunssfsi _fixunsdfdi _fixdfdi
_fixunssfdi _fixsfdi _fixxfdi _fixunsxfdi _floatdixf _fixunsxfsi _fixtfdi
_fixunstfdi _floatditf __gcc_bcmp _varargs __dummy _eprintf _bb _shtab
_clear_cache _trampoline __main _exit _ctors _pure; \
do \
  echo ${name}; \
  /home/mytask/mywork/WHAT_I_HAVE_DONE/mycompile/gcc-2.95.3-build/gcc/gcc/xgcc
-B/home/mytask/mywork/WHAT_I_HAVE_DONE/mycompile/gcc-2.95.3-build/gcc/gcc/
-B=/opt/gcc-2.95//mipsel-linux/bin/
-I=/opt/gcc-2.95//mipsel-linux/include  -DCROSS_COMPILE -DIN_GCC 
-I./include -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -I/usr/include  
-I. -I../../../gcc-2.95.3/gcc -I../../../gcc-2.95.3/gcc/config
-I../../../gcc-2.95.3/gcc/../include -c -DL${name} \
   ../../../gcc-2.95.3/gcc/libgcc2.c -o ${name}.o; \
  if [ $? -eq 0 ] ; then true; else exit 1; fi; \
  mipsel-linux-ar rc tmplibgcc2.a ${name}.o; \
  rm -f ${name}.o; \
done
_muldi3
as: unrecognized option `-O2'
make[1]: *** [libgcc2.a] Error 1
make[1]: Leaving directory
`/home/mytask/mywork/WHAT_I_HAVE_DONE/mycompile/gcc-2.95.3-build/gcc/gcc'

i am very confused about the error.
is there something wrong with my Makefile?
the as should be mipsel-linux-as
is it?






about how to write makefile.in config-lang.in for a frontend

2005-04-23 Thread zouq
i am now writing a frontend in gcc,
but i don`t understand the rule to write the makefile.in, config-lang.in




about madd instruction in mips instruction sets

2005-04-27 Thread zouq
i found madd instruction in mips.md,
but why when i compiled it with my cross-compile mipsel-linux-gcc as follows,
mipsel-linux-gcc -mips4 -O2 test.c -S

i can`t find any madd instruction in test.s??

what else should i do?




a question about peephole2

2005-05-13 Thread zouq
first i want to generate a three-operator multiply-add instruction similar
to four-operator multiply-add instruction in mips4 instruction sets.

i modify the gcc/config/mips/mips.md file as follow:
(define_peephole2
 [ (set (match_operand:SF 0 "register_operand" "=f")
(mult:SF (match_operand:SF 1 "register_operand" "f")
 (match_operand:SF 2 "register_operand" "f")))
 (set (match_operand:SF 3 "register_operand" "=f")
(plus:SF (match_operand:SF 4 "register_operand" "f")
 (match_operand:SF 5 "register_operand" "f")))]
   "ISA_HAS_MADD && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT &&
TARGET_FUSED_MADD
   && ((rtx_equal_p(operands[3], operands[4]) && rtx_equal_p(operands[0],
operands[5]))
   ||  (rtx_equal_p(operands[3], operands[5]) && rtx_equal_p(operands[0],
operands[4])))"
  [(set (match_operand:SF 3 "register_operand" "=f")
(plus:SF (mult:SF (match_operand:SF 1 "register_operand" "f")
  (match_operand:SF 2 "register_operand" "f"))
 (match_dup 3)))
(clobber (match_dup 0))]
   "")

(define_insn ""
  [(set (match_operand:DF 0 "register_operand" "=f")
(plus:DF (mult:DF (match_operand:DF 1 "register_operand" "f")
  (match_operand:DF 2 "register_operand" "f"))
 (match_dup 0)))]
  "ISA_HAS_MADD && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT &&
TARGET_FUSED_MADD "
  "madd.d\t%0,%1,%2"
  [(set_attr "type" "fmadd")
   (set_attr "mode" "DF")])

in many spec2000 cases , it can success to generate multiply-add
instrutions, but the problem i encounter now is:

original program is:
mul.d $f1, $f1, $f0
add.d $f2, $f2, $f1
div.d $f3, $f0, $f1;

after i compile used my changed gcc, it becomes:
madd.d $f2, $f1, $0
div.d  $f3, $f0, $f1

as you can see, the value of $f1 is wrong!!

How can i avoid it? modify my md???




Re: a question about peephole2

2005-05-13 Thread zouq
en,i still have a problem,
the MAX_INSNS_PER_PEEP2 is 3,
when the program case is :
mul.d $f1, $f1, $f0
add.d $f2, $f2, $f1
sub.d $f3, $f3, $f2
sdc1  $f3, 0(v0)
addiu v0, v0, 1
add.d $f3, $f4, $f2
sdc1
> On Fri, May 13, 2005 at 11:37:16PM +0800, zouq wrote:
>> original program is:
>> mul.d $f1, $f1, $f0
>> add.d $f2, $f2, $f1
>> div.d $f3, $f0, $f1;
>>
>> after i compile used my changed gcc, it becomes:
>> madd.d $f2, $f1, $0
>> div.d  $f3, $f0, $f1
>>
>> as you can see, the value of $f1 is wrong!!
>
> Check
>
>   (rtx_equal_p (operands[3], operands[0])
>|| peep2_reg_dead_p (2, operands[0]))
>
>
> r~
>




some question about gc

2005-05-15 Thread zouq
i am trying to port a front end to gcc,
and i am confused with the gc,
i see from the file gengtype.c, it can generate many files automaticlly,
but i don`t understand the rule to generate it, i can only understand
firstly use the yacc to analysize the gtfiles, then output something ,
and this is just what i don`t understand.

 can some one tell me about it, or tell me where i can get more
information about it.
thanks a lot.



Re: some question about gc

2005-05-16 Thread zouq
i am sorry for that.

> "zouq" <[EMAIL PROTECTED]> writes:
>
> Please don't start a new thread by replying to a message on an
> existing thread.  Just send a new message, instead.  Otherwise your
> message goes in the wrong place for people who use threaded e-mail
> readers.

yes, as you have suggested, i have already read the gcc-int about garbage
collection, and i still can`t get the imformation i want.
i want to know the following constructs:
gt_ggc_cache_rtab, gt_ggc_deletable_rtab 
acording to what rules to genenrate them,
i read some of the gengtype.c, and i still don`t understand it. :(

and now i am thinking that why use garbage collection in gcc,
is it because of its high efficiency?








Re: some question about gc

2005-05-16 Thread zouq
1.
in the gt-c-decl.h,
three functions about lang_decl,
gt_pch_nx_lang_decl(),gt_ggc_mx_lang_decl, gt_pch_g_9lang_decl(),
what are the differences between the three functions?

2.
i can find the prefixes in the gengtype.c,

what are they setting for?

static const struct write_types_data ggc_wtd =
{
  "ggc_m", NULL, "ggc_mark", "ggc_test_and_set_mark", NULL,
  "GC marker procedures.  "
};

   static
const
struct
write_types_data
pch_wtd
=
{
  "pch_n", "pch_p", "gt_pch_note_object", "gt_pch_note_object",
  "gt_pch_note_reorder",
  "PCH type-walking procedures.  "
};





question in porting gcc front end

2005-05-22 Thread zouq
i write a front-end , and compile it with gcc-3.4.1 source code,
and it errors in function rest_of_compilation()
void
rest_of_compilation (tree decl)
{
  rtx insns;

  timevar_push (TV_REST_OF_COMPILATION);

  rtl_register_cfg_hooks ();

  generating_concat_p = 0;

  cse_not_expected = ! optimize;


 /*
First,
make
sure
that
NOTE_BLOCK
is
set
correctly
for
each
 NOTE_INSN_BLOCK_BEG/NOTE_INSN_BLOCK_END note.  */
  if (!cfun->x_whole_function_mode_p)
identify_blocks ();

   

}

:internal compiler error: in identify_blocks_1, at function.c:6090

idendify_blocks()
{

  last_block_vector = identify_blocks_1 (get_insns (),
 block_vector + 1,
 block_vector + n_blocks,
 block_stack);

   .
}

it seems that i haven`t give the block information for current_function_decl.
because when i gdb it, the n_blocks=1;

when should i build the block structure?



question in generating rtl code

2005-05-30 Thread zouq

in gcc-3.4.1
 rtl  can be generated when parsing the source program,
for example,
stmt:
  compstmt
{ stmt_count++; $$ = $1; }
| expr ';'
{ stmt_count++;
  $$ = c_expand_expr_stmt ($1); }

while in c_expand_body, rtl can also be generated .
what are they respectively for?

while in gcc-2.95.3,
i can`t find the function c_expand_body,
does it mean that all the rtl are generated by the c-parse.y
(except for the expand_function_end, end expand_function_start)?