Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions llvm/lib/Target/X86/X86Subtarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,12 +284,13 @@ void X86Subtarget::initSubtargetFeatures(StringRef CPU, StringRef TuneCPU,
reportFatalUsageError("64-bit code requested on a subtarget that doesn't "
"support it!");

// Stack alignment is 16 bytes on Darwin, Linux, kFreeBSD, and for all
// Stack alignment is 16 bytes on Darwin, Linux, kFreeBSD, Hurd and for all
// 64-bit targets. On Solaris (32-bit), stack alignment is 4 bytes
// following the i386 psABI, while on Illumos it is always 16 bytes.
if (StackAlignOverride)
stackAlignment = *StackAlignOverride;
else if (isTargetDarwin() || isTargetLinux() || isTargetKFreeBSD() || Is64Bit)
else if (isTargetDarwin() || isTargetLinux() || isTargetKFreeBSD() ||
isTargetHurd() || Is64Bit)
stackAlignment = Align(16);

// Consume the vector width attribute or apply any target specific limit.
Expand Down
1 change: 1 addition & 0 deletions llvm/lib/Target/X86/X86Subtarget.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ class X86Subtarget final : public X86GenSubtargetInfo {

bool isTargetLinux() const { return TargetTriple.isOSLinux(); }
bool isTargetKFreeBSD() const { return TargetTriple.isOSKFreeBSD(); }
bool isTargetHurd() const { return TargetTriple.isOSHurd(); }
bool isTargetGlibc() const { return TargetTriple.isOSGlibc(); }
bool isTargetAndroid() const { return TargetTriple.isAndroid(); }
bool isTargetMCU() const { return TargetTriple.isOSIAMCU(); }
Expand Down
5 changes: 5 additions & 0 deletions llvm/test/CodeGen/X86/stack-align2.ll
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
; RUN: llc < %s -mcpu=generic -mtriple=i386-linux | FileCheck %s -check-prefix=LINUX-I386
; RUN: llc < %s -mcpu=generic -mtriple=i386-kfreebsd | FileCheck %s -check-prefix=KFREEBSD-I386
; RUN: llc < %s -mcpu=generic -mtriple=i386-hurd | FileCheck %s -check-prefix=HURD-I386
; RUN: llc < %s -mcpu=generic -mtriple=i386-netbsd | FileCheck %s -check-prefix=NETBSD-I386
; RUN: llc < %s -mcpu=generic -mtriple=i686-apple-darwin8 | FileCheck %s -check-prefix=DARWIN-I386
; RUN: llc < %s -mcpu=generic -mtriple=i386-pc-solaris2.11 | FileCheck %s -check-prefix=SOLARIS-I386
; RUN: llc < %s -mcpu=generic -mtriple=x86_64-linux | FileCheck %s -check-prefix=LINUX-X86_64
; RUN: llc < %s -mcpu=generic -mtriple=x86_64-kfreebsd | FileCheck %s -check-prefix=KFREEBSD-X86_64
; RUN: llc < %s -mcpu=generic -mtriple=x86_64-hurd | FileCheck %s -check-prefix=HURD-X86_64
; RUN: llc < %s -mcpu=generic -mtriple=x86_64-netbsd | FileCheck %s -check-prefix=NETBSD-X86_64
; RUN: llc < %s -mcpu=generic -mtriple=x86_64-apple-darwin8 | FileCheck %s -check-prefix=DARWIN-X86_64
; RUN: llc < %s -mcpu=generic -mtriple=x86_64-pc-solaris2.11 | FileCheck %s -check-prefix=SOLARIS-X86_64
Expand All @@ -17,6 +19,7 @@ entry:
; LINUX-I386: subl $12, %esp
; KFREEBSD-I386: subl $12, %esp
; DARWIN-I386: subl $12, %esp
; HURD-I386: subl $12, %esp
; NETBSD-I386-NOT: subl {{.*}}, %esp
; SOLARIS-I386-NOT: subl {{.*}}, %esp

Expand All @@ -30,6 +33,8 @@ entry:
; SOLARIS-X86_64-NOT: subq {{.*}}, %rsp
; KFREEBSD-X86_64: pushq %{{.*}}
; KFREEBSD-X86_64-NOT: subq {{.*}}, %rsp
; HURD-X86_64: pushq %{{.*}}
; HURD-X86_64-NOT: subq {{.*}}, %rsp
}

declare void @test2()
Loading