[llvm-commits] [llvm] r137892 - in /llvm/trunk/lib/Target/Mips: MipsISelLowering.cpp MipsInstrFormats.td MipsInstrInfo.td

Akira Hatanaka ahatanak at gmail.com
Wed Aug 17 16:39:41 PDT 2011


I am not sure if I got your point.

Definition of INS:
INS (outs CPURegs:$rt), (ins CPURegs:$rs, uimm16:$pos, uimm16:$size,
CPURegs:$src);

This is the output of "tblgen Mips.td":
def INS {       // Instruction MipsInst FR ExtIns
  field bits<32> Inst = { 0, 1, 1, 1, 1, 1, src{4}, src{3}, src{2},
src{1}, src{0}, rt{4}, rt{3}, rt{2}, rt{1}, rt{0}, size{4}, size{3},
size{2}, size{1}, size{0}, pos{4}, pos{3}, pos{2}, pos{1}, pos{0}, 0,
0, 0, 1, 0, 0 };
...
  bits<5> rd = { size{4}, size{3}, size{2}, size{1}, size{0} };
  bits<5> rs = { src{4}, src{3}, src{2}, src{1}, src{0} };
  bits<5> rt = { ?, ?, ?, ?, ? };
  bits<5> shamt = { pos{4}, pos{3}, pos{2}, pos{1}, pos{0} };
  bits<6> funct = { ExtIns:_funct{5}, ExtIns:_funct{4},
ExtIns:_funct{3}, ExtIns:_funct{2},   ExtIns:_funct{1},
ExtIns:_funct{0} };
  bits<5> src = { ?, ?, ?, ?, ? };
  bits<5> pos = { ?, ?, ?, ?, ? };
  bits<5> size = { ?, ?, ?, ?, ? };

CPURegs:$rs is bound to "bits<5> src", which in turn is bound to bits<5> rs.
Is this a problem? If it is, I am not sure how to fix this.

On Wed, Aug 17, 2011 at 4:28 PM, Bruno Cardoso Lopes
<bruno.cardoso at gmail.com> wrote:
>> src has nothing to do with the fifth operand of INS. It is the bit
>> field newly defined in class ExtIns ( bits<5> src), which gets bound
>> to field rs defined in class FR.
>
> This is exactly why I'm asking. "bits<5> src" gets bounded to "rs",
> but "CPURegs:$rs" is also getting bounded to it. There's something
> wrong here, cause why would you wanna bind another field to "rs" if
> you already have CPURegs:$rs? Got it?
>
> +def INS : ExtIns<4, "ins",
> +                 (ins CPURegs:$rs, uimm16:$pos, uimm16:$size, CPURegs:$src),
> +                 [(set CPURegs:$rt,
> +                   (MipsIns CPURegs:$rs, immZExt5:$pos, immZExt5:$size,
> +                    CPURegs:$src))],
> +                 NoItinerary>;
>
>
> --
> Bruno Cardoso Lopes
> http://www.brunocardoso.cc
>




More information about the llvm-commits mailing list