mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
bbf5be9d55
This adds infrastructure to print and parse MIR MachineOperand comments. The motivation for the ARM backend is to print condition code names instead of magic constants that are difficult to read (for human beings). For example, instead of this: dead renamable $r2, $cpsr = tEOR killed renamable $r2, renamable $r1, 14, $noreg t2Bcc %bb.4, 0, killed $cpsr we now print this: dead renamable $r2, $cpsr = tEOR killed renamable $r2, renamable $r1, 14 /* CC::always */, $noreg t2Bcc %bb.4, 0 /* CC:eq */, killed $cpsr This shows that MachineOperand comments are enclosed between /* and */. In this example, the EOR instruction is not conditionally executed (i.e. it is "always executed"), which is encoded by the 14 immediate machine operand. Thus, now this machine operand has /* CC::always */ as a comment. The 0 on the next conditional branch instruction represents the equal condition code, thus now this operand has /* CC:eq */ as a comment. As it is a comment, the MI lexer/parser completely ignores it. The benefit is that this keeps the change in the lexer extremely minimal and no target specific parsing needs to be done. The changes on the MIPrinter side are also minimal, as there is only one target hooks that is used to create the machine operand comments. Differential Revision: https://reviews.llvm.org/D74306
44 lines
1.8 KiB
YAML
44 lines
1.8 KiB
YAML
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
|
|
# RUN: llc -run-pass arm-ldst-opt -verify-machineinstrs %s -o - | FileCheck %s
|
|
# ARM load store optimizer was dealing with a sequence like:
|
|
# s1 = VLDRS [r0, 1], implicit-def Q0
|
|
# s3 = VLDRS [r0, 2], implicit killed Q0, implicit-def Q0
|
|
# s0 = VLDRS [r0, 0], implicit killed Q0, implicit-def Q0
|
|
# s2 = VLDRS [r0, 4], implicit killed Q0, implicit-def Q0
|
|
#
|
|
# It decided to combine the {s0, s1} loads into a single instruction in the
|
|
# third position. However, this leaves the instruction defining s3 with a stray
|
|
# imp-use of Q0, which is undefined.
|
|
#
|
|
# The verifier catches this, so this test just makes sure that appropriate
|
|
# liveness flags are added.
|
|
--- |
|
|
target triple = "thumbv7-apple-ios"
|
|
define arm_aapcs_vfpcc <4 x float> @foo(float* %ptr) {
|
|
ret <4 x float> undef
|
|
}
|
|
...
|
|
---
|
|
name: foo
|
|
alignment: 2
|
|
liveins:
|
|
- { reg: '$r0' }
|
|
body: |
|
|
bb.0 (%ir-block.0):
|
|
liveins: $r0
|
|
|
|
; CHECK-LABEL: name: foo
|
|
; CHECK: $s3 = VLDRS $r0, 2, 14 /* CC::al */, $noreg, implicit killed undef $q0, implicit-def $q0 :: (load 4)
|
|
; CHECK: VLDMSIA $r0, 14 /* CC::al */, $noreg, def $s0, def $s1, implicit-def $noreg :: (load 4)
|
|
; CHECK: $s2 = VLDRS killed $r0, 4, 14 /* CC::al */, $noreg, implicit killed $q0, implicit-def $q0 :: (load 4)
|
|
; CHECK: tBX_RET 14 /* CC::al */, $noreg, implicit $q0
|
|
$s1 = VLDRS $r0, 1, 14, $noreg, implicit-def $q0 :: (load 4)
|
|
$s3 = VLDRS $r0, 2, 14, $noreg, implicit killed $q0, implicit-def $q0 :: (load 4)
|
|
|
|
$s0 = VLDRS $r0, 0, 14, $noreg, implicit killed $q0, implicit-def $q0 :: (load 4)
|
|
|
|
$s2 = VLDRS killed $r0, 4, 14, $noreg, implicit killed $q0, implicit-def $q0 :: (load 4)
|
|
|
|
tBX_RET 14, $noreg, implicit $q0
|
|
...
|