Hi everyone!
I need to get the array size from a declaration like "int v[100]" (here the
size is "100").
For example:
if (TREE_CODE (TREE_TYPE (var))) == ARRAY_TYPE) {
int array_size = // ...here I want to get the size
}
How can I do?
Thank you
Max
Hi everybody!
I'm working on a pass and I need to handle some pointer expressions.
For example, I have this C-code:
int v[1000];
int *p;
p = &v[10];
The problem is that, when I'm trying to parse "p = &v[10];", I'm not able to
get the array offset (10 in this case).
Namely, for a given st
Thank you very much!!! :D
--- Mer 24/3/10, Ian Lance Taylor ha scritto:
> Da: Ian Lance Taylor
> Oggetto: Re: Problem with ADDR_EXPR array offset
> A: "Massimo Nazaria"
> Cc: gcc@gcc.gnu.org
> Data: Mercoledì 24 marzo 2010, 23:59
> Massimo Nazaria
> writes:
>
Hi everybody!
I am working on a gcc-pass which processes every statement using this code:
for (node = cgraph_nodes; node; node = node->next)
{
if (node->analyzed && cgraph_is_master_clone (node))
{
push_cfun (DECL_STRUCT_FUNCTION (node->decl));
FO
> You have to schedule your IPA pass at a point where the
> whole
> program is in SSA form, which is during the regular IPA
> passes
> at earlierst.
>
> Richard.
>
It does not work :(
I put my pass after all the ipa-passes and right before the optimization-passes.
My problem occurs when I try t
> You'll have to post your work so people can see. Now the
> best the
> experts here can do is guess what you're holding behind
> your back :-)
>
> Ciao!
> Steven
>
I completely agree with you. This is my pass:
static unsigned int
execute_mypass (void)
{
basic_block bb;
gimple stmt, def_stm
> The place where you insert the patch is as important as
> the
> implementation of your patch. What do your changes to
> passes.c look
> like?
Here is the "passes.c":
NEXT_PASS (pass_early_warn_uninitialized);
NEXT_PASS (pass_all_early_optimizations);
NEXT_PASS (pass_mypass); //
Thank you everyone!!!
I found out a solution...
I had to add a line to my pass (the 2nd if):
for (node = cgraph_nodes; node; node = node->next) {
if (node->analyzed && cgraph_is_master_clone (node)) {
if (!gimple_in_ssa_p (DECL_STRUCT_FUNCTION (node->decl))) return 0; // I
added this line