[llvm] r197913 - ARM: bkpt has an implicit immediate constant 0

Saleem Abdulrasool compnerd at compnerd.org
Mon Dec 23 09:23:58 PST 2013


Author: compnerd
Date: Mon Dec 23 11:23:58 2013
New Revision: 197913

URL: http://llvm.org/viewvc/llvm-project?rev=197913&view=rev
Log:
ARM: bkpt has an implicit immediate constant 0

The bkpt mnemonic has an implicit immediate constant of 0 unless otherwise
specified.  Add an instruction alias for the unvalued breakpoint mnemonic to
treat it as a 0.  This improves compatibility with GNU AS.

Signed-off-by: Saleem Abdulrasool <compnerd at compnerd.org>

Added:
    llvm/trunk/test/MC/ARM/bkpt.s
Modified:
    llvm/trunk/lib/Target/ARM/ARMInstrInfo.td
    llvm/trunk/lib/Target/ARM/ARMInstrThumb.td

Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.td?rev=197913&r1=197912&r2=197913&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMInstrInfo.td (original)
+++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.td Mon Dec 23 11:23:58 2013
@@ -1725,6 +1725,8 @@ def BKPT : AInoP<(outs), (ins imm0_65535
   let Inst{31-28} = 0xe; // AL
   let Inst{7-4} = 0b0111;
 }
+// default immediate for breakpoint mnemonic
+def : InstAlias<"bkpt", (BKPT 0)>, Requires<[IsARM]>;
 
 def HLT : AInoP<(outs), (ins imm0_65535:$val), MiscFrm, NoItinerary,
                  "hlt", "\t$val", []>, Requires<[IsARM, HasV8]> {

Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb.td?rev=197913&r1=197912&r2=197913&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMInstrThumb.td (original)
+++ llvm/trunk/lib/Target/ARM/ARMInstrThumb.td Mon Dec 23 11:23:58 2013
@@ -300,6 +300,8 @@ def tBKPT : T1I<(outs), (ins imm0_255:$v
   bits<8> val;
   let Inst{7-0} = val;
 }
+// default immediate for breakpoint mnemonic
+def : InstAlias<"bkpt", (tBKPT 0)>, Requires<[IsThumb]>;
 
 def tHLT : T1I<(outs), (ins imm0_63:$val), NoItinerary, "hlt\t$val",
                 []>, T1Encoding<0b101110>, Requires<[IsThumb, HasV8]> {

Added: llvm/trunk/test/MC/ARM/bkpt.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/bkpt.s?rev=197913&view=auto
==============================================================================
--- llvm/trunk/test/MC/ARM/bkpt.s (added)
+++ llvm/trunk/test/MC/ARM/bkpt.s Mon Dec 23 11:23:58 2013
@@ -0,0 +1,32 @@
+@ RUN: llvm-mc -triple armv7-unknown-unknown -filetype asm -o - %s | FileCheck %s
+
+	.syntax unified
+	.thumb
+
+	.global thumb_default_bkpt
+	.type thumb_default_bkpt, %function
+	.thumb_func
+thumb_default_bkpt:
+	bkpt
+
+@ CHECK-LABEL: thumb_default_bkpt
+@ CHECK: bkpt #0
+
+	.global normal_bkpt
+	.type normal_bkpt, %function
+normal_bkpt:
+	bkpt #42
+
+@ CHECK-LABEL: normal_bkpt
+@ CHECK: bkpt #42
+
+	.arm
+
+	.global arm_default_bkpt
+	.type arm_default_bkpt, %function
+arm_default_bkpt:
+	bkpt
+
+@ CEHCK-LABEL: arm_default_bkpt
+@ CHECK: bkpt #0
+





More information about the llvm-commits mailing list