-
Notifications
You must be signed in to change notification settings - Fork 11.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DPWBS-1149] feat(RegisterInfo): implement eliminateFrameIndex
Replace frame index operand with $a14 and immediate if offset does not exceed 16-bits. Otherwise, materialize the offset into a register and use an explicit ADDA_aaa $a14, %offset instruction. Replace the frame index with the result of this instruction and set the offset immediate to 0. add tests for eliminateFrameIndex add XFAIL test until we implement emitProlog/emitEpilogue
- Loading branch information
Showing
4 changed files
with
188 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# RUN: llc -mtriple=tricore -run-pass=prologepilog -verify-machineinstrs %s -o - | ||
# XFAIL: * | ||
|
||
# This will fail as long we as we don't implement emitProlog/Epilogue because | ||
# $a14 is not defined / declared as a live-in | ||
|
||
--- | | ||
%struct.bar = type { i32, i32 } | ||
|
||
define dso_local void @test_frame_index_elimination() { | ||
entry: | ||
%ptr0 = alloca [65536 x i32], align 4 | ||
%ptr1 = alloca [65536 x i32], align 4 | ||
%ptr2 = alloca %struct.bar, align 4 | ||
ret void | ||
} | ||
|
||
... | ||
--- | ||
name: test_frame_index_elimination | ||
legalized: true | ||
regBankSelected: true | ||
selected: true | ||
tracksRegLiveness: true | ||
stack: | ||
- { id: 0, name: ptr0, type: default, offset: 0, size: 262144, alignment: 4 } | ||
- { id: 1, name: ptr1, type: default, offset: 0, size: 262144, alignment: 4 } | ||
- { id: 2, name: ptr2, type: default, offset: 0, size: 8, alignment: 4 } | ||
body: | | ||
bb.0.entry: | ||
liveins: $d4 | ||
$a2 = LEA_aac %stack.0.ptr0, 0 | ||
$a3 = LEA_aac %stack.1.ptr1, 0 | ||
$a4 = LEA_aac %stack.2.ptr2, 0 | ||
STW_alcd %stack.0.ptr0, 0, $d4 | ||
STW_alcd %stack.1.ptr1, 0, $d4 | ||
STW_alcd %stack.2.ptr2, 0, killed $d4 | ||
$d2 = LDW_dalc %stack.0.ptr0, 0 | ||
$d3 = LDW_dalc %stack.1.ptr1, 0 | ||
$d4 = LDW_dalc %stack.2.ptr2, 0 | ||
... |
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,62 @@ | ||
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py | ||
# RUN: llc -mtriple=tricore -run-pass=prologepilog -verify-machineinstrs %s -o - | FileCheck %s | ||
|
||
--- | | ||
%struct.bar = type { i32, i32 } | ||
|
||
define dso_local void @test_frame_index_elimination() { | ||
entry: | ||
%ptr0 = alloca [65536 x i32], align 4 | ||
%ptr1 = alloca [65536 x i32], align 4 | ||
%ptr2 = alloca %struct.bar, align 4 | ||
ret void | ||
} | ||
|
||
... | ||
--- | ||
name: test_frame_index_elimination | ||
legalized: true | ||
regBankSelected: true | ||
selected: true | ||
tracksRegLiveness: true | ||
stack: | ||
- { id: 0, name: ptr0, type: default, offset: 0, size: 262144, alignment: 4 } | ||
- { id: 1, name: ptr1, type: default, offset: 0, size: 262144, alignment: 4 } | ||
- { id: 2, name: ptr2, type: default, offset: 0, size: 8, alignment: 4 } | ||
body: | | ||
bb.0.entry: | ||
; $a14 is needed as we are not implementing emitProlog/Epilogue yet. | ||
liveins: $a14, $d4 | ||
; CHECK-LABEL: name: test_frame_index_elimination | ||
; CHECK: id: 0, name: ptr0, type: default, offset: -262144, size: 262144 | ||
; CHECK: id: 1, name: ptr1, type: default, offset: -524288, size: 262144 | ||
; CHECK: id: 2, name: ptr2, type: default, offset: -524296, size: 8 | ||
; CHECK: liveins: $a14, $d4 | ||
; CHECK: $a15 = MOVHA_ac 4 | ||
; CHECK-NEXT: $a15 = LEA_aac $a15, 8 | ||
; CHECK-NEXT: $a15 = ADDA_aaa $a14, $a15 | ||
; CHECK-NEXT: $a2 = LEA_aac killed $a15, 0 | ||
; CHECK: $a3 = LEA_aac $a14, 8 | ||
; CHECK: $a4 = LEA_aac $a14, 0 | ||
; CHECK: $a15 = MOVHA_ac 4 | ||
; CHECK-NEXT: $a15 = LEA_aac $a15, 8 | ||
; CHECK-NEXT: $a15 = ADDA_aaa $a14, $a15 | ||
; CHECK-NEXT: STW_alcd killed $a15, 0, $d4 :: (store 4) | ||
; CHECK: STW_alcd $a14, 8, $d4 :: (store 4) | ||
; CHECK: STW_alcd $a14, 0, killed $d4 :: (store 4) | ||
; CHECK: $a15 = MOVHA_ac 4 | ||
; CHECK-NEXT: $a15 = LEA_aac $a15, 8 | ||
; CHECK-NEXT: $a15 = ADDA_aaa $a14, $a15 | ||
; CHECK-NEXT: $d2 = LDW_dalc killed $a15, 0 :: (load 4) | ||
; CHECK: $d3 = LDW_dalc $a14, 8 :: (load 4) | ||
; CHECK: $d4 = LDW_dalc $a14, 0 :: (load 4) | ||
$a2 = LEA_aac %stack.0.ptr0, 0 | ||
$a3 = LEA_aac %stack.1.ptr1, 0 | ||
$a4 = LEA_aac %stack.2.ptr2, 0 | ||
STW_alcd %stack.0.ptr0, 0, $d4 :: (store 4) | ||
STW_alcd %stack.1.ptr1, 0, $d4 :: (store 4) | ||
STW_alcd %stack.2.ptr2, 0, killed $d4 :: (store 4) | ||
$d2 = LDW_dalc %stack.0.ptr0, 0 :: (load 4) | ||
$d3 = LDW_dalc %stack.1.ptr1, 0 :: (load 4) | ||
$d4 = LDW_dalc %stack.2.ptr2, 0 :: (load 4) | ||
... |