[LLVMdev] encoding scaled values

Steve King steve at metrokings.com
Thu Sep 25 15:18:06 PDT 2014


On further investigation, a tblgen bug prevents the td file solution
from working.  The auto-generated encoding is fine, but the decoder
properly shifts only if the value consists of more than one Inst{}
field.   An easy patch fixes this and now encode/decode work fine
without custom methods.  I'll submit the tblgen patch.

On Thu, Sep 25, 2014 at 11:16 AM, Steve King <steve at metrokings.com> wrote:
> Hello LLVM,
> I have a value that is encoded as that value shifted right by 2.  I
> can see two ways to do this.
> First way using the tblgen definition for this instruction, something like this:
>
> bits<10> Value;
> Inst{7-0} = Value{9-2};  // 2-bit effective downshift
>
> Second way with custom EncoderMethod and DecoderMethods specified on
> the operand.
>
> Which way is best?
>
> Thanks,
> -steve



More information about the llvm-dev mailing list