[llvm-commits] [PATCH] Configurable CallSiteBase

Gabor Greif gabor at mac.com
Tue Mar 30 02:34:53 PDT 2010


Hi all,

I'd like to put this patch to review. It pulls out some
functionality from CallSite into a template baseclass
CallSiteBase. CallSiteBase is highly customizable in the
type of the inputs and outputs (types), especially constness
variants. CallSite then chooses the fully non-const configuration.

CallSiteBase<> with all-default parameters implements the fully
const configuration. This is the preferred configuration for
analyses and predicates, because it prevents accidental mutation.
It is not yet settled how I should arrange the order of
CallSiteBase template parameters. Logically, those that are
frequently customized should go to the front, but I have no
data points yet, since all we use now is an all-or-nothing
regarding constness.

Some predicates of analyses already have been converted to
full-constness to demonstrate the concept. More to follow.

There is potential for pulling more methods into the base class,
I plan to do this as soon as need arises.

Notable omissions:
 - ProgrammersManual: document CallSiteBase
 - should we define a class ConstCallSite? (I see no gain ATM.)

CallSiteBase now provides three convenience features (some of
them are inherited by CallSite too) :
 - operator bool: this conversion allows to check whether we have
   a proper call site. Allows to eliminate an indentation level of
   "if" statements.
 - operator ->: gives back the payload as an instruction (InstrTy*)
 - constructor from ValueTy: this may supplant the static "get"
   method in the future (ATM it is implementer in terms of "get").
   Anyway, this constructor can be used in "if" statements to
   get rid of a free-standing wide-scope local binding.

Comments, suggestions welcome. I plan to commit this in 2-3 days.

Cheers,

	Gabor
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CallSiteBase.patch
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20100330/84ce3c6f/attachment.ksh>


More information about the llvm-commits mailing list