gimplification---gimple tree for C and C++

2006-04-05 Thread sean yang
I have two (maybe dummy) question here: 1) For C programs, gimplification is done in gimplify_function_tree(), which is called (through several caller layers) from toplev_main(). Can someone explain how gimplification is done for C++? Maybe another way to ask it is: I understand cc1 is generate

traverse the gimple tree

2006-04-10 Thread sean yang
I want to write a pass to walk the gimple tree and add some intrumentation code. I read the chapter 9 of "GCC Internals" document, and it seems not to describe the Macros to do so. Can I get some information about this? Specifically, if someone can show me which .h file I should look at to fin

Re: traverse the gimple tree

2006-04-11 Thread sean yang
, /* properties_destroyed */ From: Zdenek Dvorak <[EMAIL PROTECTED]> To: sean yang <[EMAIL PROTECTED]> CC: gcc@gcc.gnu.org Subject: Re: traverse the gimple tree Date: Tue, 11 Apr 2006 13:56:48 +0200 Hello, > I want to write a pass to walk the gimple tree and add some intrum

Re: traverse the gimple tree

2006-04-17 Thread sean yang
taking care of them in dump_generic_node(). Can someone explain TREE_LIST and TREE_VEC to me? Thanks, Sean From: Zdenek Dvorak <[EMAIL PROTECTED]> To: sean yang <[EMAIL PROTECTED]> CC: gcc@gcc.gnu.org Subject: Re: traverse the gimple tree Date: Tue, 11 Apr 2006 13:56:48 +0200 Hello, > I w

adding nodes in a tree --after GIMPLIFICATION, before SSA

2006-04-18 Thread sean yang
I will appreciate your help. Thanks in advance. Let me give a concrete example of what I want to do (Please understand I have other reasons to do this after gimplification, though the example shows that there is a much simpler way to achieve this): in the example, I want to add a call of inst

Re: adding nodes in a tree --after GIMPLIFICATION, before SSA

2006-04-19 Thread sean yang
ND_EXPR_BODY -> compound-stmt why is it safe for the walking procedure to skip "BIND_EXPR_BLOCK" component? I think BIND_EXPR_BLOCK part can still contain statements. */ .. --- From: Daniel Berlin &l

About some confusion to the GIMPLE grammar

2006-04-20 Thread sean yang
Hi Jason and other experts, I am reading the paper (GCC summit 2003 http://gcc.fyxm.net/summit/2003/GENERIC%20and%20GIMPLE.pdf) about GIMPLE grammar, after reading the GCC internal doc about this topic. There are something confusing and here I list a couple of my questions: (1) The item for

about f77/f90 and gcc

2006-04-24 Thread sean yang
I have hacked gcc to add some instrumentation functionality (adding a simple pass). It works for my C programs (because I can compile them by using ">/home/mygcc/bin/gcc myprog.c") , and now I am thinking of how to have it work for fortran programs--as my transformation pass is done after GIMPL

Re: about f77/f90 and gcc

2006-04-24 Thread sean yang
From: Paul Brook <[EMAIL PROTECTED]> To: gcc@gcc.gnu.org CC: "sean yang" <[EMAIL PROTECTED]>, [EMAIL PROTECTED] Subject: Re: about f77/f90 and gcc Date: Mon, 24 Apr 2006 17:56:19 +0100 > I realize the gcc4.0.2 source code does not include any fortran frontend. Yes

Re: adding nodes in a tree --(about function name mangling)

2006-04-24 Thread sean yang
From: Daniel Berlin <[EMAIL PROTECTED]> To: sean yang <[EMAIL PROTECTED]> CC: gcc@gcc.gnu.org Subject: Re: adding nodes in a tree --after GIMPLIFICATION, before SSA Date: Wed, 19 Apr 2006 22:38:11 -0700 In fact, there are only *two* places a call can occur in GIMPLE at that

indirect call in RTL dump files

2006-05-06 Thread sean yang
http://gcc.fyxm.net/summit/2004/GCC%20Call%20Graph.pdf For the RTL representation, there are two type of function call instructions as I understand. 1) direct call---this type of calls are shown with something like (call (mem:QI (symbol_ref:SI ("bar") [flags 0x3] bar>) [0 S1 A8]) And the corre

Re: indirect call in RTL dump files

2006-05-06 Thread sean yang
From: Andrew Pinski <[EMAIL PROTECTED]> To: "sean yang" <[EMAIL PROTECTED]> CC: gcc@gcc.gnu.org Subject: Re: indirect call in RTL dump files Date: Sat, 6 May 2006 10:10:16 -0700 On May 6, 2006, at 10:06 AM, sean yang wrote: 2) indirect call (explained in 3.1 i

Fortran frontend prerequisites

2006-05-10 Thread sean yang
I made some modification on GCC 4.0.2 (basically, I added a simple pass) and compiled it to binary. But I realized that the GCC I built does not include Fortran frontend. I think I followed the standard steps http://gcc.gnu.org/install/configure.html Could you please guess (based on your exp

"mygcc/libexec/gcc/i686-pc-linux-gnu/4.0.2/cc1" != "mygcc/gcc/cc1"

2006-05-13 Thread sean yang
I added a pass in GCC and successfully built it to binary following the building procedure (./configure, make, make install). I found "mygcc/libexec/gcc/i686-pc-linux-gnu/4.0.2/cc1" is different from "mygcc/gcc/cc1", as shown below. -

identifying a BB representing a self-loop

2006-05-19 Thread sean yang
Some basic blocks may represent a (self) loop, but GCC's internal basic block representation won't show such information explicitly (i.e., it won't store a self-loop edge). My question is, when I walk through basic blocks, can I identify then easily? E.g., Let's say, --demo.c--

address order and BB numbering

2006-05-19 Thread sean yang
Although "BASIC_BLOCK array contains BBs in an unspecified order" as the GCC internal doc says, can I assume that the final virtual address for an instruction in BB_m is always higher than the virtual address for an instruction in BB_n, when m < n. (Let's assume the linker for the target machi

Re: identifying a BB representing a self-loop

2006-05-19 Thread sean yang
From: Daniel Berlin <[EMAIL PROTECTED]> To: sean yang <[EMAIL PROTECTED]> CC: gcc@gcc.gnu.org, [EMAIL PROTECTED] Subject: Re: identifying a BB representing a self-loop Date: Fri, 19 May 2006 15:41:30 -0400 sean yang wrote: > Some basic blocks may represent a (self) loop, but GCC&#

Re: address order and BB numbering

2006-05-19 Thread sean yang
From: Dale Johannesen <[EMAIL PROTECTED]> To: sean yang <[EMAIL PROTECTED]> CC: Dale Johannesen <[EMAIL PROTECTED]>, gcc@gcc.gnu.org Subject: Re: address order and BB numbering Date: Fri, 19 May 2006 12:54:56 -0700 On May 19, 2006, at 12:48 PM, sean yang wrote: Although

delete a basic block, and maintain CFG of remaining BBs

2006-05-27 Thread sean yang
Hi folks, Can anyone give an advice on how to delete a basic block and maintain the CFG for the remaining code valid? i.e, I want to delete a basic block (all the code within that basic block) satisfying a specific criteria, yet maintaining the validity of CFG. Is there a simple API to do it?

Freeing memory for basic-blocks and edges

2006-05-29 Thread sean yang
I am looking for code that corresponds to freeing memory for BBs and Edges. For example, I know to allocate a chunk of memory to hold BB information is done by "ggc_alloc_cleared()". But after a function analysis/optimization is done, the memory should be freed. I tried to read code in rest_o

call_insns in RTX form--two questions

2006-05-29 Thread sean yang
The first question is: If I want to find a BB that containing a specific function call (say 'foo'), is there an easy way in the RTX level? The second one is: how can i get the order of different call foo in the final assembly code. Can I get it by dumping some information, say the order of the

RE: call_insns in RTX form--two questions

2006-05-29 Thread sean yang
I guess maybe the 2nd question is a little uncommon, but thank for any advice. From: "sean yang" <[EMAIL PROTECTED]> To: gcc@gcc.gnu.org Subject: call_insns in RTX form--two questions Date: Tue, 30 May 2006 04:09:03 + The first question is: If I want to find a BB t

Difference between 'FOR_EACH_BB' and 'for (i=0; i

2006-06-01 Thread sean yang
My understanding is that: both are used to traverse BBs and the only (potential )difference is the order of the traversal. 'FOR_EACH_BB' traverses BBs throught the linked list order; 'for (i=0; ii++){bb=BASIC_BLOCK(i);}' traverses accoring to the BB's index (because BASIC_BLOCK(i)->index ==i)

Re: Difference between 'FOR_EACH_BB' and 'for (i=0; i

2006-06-01 Thread sean yang
s making garbage collector to die. We should be able to release all dead SSA_NAMES and at the same time we should clear out BB pointer of dead statements consistently. */ } --- From: Diego Novillo <[EMAIL PROTECTED]> To

a question about code instrumentation in RTL level

2006-07-16 Thread sean yang
The GCC internals explicitly introduced code manipulation APIs in TREE representation (bsi_insert_before, bsi_remove etc). But I did not see the equivalent for RTL representation. Say, I want to enable a counter for a n-depth-nested loop. For example, I want to add a counter instruction to cou

Inserting a GIMPLE node in a SSA form representation pass

2006-07-17 Thread sean yang
I'd like to ask a question about difference of SSA-form representation and GIMPLE representation. I thanks you for your answer. My understanding is that any stmt node insertion operation in a pass between building-SSA pass and un-SSA pass should uses SSA-form representation. But the following

converting a CALL_EXPR node without any argument into SSA form, thanks

2006-07-28 Thread sean yang
I asked the question about the name compatibility for CALL_EXPR in SSA form. Thanks for the answers from this mailing list. My understanding is that we don't need to convert a stmt node into SSA form as long as the call instruction (CALL_EXPR) does not use any variable as an argument. But the

question about linker

2005-09-09 Thread sean yang
Hi I am looking for the source code related to linking stage--coz I am trying to modify (very slightly) the linker. I understand that 'ld' is the linker in Linux. My question is: Is 'ld' a part of gcc toolchain? --If it is, I should be able to find source file producing 'ld'. But I haven't fou

interprocedural CFG

2005-09-10 Thread sean yang
Can gcc provide an interprocedural CFG and dump it to a .vcg format file? I understand gcc provides intraprocedural CFG analysis, and wonder if interprocedural CFG is available. Thanks a lot. Sean for example, //file name: main.c extern void foo(); int main(){ int i=9; if (i>0) foo(); else

dump CFG and callgraph

2005-10-31 Thread sean yang
Hi, (1) if I want to dump a gimple tree representation of a program, where should I start to look at? And I read gcc internal manual, the control flow graph information is represented by BB data structure. If I want to walk through a control flow graph, where should I start to look at? (2) Ca

VCG and cfg.vcg display

2006-01-04 Thread sean yang
gcc dumps a vcg file to represent the CFG, but I can't find a site to download VCG source and compile it. I did a little search online and understood it's about GPL licence for VCG. Can someone tell me where to it work? --I just want to display the cfg.vcg files. A related question is "does

to map binary addresses to instructions

2006-01-04 Thread sean yang
I think I have a pretty specific functionality to achieve. I appreciate your suggestion and help. Here is what I want, and I attach an example at the end. I want to know the address of some function call sites. for example, I want to know is the address of call 8048380 . (see line "8048366:

when does Optimization happen....

2006-03-05 Thread sean yang
I understand that gcc -On happens before generating assembly code (.s), is it correct? #gcc -S main.c; gcc -o a.out main.s (here without optimization) #gcc -O2 -S main.c; gcc -o a1.out main.s (here with optimization of O2) But some optimization, such as inlining, may require cross compilation-un

do_spec(), do_spec_x() and execute() in mygcc/gcc/gcc.c

2006-03-26 Thread sean yang
I am looking at the source code of gcc.c, and I found the driver function main.c calls do_spec(). It seems that do_spce() is the function, called by main(), which invokes the preprocessor, compiler, assembler and linker individually at different step according to the input to the driver; and e

executables in gcc4.0.2

2006-03-28 Thread sean yang
If we do a search of main function in gcc4..0.2/gcc directory, we can find several. I understand collect2.c-->collect2, main.c (wrapper of toplev.c) -->cc1, gcov.c-->gcov. Can someone give a brief introduction what gen*() is ued for? For example, genattr is compiled to destgcc/gcc/build/genattr,