This is the mail archive of the gcc-patches@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]

Re: Re-implement VEC_* to be member functions of vec_t<T>


On 2012-08-24 12:03 , Gabriel Dos Reis wrote:

I would just use C++ standard function `at()' (e.g. as found in vector<T>)
for this.

Sure. For regular functions, using default-valued arguments would be fine. But I think the mechanism would be much more transparent if the compiler did the heavy lifting.


1- Add a class/function attribute that makes the compiler add 3 hidden
   args for the caller location.

2- During code generation, the compiler fills in these values at call
   sites.

3- The callee accesses these values by referencing specially named
   arguments (much like 'this') or via __builtin_* accessors.
   I think I prefer using __builtin_*.


Diego.



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