diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2014-12-05 21:22:32 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2014-12-05 21:22:32 +0000 |
commit | 0826e6074849c5076a7c7b31ef7a03d0f3b14bb2 (patch) | |
tree | 9c2fa65d4510d074a635cd586faf1eba4db78ba5 /llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp | |
parent | 9665f98c106e4ce1abfc21b4c1d1139b8d43341b (diff) | |
download | llvm-0826e6074849c5076a7c7b31ef7a03d0f3b14bb2.zip llvm-0826e6074849c5076a7c7b31ef7a03d0f3b14bb2.tar.gz llvm-0826e6074849c5076a7c7b31ef7a03d0f3b14bb2.tar.bz2 |
[DFSAN][MIPS][LLVM] Defining ShadowPtrMask variable for MIPS64
Patch by Kumar Sukhani!
corresponding compiler-rt patch: http://reviews.llvm.org/D6437
clang patch: http://reviews.llvm.org/D6147
Differential Revision: http://reviews.llvm.org/D6459
llvm-svn: 223516
Diffstat (limited to 'llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp')
-rw-r--r-- | llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp index c5a4860..8f24476 100644 --- a/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp @@ -49,6 +49,7 @@ #include "llvm/ADT/DenseSet.h" #include "llvm/ADT/DepthFirstIterator.h" #include "llvm/ADT/StringExtras.h" +#include "llvm/ADT/Triple.h" #include "llvm/Analysis/ValueTracking.h" #include "llvm/IR/Dominators.h" #include "llvm/IR/DebugInfo.h" @@ -414,6 +415,11 @@ FunctionType *DataFlowSanitizer::getCustomFunctionType(FunctionType *T) { } bool DataFlowSanitizer::doInitialization(Module &M) { + llvm::Triple TargetTriple(M.getTargetTriple()); + bool IsX86_64 = TargetTriple.getArch() == llvm::Triple::x86_64; + bool IsMIPS64 = TargetTriple.getArch() == llvm::Triple::mips64 || + TargetTriple.getArch() == llvm::Triple::mips64el; + DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>(); if (!DLP) report_fatal_error("data layout missing"); @@ -425,8 +431,13 @@ bool DataFlowSanitizer::doInitialization(Module &M) { ShadowPtrTy = PointerType::getUnqual(ShadowTy); IntptrTy = DL->getIntPtrType(*Ctx); ZeroShadow = ConstantInt::getSigned(ShadowTy, 0); - ShadowPtrMask = ConstantInt::getSigned(IntptrTy, ~0x700000000000LL); ShadowPtrMul = ConstantInt::getSigned(IntptrTy, ShadowWidth / 8); + if (IsX86_64) + ShadowPtrMask = ConstantInt::getSigned(IntptrTy, ~0x700000000000LL); + else if (IsMIPS64) + ShadowPtrMask = ConstantInt::getSigned(IntptrTy, ~0xF000000000LL); + else + report_fatal_error("unsupported triple"); Type *DFSanUnionArgs[2] = { ShadowTy, ShadowTy }; DFSanUnionFnTy = |