declare global in gimple

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

I am writing a gimple pass and I need to declare a global variable in my
middle-end pass.

However, there is a problem. The following is my code:
{
    tree var;
    var = build_decl(UNKNOWN_LOCATION, VAR_DECL, get_identifier("global"),
integer_type_node);
    TREE_PUBLIC(var) = 1;
    DECL_EXTERNAL(var) = 0;

    //lang_hooks.decls.pushdecl(var);
    //pushdecl(var);
}

I don't want it to be externel variable. Thus I need to pushdecl it.

However, if I put lang_hooks.decls.pushdecl(var), my pass would seg-fault
when I use the compiled gcc.

And if I put pushdecl there, then I cannot compile gcc because of undefined
reference to pushdecl.

And if I don't put both, then my declared global variable is undefined
reference.

I think lang_hooks.decls.pushdecl(var) can only be used in front-end, so how
can I declare

a global variable in middle-end?

Thanks



--
View this message in context: http://gcc.1065356.n5.nabble.com/declare-global-in-gimple-tp1178703.html
Sent from the gcc - Help mailing list archive at Nabble.com.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux