On Wed, Apr 3, 2024 at 9:35 AM Hanke Zhang via Gcc <gcc@gcc.gnu.org> wrote:
>
> Hi,
> I'm trying to get the default values for parameters of some functions
> in my GIMPLE-PASS. The example code is here:
>
> enum {
>   edefault1 = 1,
>   edefault2 = 2,
>   edefault3 = 3
> }
>
> void func(int p0, int p1 = edefault1, int p2 = edefault2, int p3 = edefault3) 
> {
>   // do other things
> }
>
> I want to get the value of `p1` here. But I didn't find a way to get it.
>
> And I noticed that the marco `DECL_INITIAL` cannot be applied on
> PARM_DECL. And the comments say that the default values for parameters
> are encoded in the type of the function. But I can't find it.

The TYPE_ARG_TYPES of a FUNCTION_TYPE is a TREE_LIST where the
TREE_PURPOSE is the default argument.

Jason

Reply via email to