[llvm-commits] PATCH: Teach the InstVisitor to visit intrinsic CallInst subclasses

Chris Lattner clattner at apple.com
Mon Jul 30 16:37:29 PDT 2012


On Jul 30, 2012, at 2:25 PM, Chandler Carruth <chandlerc at gmail.com> wrote:

> Hello,
> 
> In looking at some InstVisitor-based code that handles common intrinsics similarly to instuctions, I see a common pattern of a big switch in them. This is what the visitor pattern was designed to factor out of user code.
> 
> We also have really nice helper classes that wrap CallInst for intrinsic calls. These are being ignored in the delegation hierarchy of the InstVisitor.
> 
> The attached patch fixes this by having the visitor specially delegate through CallInst instructions into specialized intrinsic visitors as appropriate. Historically, this used to be avoided because it necessitated a string lookup for the intrinsic, but today it's a simple switch.

LGTM!  Please update clients to use it as well,

-Chris




More information about the llvm-commits mailing list