Question: overloaded intrinsic

I am working on an implementation that needs to add a couple of overloaded intrinsics (based on pointer to different address spaces). I am creating a new myintrinsics.td file and using the iPTRAny for the argument type.

The current interface (i.e. getName() and getTyp() in Intrinsics.h) seems to require the caller to know which arguments are used for overloading, so to set Tys and numTys. This means I need to hardcode the intrinsic property in the caller, which makes the programming effort not scalable. Clang’s CGBuiltin.cpp seems to do exactly that and has quite a few x86 specific knowledge baked in.

I guess it is possible to provide an interface that, given an intrinsic ID, returns a list of argument numbers that are used for overloading. The information is all there in the .td file and TableGen could be taught to generate the code.

Anyone encountered such a problem before? Any existing workaround? What am I missing?

Thanks in advance.

– Yuan