This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Unnecessary pointer arithmetic in trees from the C/C++ front-end
- From: Chris Lattner <sabre at nondot dot org>
- To: gcc at gcc dot gnu dot org
- Date: Fri, 30 May 2003 12:48:38 -0500 (CDT)
- Subject: 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/