mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-21 18:24:23 +00:00
Fix lint warnings in MemorySanitizer.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170203 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -133,14 +133,14 @@ namespace {
|
|||||||
/// MemorySanitizer: instrument the code in module to find
|
/// MemorySanitizer: instrument the code in module to find
|
||||||
/// uninitialized reads.
|
/// uninitialized reads.
|
||||||
class MemorySanitizer : public FunctionPass {
|
class MemorySanitizer : public FunctionPass {
|
||||||
public:
|
public:
|
||||||
MemorySanitizer() : FunctionPass(ID), TD(0), WarningFn(0) { }
|
MemorySanitizer() : FunctionPass(ID), TD(0), WarningFn(0) { }
|
||||||
const char *getPassName() const { return "MemorySanitizer"; }
|
const char *getPassName() const { return "MemorySanitizer"; }
|
||||||
bool runOnFunction(Function &F);
|
bool runOnFunction(Function &F);
|
||||||
bool doInitialization(Module &M);
|
bool doInitialization(Module &M);
|
||||||
static char ID; // Pass identification, replacement for typeid.
|
static char ID; // Pass identification, replacement for typeid.
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initializeCallbacks(Module &M);
|
void initializeCallbacks(Module &M);
|
||||||
|
|
||||||
DataLayout *TD;
|
DataLayout *TD;
|
||||||
@ -242,8 +242,8 @@ void MemorySanitizer::initializeCallbacks(Module &M) {
|
|||||||
MsanPoisonStackFn = M.getOrInsertFunction(
|
MsanPoisonStackFn = M.getOrInsertFunction(
|
||||||
"__msan_poison_stack", IRB.getVoidTy(), IRB.getInt8PtrTy(), IntptrTy, NULL);
|
"__msan_poison_stack", IRB.getVoidTy(), IRB.getInt8PtrTy(), IntptrTy, NULL);
|
||||||
MemmoveFn = M.getOrInsertFunction(
|
MemmoveFn = M.getOrInsertFunction(
|
||||||
"__msan_memmove", IRB.getInt8PtrTy(), IRB.getInt8PtrTy(), IRB.getInt8PtrTy(),
|
"__msan_memmove", IRB.getInt8PtrTy(), IRB.getInt8PtrTy(),
|
||||||
IntptrTy, NULL);
|
IRB.getInt8PtrTy(), IntptrTy, NULL);
|
||||||
MemcpyFn = M.getOrInsertFunction(
|
MemcpyFn = M.getOrInsertFunction(
|
||||||
"__msan_memcpy", IRB.getInt8PtrTy(), IRB.getInt8PtrTy(), IRB.getInt8PtrTy(),
|
"__msan_memcpy", IRB.getInt8PtrTy(), IRB.getInt8PtrTy(), IRB.getInt8PtrTy(),
|
||||||
IntptrTy, NULL);
|
IntptrTy, NULL);
|
||||||
@ -378,7 +378,7 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
|
|||||||
|
|
||||||
// An unfortunate workaround for asymmetric lowering of va_arg stuff.
|
// An unfortunate workaround for asymmetric lowering of va_arg stuff.
|
||||||
// See a comment in visitCallSite for more details.
|
// See a comment in visitCallSite for more details.
|
||||||
static const unsigned AMD64GpEndOffset = 48; // AMD64 ABI Draft 0.99.6 p3.5.7
|
static const unsigned AMD64GpEndOffset = 48; // AMD64 ABI Draft 0.99.6 p3.5.7
|
||||||
static const unsigned AMD64FpEndOffset = 176;
|
static const unsigned AMD64FpEndOffset = 176;
|
||||||
|
|
||||||
struct ShadowOriginAndInsertPoint {
|
struct ShadowOriginAndInsertPoint {
|
||||||
@ -410,7 +410,8 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
|
|||||||
Value *Shadow = getShadow(Val);
|
Value *Shadow = getShadow(Val);
|
||||||
Value *ShadowPtr = getShadowPtr(Addr, Shadow->getType(), IRB);
|
Value *ShadowPtr = getShadowPtr(Addr, Shadow->getType(), IRB);
|
||||||
|
|
||||||
StoreInst *NewSI = IRB.CreateAlignedStore(Shadow, ShadowPtr, I.getAlignment());
|
StoreInst *NewSI =
|
||||||
|
IRB.CreateAlignedStore(Shadow, ShadowPtr, I.getAlignment());
|
||||||
DEBUG(dbgs() << " STORE: " << *NewSI << "\n");
|
DEBUG(dbgs() << " STORE: " << *NewSI << "\n");
|
||||||
(void)NewSI;
|
(void)NewSI;
|
||||||
// If the store is volatile, add a check.
|
// If the store is volatile, add a check.
|
||||||
@ -769,7 +770,7 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
|
|||||||
ShadowOriginAndInsertPoint(Shadow, Origin, OrigIns));
|
ShadowOriginAndInsertPoint(Shadow, Origin, OrigIns));
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------- Visitors.
|
// ------------------- Visitors.
|
||||||
|
|
||||||
/// \brief Instrument LoadInst
|
/// \brief Instrument LoadInst
|
||||||
///
|
///
|
||||||
@ -940,6 +941,7 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
|
|||||||
Value *Origin;
|
Value *Origin;
|
||||||
IRBuilder<> &IRB;
|
IRBuilder<> &IRB;
|
||||||
MemorySanitizerVisitor *MSV;
|
MemorySanitizerVisitor *MSV;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Combiner(MemorySanitizerVisitor *MSV, IRBuilder<> &IRB) :
|
Combiner(MemorySanitizerVisitor *MSV, IRBuilder<> &IRB) :
|
||||||
Shadow(0), Origin(0), IRB(IRB), MSV(MSV) {}
|
Shadow(0), Origin(0), IRB(IRB), MSV(MSV) {}
|
||||||
@ -1221,7 +1223,8 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
|
|||||||
void visitIntrinsicInst(IntrinsicInst &I) {
|
void visitIntrinsicInst(IntrinsicInst &I) {
|
||||||
switch (I.getIntrinsicID()) {
|
switch (I.getIntrinsicID()) {
|
||||||
case llvm::Intrinsic::bswap:
|
case llvm::Intrinsic::bswap:
|
||||||
handleBswap(I); break;
|
handleBswap(I);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
visitInstruction(I); break;
|
visitInstruction(I); break;
|
||||||
}
|
}
|
||||||
@ -1476,7 +1479,7 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
|
|||||||
struct VarArgAMD64Helper : public VarArgHelper {
|
struct VarArgAMD64Helper : public VarArgHelper {
|
||||||
// An unfortunate workaround for asymmetric lowering of va_arg stuff.
|
// An unfortunate workaround for asymmetric lowering of va_arg stuff.
|
||||||
// See a comment in visitCallSite for more details.
|
// See a comment in visitCallSite for more details.
|
||||||
static const unsigned AMD64GpEndOffset = 48; // AMD64 ABI Draft 0.99.6 p3.5.7
|
static const unsigned AMD64GpEndOffset = 48; // AMD64 ABI Draft 0.99.6 p3.5.7
|
||||||
static const unsigned AMD64FpEndOffset = 176;
|
static const unsigned AMD64FpEndOffset = 176;
|
||||||
|
|
||||||
Function &F;
|
Function &F;
|
||||||
|
Reference in New Issue
Block a user