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]

Re: function attributes


 Hi Umesh/Ian,

  I followed the steps and it has generated the required branch instruction.

  Thankyou so much for the links and steps.

On Wed, Oct 16, 2013 at 4:00 PM, Umesh Kalappa <umesh.kalappa0@gmail.com> wrote:
> Here you go ,
>
> a)define  new field in the struct "CUMULATIVE_ARGS" says as int long_call;
>
> b)set the field long_call to known vlaue@ init_cumulative_args() .
>
> c)In the TARGET_FUNCTION_ARG hook
>                 The last time this MACRO is called, it is called with
> MODE == VOIDmode, and its result is passed to the call or call_value
> pattern as operands 2 and 3 respectively.
>                 if(VOIDmode == MODE)
>              return  INTVAL(CUMULATIVE_ARGS->long_call);
> d)Handle operands[2] for call  pattern  as
>
> (define_insn "call_name"
>                 [(call (mem:SI (match_operand:MODE 0 "" ""))
>           (match_operand 1 "" ""))
>                 (use (match_operand:SI 2 "immediate_operand" ""))
>  "
> {
>                 if (INTVAL (operands[2]) & long_call)
>                 {
>                                 return "branch long"
>                 }
>                 else
>                 {
>                                 return "branch other"
>                 }
> }
> ")
> e)same for call_value ,where you ended to check the operands[3]
>
>
> Hope this helps you there
>
> Thanks
> ~Umesh
>
>
> On Wed, Oct 16, 2013 at 2:26 PM, Nagaraju Mekala <gnuuser.raj@gmail.com> wrote:
>> Yes.. I still had no luck.
>> Do you have any thoughts on this??
>>
>> On Wed, Oct 16, 2013 at 2:05 PM, Umesh Kalappa <umesh.kalappa0@gmail.com> wrote:
>>> You still stuck with this issue ???
>>>
>>> ~Umesh
>>>
>>> On Tue, Oct 15, 2013 at 9:08 PM, Ian Lance Taylor <iant@google.com> wrote:
>>>> On Tue, Oct 15, 2013 at 8:04 AM, Nagaraju Mekala <gnuuser.raj@gmail.com> wrote:
>>>>>  Hi Ian,
>>>>>
>>>>>   Thanks for the reply.
>>>>>
>>>>> On Fri, Oct 11, 2013 at 10:31 PM, Ian Lance Taylor <iant@google.com> wrote:
>>>>>> On Fri, Oct 11, 2013 at 9:20 AM, Nagaraju Mekala <gnuuser.raj@gmail.com> wrote:
>>>>>>>
>>>>>>> I observed that in rs6000 port longcall is implemented by using
>>>>>>> CALL_LONG define.
>>>>>>> #define CALL_LONG 0x00000008 /* always call indirect */
>>>>>>> In the md file they are checking the operand with CALL_LONG
>>>>>>> if (INTVAL (operands[3]) & CALL_LONG)
>>>>>>> operands[1] = rs6000_longcall_ref (operands[1]);
>>>>>>> In my port I dont have suchthing to compare. Can we somehow parse the
>>>>>>> tree chain and check the attributes of the functions..
>>>>>>
>>>>>> Look at init_cumulative_args in rs6000.c to see how CALL_LONG is set
>>>>>> based on the function attribute.
>>>>>
>>>>> I was able to get the function attribute from the init_cumulative_args
>>>>> function.  I have used the fndecl tree to get the attribute details
>>>>> but I have failed to stop generating br instruction. It should print
>>>>> bk instruction.
>>>>> I was unable to relate the super attribute from init_cumulative_args
>>>>> to the branch pattern in md file to generate bk instruction.
>>>>> I have intialized a global variable to 1 if super is detected and
>>>>> checking the same in my pattern.
>>>>>  My branch pattern looks like below
>>>>> (define_insn "call_int1"
>>>>>   [(call (mem (match_operand:SI 0 "call_insn_simple_operand" "ri"))
>>>>>          (match_operand:SI 1 "" "i"))
>>>>>   (clobber (reg:SI R_RS))]
>>>>>  ""
>>>>>   {
>>>>>     register rtx t = operands[0];
>>>>>     register rtx t2 = gen_rtx_REG (Pmode,
>>>>>                               GP_REG_FIRST + RETURN_ADDR_REGNUM);
>>>>>     if (GET_CODE (t) == SYMBOL_REF) {
>>>>>         if(super_var())             ---------------> Here I am
>>>>> checking for global variable
>>>>>         {
>>>>>         return "bk\tr1,8\;%#";
>>>>>         }
>>>>>         else {
>>>>>         gen_rtx_CLOBBER (VOIDmode, t2);
>>>>>         return "br\tr1,%0\;%#";
>>>>>
>>>>> I observed that init_cumulative_args is called first for all the
>>>>> functions once they are done then the above pattern for all the
>>>>> instructions are called so my global variable is not useful.
>>>>>
>>>>> Can you help me how to exactly emit bk instruction from the pattern
>>>>> when super function is called.
>>>>
>>>>
>>>> Again I just have to say: look at the rs6000 port.  Look at the rs6000
>>>> call instruction.  Look at how it decides whether to do a longcall or
>>>> not.
>>>>
>>>> Ian


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