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]
Other format: [Raw text]

Unnecessary pointer arithmetic in trees from the C/C++ front-end


With the following testcase:

typedef struct {
  int w;
} S1Ty;

typedef struct {
  S1Ty A, B;
} S2Ty;

void takeS1(S1Ty *V);
void test() {
  S2Ty E;
  takeS1(&E.B);    /* the line in question */
}

The C and C++ frontends currently
compile the "&E.B" expression to use pointer arithmetic like this:
  (plus_expr
        (nop_expr (addr_expr (var_decl E)))
        (integer_cst 4))

Is there something that I can modify in the front-ends that would cause to
code to generate an (address_of (component_ref ...))?

Thanks for any help,  :)

-Chris

-- 
http://llvm.cs.uiuc.edu/
http://www.nondot.org/~sabre/Projects/


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