From: Jim Grosbach Date: Wed, 13 Jul 2011 22:59:38 +0000 (+0000) Subject: ARM Assembler support for DBG instruction. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=6f9f8845028d4d3b96c33417398034a71137d867;p=oota-llvm.git ARM Assembler support for DBG instruction. Add range checking and testing for parsing and encoding of DBG instruction. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135102 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/ARM/ARMInstrInfo.td b/lib/Target/ARM/ARMInstrInfo.td index 050fd9808e2..437f964a5cd 100644 --- a/lib/Target/ARM/ARMInstrInfo.td +++ b/lib/Target/ARM/ARMInstrInfo.td @@ -1283,9 +1283,8 @@ def SETEND : AXI<(outs),(ins setend_op:$end), MiscFrm, NoItinerary, let Inst{8-0} = 0; } -def DBG : AI<(outs), (ins i32imm:$opt), MiscFrm, NoItinerary, "dbg", "\t$opt", - [/* For disassembly only; pattern left blank */]>, - Requires<[IsARM, HasV7]> { +def DBG : AI<(outs), (ins imm0_15:$opt), MiscFrm, NoItinerary, "dbg", "\t$opt", + []>, Requires<[IsARM, HasV7]> { bits<4> opt; let Inst{27-4} = 0b001100100000111100001111; let Inst{3-0} = opt; diff --git a/lib/Target/ARM/ARMInstrThumb2.td b/lib/Target/ARM/ARMInstrThumb2.td index 68fc69d0d7f..eeee0418d8e 100644 --- a/lib/Target/ARM/ARMInstrThumb2.td +++ b/lib/Target/ARM/ARMInstrThumb2.td @@ -3157,8 +3157,7 @@ def t2WFE : T2I_hint<0b00000010, "wfe", ".w">; def t2WFI : T2I_hint<0b00000011, "wfi", ".w">; def t2SEV : T2I_hint<0b00000100, "sev", ".w">; -def t2DBG : T2I<(outs),(ins i32imm:$opt), NoItinerary, "dbg", "\t$opt", - [/* For disassembly only; pattern left blank */]> { +def t2DBG : T2I<(outs), (ins imm0_15:$opt), NoItinerary, "dbg", "\t$opt", []> { let Inst{31-20} = 0xf3a; let Inst{15-14} = 0b10; let Inst{12} = 0; diff --git a/test/MC/ARM/basic-arm-instructions.s b/test/MC/ARM/basic-arm-instructions.s index 3708ec533f0..f2d5f7f57c7 100644 --- a/test/MC/ARM/basic-arm-instructions.s +++ b/test/MC/ARM/basic-arm-instructions.s @@ -448,3 +448,13 @@ _func: @ CHECK: cmp r7, r8, ror r2 @ encoding: [0x78,0x02,0x57,0xe1] @ CHECK: cmp r1, r6, rrx @ encoding: [0x66,0x00,0x51,0xe1] +@------------------------------------------------------------------------------ +@ DBG +@------------------------------------------------------------------------------ + dbg #0 + dbg #5 + dbg #15 + +@ CHECK: dbg #0 @ encoding: [0xf0,0xf0,0x20,0xe3] +@ CHECK: dbg #5 @ encoding: [0xf5,0xf0,0x20,0xe3] +@ CHECK: dbg #15 @ encoding: [0xff,0xf0,0x20,0xe3] diff --git a/test/MC/ARM/diagnostics.s b/test/MC/ARM/diagnostics.s index 4069fea509d..a173cdbf4ff 100644 --- a/test/MC/ARM/diagnostics.s +++ b/test/MC/ARM/diagnostics.s @@ -59,3 +59,12 @@ @ CHECK-ERRORS: error: invalid operand for instruction @ CHECK-ERRORS: error: invalid operand for instruction @ CHECK-ERRORS: error: invalid operand for instruction + + @ Out of range immediates for DBG + dbg #-1 + dbg #16 + +@ CHECK-ERRORS: error: invalid operand for instruction +@ CHECK-ERRORS: error: invalid operand for instruction +@ Double-check that we're synced up with the right diagnostics. +@ CHECK-ERRORS: dbg #16