Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
llvm-epi-0.8
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Roger Ferrer
llvm-epi-0.8
Commits
572756ac
Commit
572756ac
authored
14 years ago
by
Evan Cheng
Browse files
Options
Downloads
Patches
Plain Diff
Spill R4 if it's going to be used to restore SP from FP.
llvm-svn: 123567
parent
ea7131a0
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
llvm/lib/Target/ARM/ARMFrameLowering.cpp
+12
-4
12 additions, 4 deletions
llvm/lib/Target/ARM/ARMFrameLowering.cpp
llvm/test/CodeGen/Thumb/2011-EpilogueBug.ll
+17
-0
17 additions, 0 deletions
llvm/test/CodeGen/Thumb/2011-EpilogueBug.ll
with
29 additions
and
4 deletions
llvm/lib/Target/ARM/ARMFrameLowering.cpp
+
12
−
4
View file @
572756ac
...
...
@@ -801,15 +801,23 @@ ARMFrameLowering::processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
// Spill R4 if Thumb2 function requires stack realignment - it will be used as
// scratch register. Also spill R4 if Thumb2 function has varsized objects,
// since it's always posible to restore sp from fp in a single instruction.
// since it's not always possible to restore sp from fp in a single
// instruction.
// FIXME: It will be better just to find spare register here.
if
(
AFI
->
isThumb2Function
()
&&
(
MFI
->
hasVarSizedObjects
()
||
RegInfo
->
needsStackRealignment
(
MF
)))
MF
.
getRegInfo
().
setPhysRegUsed
(
ARM
::
R4
);
// Spill LR if Thumb1 function uses variable length argument lists.
if
(
AFI
->
isThumb1OnlyFunction
()
&&
AFI
->
getVarArgsRegSaveSize
()
>
0
)
MF
.
getRegInfo
().
setPhysRegUsed
(
ARM
::
LR
);
if
(
AFI
->
isThumb1OnlyFunction
())
{
// Spill LR if Thumb1 function uses variable length argument lists.
if
(
AFI
->
getVarArgsRegSaveSize
()
>
0
)
MF
.
getRegInfo
().
setPhysRegUsed
(
ARM
::
LR
);
// Spill R4 if Thumb1 epilogue has to restore SP from FP since
// FIXME: It will be better just to find spare register here.
if
(
MFI
->
hasVarSizedObjects
())
MF
.
getRegInfo
().
setPhysRegUsed
(
ARM
::
R4
);
}
// Spill the BasePtr if it's used.
if
(
RegInfo
->
hasBasePointer
(
MF
))
...
...
This diff is collapsed.
Click to expand it.
llvm/test/CodeGen/Thumb/2011-EpilogueBug.ll
0 → 100644
+
17
−
0
View file @
572756ac
; RUN: llc -mtriple=thumbv6-apple-darwin < %s | FileCheck %s
; r8869722
%struct.state
=
type
{
i32
,
%struct.info
*,
float
**,
i32
,
i32
,
i32
,
i32
,
i32
,
i32
,
i32
,
i32
,
i32
,
i64
,
i64
,
i64
,
i64
,
i64
,
i64
,
i8
*
}
%struct.info
=
type
{
i32
,
i32
,
i32
,
i32
,
i32
,
i32
,
i32
,
i8
*
}
define
void
@t1
(
%struct.state
*
%v
)
{
; CHECK: push {r4
%tmp6
=
load
i32
*
null
%tmp8
=
alloca
float
,
i32
%tmp6
store
i32
1
,
i32
*
null
br
label
%return
return:
; preds = %0
; CHECK: mov sp, r4
ret
void
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment