forked from llvm-mirror/llvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
11 changed files
with
317 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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: ) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
Oops, something went wrong.