[cfe-dev] Figuring out if parameter types are passed in same register

Nat! via cfe-dev cfe-dev at lists.llvm.org
Mon Sep 14 03:19:20 PDT 2015

mats petersson wrote:
> I'm assuming you are looking to "not reload edi", but that's not going
> to work if f1 or f2 makes any call that takes an argument [or edi is
> used for something else in the function!].

Actually no. In my case [^1] there is a trampoline function hidden 
between g and f and I would like to figure out, which kind of types I 
can pass transparently on the ABI/architecture.

So it would be more akin to

void  f1( int x)

void  call( void (*f)( void *), void *arg)
    (f)( arg);

void  g()
    call( (void (*)( void *)) f1, (void *) 1848);

This would work on x86_64, but fail on 680x0 AFAIK.

To elaborate a bit more, if the parameters are passed on the stack, then 
trivially types of different size are bound to fail, thats why I am 
looking at registers only.

Thanks for the response.


[^1] For the big picture view :) 
I am currently doing "A more formal definition of the mulle-objc meta 
call convention" point 2.

More information about the cfe-dev mailing list