[llvm-dev] Matching instruction patterns from a FunctionPass
Félix Cloutier via llvm-dev
llvm-dev at lists.llvm.org
Sat Oct 24 09:45:27 PDT 2015
Looks like llvm/IR/PatternMatch.h is what I'm looking for.
Félix
> Le 23 oct. 2015 à 23:53:44, Félix Cloutier <felixcca at yahoo.ca> a écrit :
>
> Hi all,
>
> I'm working on a pass that would need to match a pattern of instructions. In pseudo-IR:
>
> %0 = sub %a, %b
> %1 = xor %a, %b
> %2 = xor %0, %a
> %3 = and %1, %2
>
> After this instruction sequence, %3's most significant bit tells whether the subtraction overflowed. I would like to find occurrences of this pattern from a FunctionPass.
>
> However, this has a couple of possible permutations. And and Xor are both commutative, meaning that there are 8 valid ways to express this. Since I might not be the first person to run into this kind of issue, I was wondering if there is a common way to handle this.
>
> Thanks!
>
> Félix
More information about the llvm-dev
mailing list