[LLVMdev] predicates and Requires
Jim Grosbach
grosbach at apple.com
Wed May 16 18:35:49 PDT 2012
On May 16, 2012, at 6:24 PM, reed kotler <rkotler at mips.com> wrote:
> Well, Requires is just a fancy way to add predicates.
>
> For mips16 and micro mips, we want to use them in a similar way as ARM
> does, I think, to how they
> are used for thumb and thumb2.
>
> The problem lies with tablegen.
>
> Whenever predicates are overriden by a derived class, it overwrites the
> previous definition.
>
> There is no way, it seems, to add to an existing list as you further
> derive classes.
>
> So for example, for mips we would want to have several predicates for
> the output format
> of instructions, i.e. (standard, mips16, micromips)
>
> But if we have such predicates in a base class, then if some later class
> wants to add additional ones,
> then they have to list the ones from the base class again.
>
> This seems to be very error prone.
>
> Is there some basic convention that the ARM port uses to keep all of
> this straight?
Nothing formalized. In practice, we put a simple sub target feature predicate on the high level bases classes for the normal Thumb vs ARM vs Thumb2 stuff. For anything that's more complicated, like requiring a specific version of the ISA, they use a Requres<> on the actual instruction definition so it's at least obvious where the override is happening. Other than that, the main convention is lots of testing.
-j
More information about the llvm-dev
mailing list