[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 01:49:26 PDT 2015

Assuming you use a x86_64, when you compile

extern void   f1( long x);
extern void   f2( void *x);

void   g( void)
    f1( 1848);
    f2( (void *) 1848);

it compiles into identical argument passing code

    mov	edi, 1848
    call	_f1
    mov	edi, 1848
    call	_f2

This would not happen on a 680x0, because integers are passed in Dx 
registers and pointers in Ax registers (if I remember correctly).

Is there a way to figure out, given two types, if they are both passed 
using the same register ? [^1]


[^1] It's given, that all preceeding argument types are known and same.

More information about the cfe-dev mailing list