gcc - C tail call optimization for boolean AND -


Does GCC perform tail call optimization on the following function?

  bool isEqual (node ​​* Head1, node * head 2) {if (head1 == weaken = head 2 == faucet) return head 1 == tap & amp; Head2 == faucet; Return Head 1- & gt; Data == Head 2- & gt; Data & amp; Amp; IsEqual (head1-> Next, head2-> Next); }  

Yes, at least this is the way I compiled it. RDI, RDI Sete DL Test RSI, RSI Set CL mov eax, ECX or AL, DL jne .L2 MOV: assembly code for that function

  isEqual (node ​​*, node *) was EDX , DWORD PTR [RSI + 8] CMP DWORD PTR [RDI + 8], EDX JE .L5 Representative retired .L2: mov eax, ECX and eax retired EDX .5: mov RDI, QWORD PTR [RDI] mov RSI, QWORD PTR [RSI] testing RDI, RDI Sette DL test RSI, RSI Sette CL mov eax, ECX or AL, DL jne .L2 mov ECX, DWORD PTR [RSI + 8] CMP DW ORD PTR [RDI + 8], ECX JE L5 representative retired  

This is the reason that there is clearly a loop, and no nested calls appear.

You should verify whether this is your compilation option with your version of GCC as well as on your platform.


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

javascript - amcharts makechart not working -

java - Algorithm negotiation fail SSH in Jenkins -