[cfe-users] Linux C++ IR/ABI?

Matthew O'Connor thegreendragon at gmail.com
Tue Jun 30 09:55:05 PDT 2015


Hi all,

I have a question about why a couple of functions have their IR produced in
a certain way (by clang++ on Linux x86_64). I write:

class ptr {
  int *p;
};

void y(char, ptr a, ptr b, ptr c, ptr d, ptr e, ptr f, ptr g) {}

void z(char, int *a, int *b, int *c, int *d, int *e, int *f, int *g) {}

And run clang++ -std=c++11 ptr.cpp -S -emit-llvm

And get the following relevant pieces of IR:

%class.ptr = type { i32* }

define void @_Z1yc3ptrS_S_S_S_S_S_(i8 signext, i32* %a.coerce, i32*
%b.coerce, i32* %c.coerce, i32* %d.coerce, i32* %e.coerce, i64 %f.coerce,
i64 %g.coerce) {
  // ...
}

define void @_Z1zcPiS_S_S_S_S_S_(i8 signext, i32* %a, i32* %b, i32* %c,
i32* %d, i32* %e, i32* %f, i32* %g) {
  // ...
}

Why do the first few ptr arguments to y show up in the IR as i32*, but
later arguments show up as i64? But in z, all of the pointer arguments show
up with type i32*?

Thanks,
Matt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20150630/272d5258/attachment.html>


More information about the cfe-users mailing list