summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2016-04-05 22:41:50 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2016-04-05 22:41:50 +0000
commitdde29e2799b82bf76b263eac46acf3a1ae90d206 (patch)
tree3de199ef85cff9089e3b7b882b6b41eaf996948c /llvm/lib/Target/X86
parentf8bdd88cd95e5387ad853874fe2db38edfe76c41 (diff)
downloadbcm5719-llvm-dde29e2799b82bf76b263eac46acf3a1ae90d206.tar.gz
bcm5719-llvm-dde29e2799b82bf76b263eac46acf3a1ae90d206.zip
Faster stack-protector for Android/AArch64.
Bionic has a defined thread-local location for the stack protector cookie. Emit a direct load instead of going through __stack_chk_guard. llvm-svn: 265481
Diffstat (limited to 'llvm/lib/Target/X86')
-rw-r--r--llvm/lib/Target/X86/X86ISelLowering.cpp13
-rw-r--r--llvm/lib/Target/X86/X86ISelLowering.h8
2 files changed, 10 insertions, 11 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index ea5518ed4c6..f81a3082ed2 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -2193,16 +2193,17 @@ unsigned X86TargetLowering::getAddressSpace() const {
return 256;
}
-bool X86TargetLowering::getStackCookieLocation(unsigned &AddressSpace,
- unsigned &Offset) const {
+Value *X86TargetLowering::getStackCookieLocation(IRBuilder<> &IRB) const {
if (!Subtarget.isTargetLinux())
- return false;
+ return TargetLowering::getStackCookieLocation(IRB);
// %fs:0x28, unless we're using a Kernel code model, in which case it's %gs:
// %gs:0x14 on i386
- Offset = (Subtarget.is64Bit()) ? 0x28 : 0x14;
- AddressSpace = getAddressSpace();
- return true;
+ unsigned Offset = (Subtarget.is64Bit()) ? 0x28 : 0x14;
+ unsigned AddressSpace = getAddressSpace();
+ return ConstantExpr::getIntToPtr(
+ ConstantInt::get(Type::getInt32Ty(IRB.getContext()), Offset),
+ Type::getInt8PtrTy(IRB.getContext())->getPointerTo(AddressSpace));
}
Value *X86TargetLowering::getSafeStackPointerLocation(IRBuilder<> &IRB) const {
diff --git a/llvm/lib/Target/X86/X86ISelLowering.h b/llvm/lib/Target/X86/X86ISelLowering.h
index 664eadd000a..7007782ccf4 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.h
+++ b/llvm/lib/Target/X86/X86ISelLowering.h
@@ -960,11 +960,9 @@ namespace llvm {
FastISel *createFastISel(FunctionLoweringInfo &funcInfo,
const TargetLibraryInfo *libInfo) const override;
- /// Return true if the target stores stack protector cookies at a fixed
- /// offset in some non-standard address space, and populates the address
- /// space and offset as appropriate.
- bool getStackCookieLocation(unsigned &AddressSpace,
- unsigned &Offset) const override;
+ /// If the target has a standard location for the stack protector cookie,
+ /// returns the address of that location. Otherwise, returns nullptr.
+ Value *getStackCookieLocation(IRBuilder<> &IRB) const override;
/// Return true if the target stores SafeStack pointer at a fixed offset in
/// some non-standard address space, and populates the address space and
OpenPOWER on IntegriCloud