[llvm] r310768 - [MIPS] Use ABI to determine stack alignment.
John Baldwin via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 11 15:07:56 PDT 2017
Author: jhb
Date: Fri Aug 11 15:07:56 2017
New Revision: 310768
URL: http://llvm.org/viewvc/llvm-project?rev=310768&view=rev
Log:
[MIPS] Use ABI to determine stack alignment.
Summary:
The stack alignment depends on the ABI (16 bytes for N32 and N64 and 8
bytes for O32), not the CPU type.
Reviewers: sdardis
Reviewed By: sdardis
Subscribers: atanasyan, arichardson, llvm-commits
Differential Revision: https://reviews.llvm.org/D36326
Modified:
llvm/trunk/lib/Target/Mips/MipsSubtarget.h
llvm/trunk/test/CodeGen/Mips/stack-alignment.ll
Modified: llvm/trunk/lib/Target/Mips/MipsSubtarget.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsSubtarget.h?rev=310768&r1=310767&r2=310768&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsSubtarget.h (original)
+++ llvm/trunk/lib/Target/Mips/MipsSubtarget.h Fri Aug 11 15:07:56 2017
@@ -295,7 +295,9 @@ public:
// really use them if in addition we are in mips16 mode
static bool useConstantIslands();
- unsigned stackAlignment() const { return hasMips64() ? 16 : 8; }
+ unsigned stackAlignment() const {
+ return isABI_N32() || isABI_N64() ? 16 : 8;
+ }
// Grab relocation model
Reloc::Model getRelocationModel() const;
Modified: llvm/trunk/test/CodeGen/Mips/stack-alignment.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/stack-alignment.ll?rev=310768&r1=310767&r2=310768&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/Mips/stack-alignment.ll (original)
+++ llvm/trunk/test/CodeGen/Mips/stack-alignment.ll Fri Aug 11 15:07:56 2017
@@ -1,9 +1,11 @@
; RUN: llc -march=mipsel < %s | FileCheck %s -check-prefix=32
; RUN: llc -march=mipsel -mattr=+fp64 < %s | FileCheck %s -check-prefix=32
+; RUN: llc -march=mips64el -mcpu=mips3 < %s | FileCheck %s -check-prefix=64
+; RUN: llc -march=mips64el -mcpu=mips4 < %s | FileCheck %s -check-prefix=64
; RUN: llc -march=mips64el -mcpu=mips64 < %s | FileCheck %s -check-prefix=64
; 32: addiu $sp, $sp, -8
-; 64: addiu $sp, $sp, -16
+; 64: daddiu $sp, $sp, -16
define i32 @foo1() #0 {
entry:
More information about the llvm-commits
mailing list