Home > Back-end >  Function and transfer through the register or stack?
Function and transfer through the register or stack?

Time:04-04

Debug view assembly is through register

But "self-improvement" programmer "calling convention" says only use the stack, not to mention with register

Even the __cdecl library function, the call is through register, why? Should not be through the stack?

CodePudding user response:

Most of the calling convention is to use the stack, fastcall will use register but parameters, also can use the stack,

Although register operation is fast, but the number of registers is limited, and most of the register has its specific USES, when the parameters take up register, if not through the memory space to store, can't do the complex computation,,,,,,,

CodePudding user response:

Call a good variety of agreement, if necessary you can create a new rule,
That means what? No description language standard calling conventions,
Why don't you?
Because it is a variety of architectural difference is too big, the second is the hardware in the rapid development of evolution,

Historical materialism tells us that an information/documents by time constraints and limitations, it can't use determine the tone of the outlook for its future we now,

CodePudding user response:

X64 general-purpose registers inside much more than the original, will be enough, without white without ah,

Apple M1 and opened a new history, after the hardware will be more and more individual character, we will be more and more understand the charm of white space in the language specification,

CodePudding user response:

synaptic response: 1/f, reference
most of the calling convention is to use the stack, fastcall will use register but parameters, also can use the stack,

Although register operation is fast, but the number of registers is limited, and most of the register has its specific USES, when the parameters take up register, if not through the memory space to store, can't do the complex computation,,,,,,,


See the assembly, the actual or register, not by the calling conventions

CodePudding user response:

reference forever74 reply: 3/f
x64 general-purpose registers inside much more than the original, will be enough, without white without ah,

Apple M1 and opened a new history, after the hardware will be more and more individual character, we will be more and more understand the charm of white space in the language specification,


With register in interrupt? Use the stack somehow is saved to the memory of

Mainly, it is the the __cdecl such use the stack of calling convention, if not, you should not mark, not compilers are changed, the realization of the calling convention is the library, but the nominal __cdecl don't remove or replace? It's not reasonable!

Both 32-bit and 64 - bit version with register, don't know whether I tested the CPU model to do so
  • Related