mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-05 13:26:55 +00:00
ARM IAS: support .inst directive
This adds support for the .inst directive. This is an ARM specific directive to indicate an instruction encoded as a constant expression. The major difference between .word, .short, or .byte and .inst is that the latter will be disassembled as an instruction since it does not get flagged as data. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197657 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
15
test/MC/ARM/inst-arm-suffixes.s
Normal file
15
test/MC/ARM/inst-arm-suffixes.s
Normal file
@@ -0,0 +1,15 @@
|
||||
@ RUN: not llvm-mc %s -triple armv7-linux-gnueabi -filetype asm -o - 2>&1 \
|
||||
@ RUN: | FileCheck -check-prefix CHECK-ERROR %s
|
||||
|
||||
.syntax unified
|
||||
.arm
|
||||
|
||||
.align 2
|
||||
.global suffixes_invalid_in_arm
|
||||
.type suffixes_invalid_in_arm,%function
|
||||
suffixes_invalid_in_arm:
|
||||
.inst.n 2
|
||||
@ CHECK-ERROR: width suffixes are invalid in ARM mode
|
||||
.inst.w 4
|
||||
@ CHECK-ERROR: width suffixes are invalid in ARM mode
|
||||
|
15
test/MC/ARM/inst-constant-required.s
Normal file
15
test/MC/ARM/inst-constant-required.s
Normal file
@@ -0,0 +1,15 @@
|
||||
@ RUN: not llvm-mc %s -triple=armv7-linux-gnueabi -filetype asm -o - 2>&1 \
|
||||
@ RUN: | FileCheck -check-prefix CHECK-ERROR %s
|
||||
|
||||
.syntax unified
|
||||
.arm
|
||||
|
||||
.align 2
|
||||
.global constant_expression_required
|
||||
.type constant_expression_required,%function
|
||||
constant_expression_required:
|
||||
.Label:
|
||||
movs r0, r0
|
||||
.inst .Label
|
||||
@ CHECK-ERROR: expected constant expression
|
||||
|
20
test/MC/ARM/inst-directive-emit.s
Normal file
20
test/MC/ARM/inst-directive-emit.s
Normal file
@@ -0,0 +1,20 @@
|
||||
@ RUN: llvm-mc %s -triple armv7-linux-gnueabi -filetype asm -o - | FileCheck %s
|
||||
|
||||
.syntax unified
|
||||
.thumb
|
||||
|
||||
.align 2
|
||||
.global emit_asm
|
||||
.type emit_asm,%function
|
||||
emit_asm:
|
||||
.inst.w 0xf2400000, 0xf2c00000
|
||||
|
||||
@ CHECK: .text
|
||||
@ CHECK: .code 16
|
||||
@ CHECK: .align 2
|
||||
@ CHECK: .globl emit_asm
|
||||
@ CHECK: .type emit_asm,%function
|
||||
@ CHECK: emit_asm:
|
||||
@ CHECK: inst.w 0xF2400000
|
||||
@ CHECK: inst.w 0xF2C00000
|
||||
|
81
test/MC/ARM/inst-directive.s
Normal file
81
test/MC/ARM/inst-directive.s
Normal file
@@ -0,0 +1,81 @@
|
||||
@ RUN: llvm-mc %s -triple=armv7-linux-gnueabi -filetype=obj -o - \
|
||||
@ RUN: | llvm-readobj -s -sd | FileCheck %s
|
||||
|
||||
.syntax unified
|
||||
|
||||
@-------------------------------------------------------------------------------
|
||||
@ arm_inst
|
||||
@-------------------------------------------------------------------------------
|
||||
.arm
|
||||
|
||||
.section .inst.arm_inst
|
||||
|
||||
.align 2
|
||||
.global arm_inst
|
||||
.type arm_inst,%function
|
||||
arm_inst:
|
||||
.inst 0xdefe
|
||||
|
||||
@ CHECK: Section {
|
||||
@ CHECK: Name: .inst.arm_inst
|
||||
@ CHECK: SectionData (
|
||||
@ CHECK-NEXT: 0000: FEDE0000
|
||||
@ CHECK-NEXT: )
|
||||
|
||||
@-------------------------------------------------------------------------------
|
||||
@ thumb_inst_n
|
||||
@-------------------------------------------------------------------------------
|
||||
.thumb
|
||||
|
||||
.section .inst.thumb_inst_n
|
||||
|
||||
.align 2
|
||||
.global thumb_inst_n
|
||||
.type thumb_inst_n,%function
|
||||
thumb_inst_n:
|
||||
.inst.n 0xdefe
|
||||
|
||||
@ CHECK: Section {
|
||||
@ CHECK: Name: .inst.thumb_inst_n
|
||||
@ CHECK: SectionData (
|
||||
@ CHECK-NEXT: 0000: FEDE
|
||||
@ CHECK-NEXT: )
|
||||
|
||||
@-------------------------------------------------------------------------------
|
||||
@ thumb_inst_w
|
||||
@-------------------------------------------------------------------------------
|
||||
.thumb
|
||||
|
||||
.section .inst.thumb_inst_w
|
||||
|
||||
.align 2
|
||||
.global thumb_inst_w
|
||||
.type thumb_inst_w,%function
|
||||
thumb_inst_w:
|
||||
.inst.w 0x00000000
|
||||
|
||||
@ CHECK: Section {
|
||||
@ CHECK: Name: .inst.thumb_inst_w
|
||||
@ CHECK: SectionData (
|
||||
@ CHECK-NEXT: 0000: 00000000
|
||||
@ CHECK-NEXT: )
|
||||
|
||||
@-------------------------------------------------------------------------------
|
||||
@ thumb_inst_w
|
||||
@-------------------------------------------------------------------------------
|
||||
.thumb
|
||||
|
||||
.section .inst.thumb_inst_inst
|
||||
|
||||
.align 2
|
||||
.global thumb_inst_inst
|
||||
.type thumb_inst_inst,%function
|
||||
thumb_inst_inst:
|
||||
.inst.w 0xf2400000, 0xf2c00000
|
||||
|
||||
@ CHECK: Section {
|
||||
@ CHECK: Name: .inst.thumb_inst_inst
|
||||
@ CHECK: SectionData (
|
||||
@ CHECK-NEXT: 0000: 40F20000 C0F20000
|
||||
@ CHECK-NEXT: )
|
||||
|
14
test/MC/ARM/inst-overflow.s
Normal file
14
test/MC/ARM/inst-overflow.s
Normal file
@@ -0,0 +1,14 @@
|
||||
@ RUN: not llvm-mc %s -triple armv7-linux-gnueabi -filetype asm -o - 2>&1 \
|
||||
@ RUN: | FileCheck -check-prefix CHECK-ERROR %s
|
||||
|
||||
.syntax unified
|
||||
.arm
|
||||
|
||||
.align 2
|
||||
.global constant_overflow
|
||||
.type constant_overflow,%function
|
||||
constant_overflow:
|
||||
.inst 1 << 32
|
||||
@ CHECK-ERROR: inst operand is too big
|
||||
|
||||
|
13
test/MC/ARM/inst-thumb-overflow-2.s
Normal file
13
test/MC/ARM/inst-thumb-overflow-2.s
Normal file
@@ -0,0 +1,13 @@
|
||||
@ RUN: not llvm-mc %s -triple armv7-linux-gnueabi -filetype asm -o - 2>&1 \
|
||||
@ RUN: | FileCheck -check-prefix CHECK-ERRORS %s
|
||||
|
||||
.syntax unified
|
||||
.thumb
|
||||
|
||||
.align 2
|
||||
.global constant_overflow
|
||||
.type constant_overflow,%function
|
||||
constant_overflow:
|
||||
.inst.w 1 << 32
|
||||
@ CHECK-ERRORS: inst.w operand is too big
|
||||
|
13
test/MC/ARM/inst-thumb-overflow.s
Normal file
13
test/MC/ARM/inst-thumb-overflow.s
Normal file
@@ -0,0 +1,13 @@
|
||||
@ RUN: not llvm-mc %s -triple armv7-linux-gnueabi -filetype asm -o - 2>&1 \
|
||||
@ RUN: | FileCheck -check-prefix CHECK-ERROR %s
|
||||
|
||||
.syntax unified
|
||||
.thumb
|
||||
|
||||
.align 2
|
||||
.global constant_overflow
|
||||
.type constant_overflow,%function
|
||||
constant_overflow:
|
||||
.inst.n 1 << 31
|
||||
@ CHECK-ERROR: inst.n operand is too big, use inst.w instead
|
||||
|
13
test/MC/ARM/inst-thumb-suffixes.s
Normal file
13
test/MC/ARM/inst-thumb-suffixes.s
Normal file
@@ -0,0 +1,13 @@
|
||||
@ RUN: not llvm-mc %s -triple armv7-linux-gnueabi -filetype asm -o - 2>&1 \
|
||||
@ RUN: | FileCheck -check-prefix CHECK-ERROR %s
|
||||
|
||||
.syntax unified
|
||||
.thumb
|
||||
|
||||
.align 2
|
||||
.global suffixes_required_in_thumb
|
||||
.type suffixes_required_in_thumb,%function
|
||||
suffixes_required_in_thumb:
|
||||
.inst 0x0000
|
||||
@ CHECK-ERROR: cannot determine Thumb instruction size, use inst.n/inst.w instead
|
||||
|
Reference in New Issue
Block a user