From 62547267f088a060d7c1084a40d740645efe86d1 Mon Sep 17 00:00:00 2001 From: Jim Grosbach Date: Mon, 11 Oct 2010 18:51:51 +0000 Subject: [PATCH] More binary encoding stuff, taking advantage of the new "by name" operand matching in tblgen to do the predicate operand. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116213 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM/ARMInstrFormats.td | 7 ++++++ lib/Target/ARM/ARMInstrInfo.td | 42 +++++++++++++------------------ 2 files changed, 24 insertions(+), 25 deletions(-) diff --git a/lib/Target/ARM/ARMInstrFormats.td b/lib/Target/ARM/ARMInstrFormats.td index 263f151b2bf..bde70e5c950 100644 --- a/lib/Target/ARM/ARMInstrFormats.td +++ b/lib/Target/ARM/ARMInstrFormats.td @@ -241,6 +241,8 @@ class I pattern> : InstARM { + bits<4> p; + let Inst{31-28} = p; let OutOperandList = oops; let InOperandList = !con(iops, (ins pred:$p)); let AsmString = !strconcat(opc, "${p}", asm); @@ -270,6 +272,11 @@ class sI pattern> : InstARM { + bits<4> p; // Predicate operand + let Inst{31-28} = p; + // FIXME: The 's' operand needs to be handled, but the current generic + // get-value handlers don't know how to deal with it. + let OutOperandList = oops; let InOperandList = !con(iops, (ins pred:$p, cc_out:$s)); let AsmString = !strconcat(opc, "${p}${s}", asm); diff --git a/lib/Target/ARM/ARMInstrInfo.td b/lib/Target/ARM/ARMInstrInfo.td index 41c9cca90fb..2fda464d646 100644 --- a/lib/Target/ARM/ARMInstrInfo.td +++ b/lib/Target/ARM/ARMInstrInfo.td @@ -478,20 +478,18 @@ multiclass AsI1_bin_irs opcod, string opc, let Inst{25} = 1; } } - def rr : AsI1 { + def rr : AsI1 { bits<4> Rd; bits<4> Rn; bits<4> Rm; - bits<4> Cond; let Inst{11-4} = 0b00000000; let Inst{25} = 0; let isCommutable = Commutable; let Inst{3-0} = Rm; let Inst{15-12} = Rd; let Inst{19-16} = Rn; - let Inst{31-28} = Cond; } def rs : AsI1, Requires<[IsARM, HasV4T]> { - bits<4> Cond; let Inst{3-0} = 0b1110; let Inst{7-4} = 0b0001; let Inst{19-8} = 0b111111111111; let Inst{27-20} = 0b00010010; - let Inst{31-28} = Cond; } // ARMV4 only def MOVPCLR : AI<(outs), (ins), BrMiscFrm, IIC_Br, "mov", "\tpc, lr", [(ARMretflag)]>, Requires<[IsARM, NoV4T]> { - bits<4> Cond; let Inst{11-0} = 0b000000001110; let Inst{15-12} = 0b1111; let Inst{19-16} = 0b0000; let Inst{27-20} = 0b00011010; - let Inst{31-28} = Cond; } } @@ -942,27 +936,25 @@ let isBranch = 1, isTerminator = 1, isBarrier = 1, isIndirectBranch = 1 in { def BRIND : AXI<(outs), (ins GPR:$dst), BrMiscFrm, IIC_Br, "bx\t$dst", [(brind GPR:$dst)]>, Requires<[IsARM, HasV4T]> { - bits<4> Rm; - + bits<4> dst; let Inst{7-4} = 0b0001; let Inst{19-8} = 0b111111111111; let Inst{27-20} = 0b00010010; let Inst{31-28} = 0b1110; - let Inst{3-0} = Rm; + let Inst{3-0} = dst; } // ARMV4 only def MOVPCRX : AXI<(outs), (ins GPR:$dst), BrMiscFrm, IIC_Br, "mov\tpc, $dst", [(brind GPR:$dst)]>, Requires<[IsARM, NoV4T]> { - bits<4> Rm; - + bits<4> dst; let Inst{11-4} = 0b00000000; let Inst{15-12} = 0b1111; let Inst{19-16} = 0b0000; let Inst{27-20} = 0b00011010; let Inst{31-28} = 0b1110; - let Inst{3-0} = Rm; + let Inst{3-0} = dst; } } @@ -999,11 +991,11 @@ let isCall = 1, IIC_Br, "blx\t$func", [(ARMcall GPR:$func)]>, Requires<[IsARM, HasV5T, IsNotDarwin]> { - bits<4> Rm; + bits<4> func; let Inst{7-4} = 0b0011; let Inst{19-8} = 0b111111111111; let Inst{27-20} = 0b00010010; - let Inst{3-0} = Rm; + let Inst{3-0} = func; } // ARMv4T @@ -1513,26 +1505,26 @@ def STM_UPD : AXI4st<(outs GPR:$wb), (ins addrmode4:$addr, pred:$p, let neverHasSideEffects = 1 in def MOVr : AsI1<0b1101, (outs GPR:$dst), (ins GPR:$src), DPFrm, IIC_iMOVr, "mov", "\t$dst, $src", []>, UnaryDP { - bits<4> Rd; - bits<4> Rm; + bits<4> dst; + bits<4> src; let Inst{11-4} = 0b00000000; let Inst{25} = 0; - let Inst{3-0} = Rm; - let Inst{15-12} = Rd; + let Inst{3-0} = src; + let Inst{15-12} = dst; } // A version for the smaller set of tail call registers. let neverHasSideEffects = 1 in def MOVr_TC : AsI1<0b1101, (outs tcGPR:$dst), (ins tcGPR:$src), DPFrm, IIC_iMOVr, "mov", "\t$dst, $src", []>, UnaryDP { - bits<4> Rd; - bits<4> Rm; + bits<4> dst; + bits<4> src; let Inst{11-4} = 0b00000000; let Inst{25} = 0; - let Inst{3-0} = Rm; - let Inst{15-12} = Rd; + let Inst{3-0} = src; + let Inst{15-12} = dst; } def MOVs : AsI1<0b1101, (outs GPR:$dst), (ins so_reg:$src),