[PATCH] D19104: [X86] Extend some Linux special cases to cover kFreeBSD.
Marcin KoĆcielnicki via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 19 14:26:07 PDT 2016
koriakin updated this revision to Diff 54262.
koriakin added a comment.
Updated due to a conflict with r266806.
Repository:
rL LLVM
http://reviews.llvm.org/D19104
Files:
include/llvm/ADT/Triple.h
lib/Target/X86/X86ISelDAGToDAG.cpp
lib/Target/X86/X86ISelLowering.cpp
lib/Target/X86/X86Subtarget.cpp
lib/Target/X86/X86Subtarget.h
test/CodeGen/X86/stack-protector-target.ll
Index: test/CodeGen/X86/stack-protector-target.ll
===================================================================
--- test/CodeGen/X86/stack-protector-target.ll
+++ test/CodeGen/X86/stack-protector-target.ll
@@ -3,6 +3,8 @@
; RUN: llc -mtriple=x86_64-linux < %s -o - | FileCheck --check-prefix=LINUX-X64 %s
; RUN: llc -mtriple=i386-linux-android < %s -o - | FileCheck --check-prefix=LINUX-I386 %s
; RUN: llc -mtriple=x86_64-linux-android < %s -o - | FileCheck --check-prefix=LINUX-X64 %s
+; RUN: llc -mtriple=i386-kfreebsd < %s -o - | FileCheck --check-prefix=LINUX-I386 %s
+; RUN: llc -mtriple=x86_64-kfreebsd < %s -o - | FileCheck --check-prefix=LINUX-X64 %s
define void @_Z1fv() sspreq {
entry:
Index: lib/Target/X86/X86Subtarget.h
===================================================================
--- lib/Target/X86/X86Subtarget.h
+++ lib/Target/X86/X86Subtarget.h
@@ -467,6 +467,7 @@
bool isTargetMachO() const { return TargetTriple.isOSBinFormatMachO(); }
bool isTargetLinux() const { return TargetTriple.isOSLinux(); }
+ bool isTargetGlibc() const { return TargetTriple.isOSGlibc(); }
bool isTargetAndroid() const { return TargetTriple.isAndroid(); }
bool isTargetNaCl() const { return TargetTriple.isOSNaCl(); }
bool isTargetNaCl32() const { return isTargetNaCl() && !is64Bit(); }
Index: lib/Target/X86/X86Subtarget.cpp
===================================================================
--- lib/Target/X86/X86Subtarget.cpp
+++ lib/Target/X86/X86Subtarget.cpp
@@ -227,11 +227,11 @@
assert((!In64BitMode || HasX86_64) &&
"64-bit code requested on a subtarget that doesn't support it!");
- // Stack alignment is 16 bytes on Darwin, Linux and Solaris (both
+ // Stack alignment is 16 bytes on Darwin, Linux, kFreeBSD and Solaris (both
// 32 and 64 bit) and for all 64-bit targets.
if (StackAlignOverride)
stackAlignment = StackAlignOverride;
- else if (isTargetDarwin() || isTargetLinux() || isTargetSolaris() ||
+ else if (isTargetDarwin() || isTargetGlibc() || isTargetSolaris() ||
In64BitMode)
stackAlignment = 16;
}
Index: lib/Target/X86/X86ISelLowering.cpp
===================================================================
--- lib/Target/X86/X86ISelLowering.cpp
+++ lib/Target/X86/X86ISelLowering.cpp
@@ -2001,7 +2001,7 @@
}
Value *X86TargetLowering::getIRStackGuard(IRBuilder<> &IRB) const {
- if (!Subtarget.isTargetLinux())
+ if (!Subtarget.isTargetGlibc())
return TargetLowering::getIRStackGuard(IRB);
// %fs:0x28, unless we're using a Kernel code model, in which case it's %gs:
@@ -2014,7 +2014,7 @@
}
void X86TargetLowering::insertSSPDeclarations(Module &M) const {
- if (!Subtarget.isTargetLinux())
+ if (!Subtarget.isTargetGlibc())
TargetLowering::insertSSPDeclarations(M);
}
Index: lib/Target/X86/X86ISelDAGToDAG.cpp
===================================================================
--- lib/Target/X86/X86ISelDAGToDAG.cpp
+++ lib/Target/X86/X86ISelDAGToDAG.cpp
@@ -719,7 +719,7 @@
// For more information see http://people.redhat.com/drepper/tls.pdf
if (ConstantSDNode *C = dyn_cast<ConstantSDNode>(Address))
if (C->getSExtValue() == 0 && AM.Segment.getNode() == nullptr &&
- Subtarget->isTargetLinux())
+ Subtarget->isTargetGlibc())
switch (N->getPointerInfo().getAddrSpace()) {
case 256:
AM.Segment = CurDAG->getRegister(X86::GS, MVT::i16);
Index: include/llvm/ADT/Triple.h
===================================================================
--- include/llvm/ADT/Triple.h
+++ include/llvm/ADT/Triple.h
@@ -523,6 +523,11 @@
return getOS() == Triple::Linux;
}
+ /// Tests whether the OS uses glibc.
+ bool isOSGlibc() const {
+ return getOS() == Triple::Linux || getOS() == Triple::KFreeBSD;
+ }
+
/// Tests whether the OS uses the ELF binary format.
bool isOSBinFormatELF() const {
return getObjectFormat() == Triple::ELF;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19104.54262.patch
Type: text/x-patch
Size: 3931 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160419/27507767/attachment.bin>
More information about the llvm-commits
mailing list