[llvm-dev] Accessing TableGen defined variable in the cpp code
Tom Stellard via llvm-dev
llvm-dev at lists.llvm.org
Thu Nov 26 07:15:37 PST 2015
On Thu, Nov 26, 2015 at 03:57:42PM +0100, Sky Flyer via llvm-dev wrote:
> Hello all,
>
> I would like to assign some bits in the instructions, based on the order of
> mnemonics that appear in a special order. I can do it in TableGen itself,
> but it will not be well maintainable based on the things I want to
> accomplish.
>
> Therefor, I would like to do it in the c++ file which is waaay easier (at
> least in the concept!!).
>
> Imagine I have this in my base class in TableGen:
>
>
> *bits<4> bitpattern = 0;*
> *let Inst{10-7} = bitpattern;*
>
> Then, at the moment that I am parsing the instruction, I would like to
> assign a value to "bitpattern" variable!
> for example:
>
> ->ParseInstruction(...)
> if (Mnemonic == "X")
> Mnemonic = getLexer().getTok().getString();
> if (Mnemonic == "Y")
> *** let bitpattern = 0b1010" ** // How can I do this?*
>
>
> How can I do this? Is it possible?
>
One thing you might be able to do is add 'bitpattern' as an instruction operand.
Does each instruction always have the same bitpattern?
-Tom
> Cheers,
> ES
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
More information about the llvm-dev
mailing list