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?
Cheers,
ES
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
Hi Tom,
each “X” has a unique bitpattern that should be assigned to the Inst.
e.g:
X1 = 0001
X2 = 0010
…
Imagine X as a predicate and Y as the Instruction Mnemonic.
If this is the answer to your question.