diff options
author | Evan Cheng <evan.cheng@apple.com> | 2009-07-09 23:43:36 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2009-07-09 23:43:36 +0000 |
commit | b8d0743fecd1f44323524e60e3aadc835f95755d (patch) | |
tree | 2a2a87373b52221e177f78a7b243d690ab8b6ce6 /lib/Target | |
parent | e8c3da9e64cffdc3b06832eef97b175561146cd0 (diff) | |
download | external_llvm-b8d0743fecd1f44323524e60e3aadc835f95755d.zip external_llvm-b8d0743fecd1f44323524e60e3aadc835f95755d.tar.gz external_llvm-b8d0743fecd1f44323524e60e3aadc835f95755d.tar.bz2 |
Added Thumb IT instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75198 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
-rw-r--r-- | lib/Target/ARM/ARMInstrThumb.td | 9 | ||||
-rw-r--r-- | lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp | 16 |
2 files changed, 25 insertions, 0 deletions
diff --git a/lib/Target/ARM/ARMInstrThumb.td b/lib/Target/ARM/ARMInstrThumb.td index fb7453a..5642710 100644 --- a/lib/Target/ARM/ARMInstrThumb.td +++ b/lib/Target/ARM/ARMInstrThumb.td @@ -66,6 +66,11 @@ def thumb_immshifted_shamt : SDNodeXForm<imm, [{ return CurDAG->getTargetConstant(V, MVT::i32); }]>; +// IT block condition mask +def it_mask : Operand<i32> { + let PrintMethod = "printThumbITMask"; +} + // Define Thumb specific addressing modes. // t_addrmode_rr := reg + reg @@ -207,6 +212,10 @@ let isBranch = 1, isTerminator = 1 in def tBcc : T1I<(outs), (ins brtarget:$target, pred:$cc), "b$cc $target", [/*(ARMbrcond bb:$target, imm:$cc)*/]>; +// IT block +def tIT : TI<(outs), (ins pred:$cc, it_mask:$mask), + "it$mask $cc", []>; + //===----------------------------------------------------------------------===// // Load Store Instructions. // diff --git a/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp b/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp index 6844c6d..5559a5e 100644 --- a/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp +++ b/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp @@ -111,6 +111,7 @@ namespace { const char *Modifier = 0); void printBitfieldInvMaskImmOperand (const MachineInstr *MI, int OpNum); + void printThumbITMask(const MachineInstr *MI, int OpNum); void printThumbAddrModeRROperand(const MachineInstr *MI, int OpNum); void printThumbAddrModeRI5Operand(const MachineInstr *MI, int OpNum, unsigned Scale); @@ -636,6 +637,21 @@ ARMAsmPrinter::printBitfieldInvMaskImmOperand(const MachineInstr *MI, int Op) { //===--------------------------------------------------------------------===// void +ARMAsmPrinter::printThumbITMask(const MachineInstr *MI, int Op) { + // (3 - the number of trailing zeros) is the number of then / else. + unsigned Mask = MI->getOperand(Op).getImm(); + unsigned NumTZ = CountTrailingZeros_32(Mask); + assert(NumTZ <= 3 && "Invalid IT mask!"); + for (unsigned Pos = 3, e = NumTZ; Pos >= e; --Pos) { + bool T = (Mask & (1 << Pos)) != 0; + if (T) + O << 't'; + else + O << 'e'; + } +} + +void ARMAsmPrinter::printThumbAddrModeRROperand(const MachineInstr *MI, int Op) { const MachineOperand &MO1 = MI->getOperand(Op); const MachineOperand &MO2 = MI->getOperand(Op+1); |