On Wed, Aug 19, 2015 at 7:16 PM, Uday P. Khedker <u...@cse.iitb.ac.in> wrote: > > We are working on an analysis for identifying the class of an object flow > sensitively for > flow sensitive de-virtualization (i.e. replacing a virtual function call by > a call to the > function of a known class in the hierarchy). This is a regular ipa pass. It > find outs the > class of an object at point of creation and then propagates it.
Most of this is already in GCC 5 and above. Including the IPA pass. Have you looked into that pass yet? > > In the examples we have seen so far, given a statement > > B beta ("str"); > > It is is transformed by gcc-4.7.2 as shown below : > > __comp_ctor (&beta, "str"); > > We use this information to identify the class. > > However, for case in the source of GNU package gperf-3.0.4, a statement > > Output_Enum style (" "); > > is transformed by gcc 4.7.2 as > > # DEBUG this => &style > # DEBUG indent => "" > # DEBUG D#62 => &style.D.4064 > # DEBUG this => D#62 > MEM[(struct Output_Constants *)&style]._vptr.Output_Constants = > &MEM[(void *)&_ZTV16Output_Constants + 16B]; > style.D.4064._vptr.Output_Constants = &MEM[(void *)&_ZTV11Output_Enum > + 16B]; > style._indentation = ""; > > Why is this different? Why is __comp_ctor not invoked in each case? This looks like the function has been inlined as it is short. Thanks, Andrew Pinski > > The class hierarchy in gperf is as given below : > > struct Output_Constants > { > virtual void output_start () = 0; > virtual void output_item (const char *name, int value) = 0; > virtual void output_end () = 0; > Output_Constants () {} > virtual ~Output_Constants () {} > }; > > struct Output_Enum : public Output_Constants > { > virtual void output_start (); > virtual void output_item (const char *name, int value); > virtual void output_end (); > Output_Enum (const char *indent) > : _indentation (indent) {} > virtual ~Output_Enum () {} > private: > const char *_indentation; > bool _pending_comma; > }; > > Thanks and regards, > > Uday Khedker. > >