| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- //===--------- Definition of the AddressSanitizer class ---------*- C++ -*-===//
- //
- // The LLVM Compiler Infrastructure
- //
- // This file is distributed under the University of Illinois Open Source
- // License. See LICENSE.TXT for details.
- //
- //===----------------------------------------------------------------------===//
- //
- // This file declares common infrastructure for AddressSanitizer and
- // HWAddressSanitizer.
- //
- //===----------------------------------------------------------------------===//
- #ifndef LLVM_TRANSFORMS_INSTRUMENTATION_ADDRESSSANITIZERCOMMON_H
- #define LLVM_TRANSFORMS_INSTRUMENTATION_ADDRESSSANITIZERCOMMON_H
- #include "llvm/IR/Instruction.h"
- #include "llvm/IR/Module.h"
- namespace llvm {
- class InterestingMemoryOperand {
- public:
- Use *PtrUse;
- bool IsWrite;
- Type *OpType;
- uint64_t TypeSize;
- MaybeAlign Alignment;
- // The mask Value, if we're looking at a masked load/store.
- Value *MaybeMask;
- InterestingMemoryOperand(Instruction *I, unsigned OperandNo, bool IsWrite,
- class Type *OpType, MaybeAlign Alignment,
- Value *MaybeMask = nullptr)
- : IsWrite(IsWrite), OpType(OpType), Alignment(Alignment),
- MaybeMask(MaybeMask) {
- const DataLayout &DL = I->getModule()->getDataLayout();
- TypeSize = DL.getTypeStoreSizeInBits(OpType);
- PtrUse = &I->getOperandUse(OperandNo);
- }
- Instruction *getInsn() { return cast<Instruction>(PtrUse->getUser()); }
- Value *getPtr() { return PtrUse->get(); }
- };
- } // namespace llvm
- #endif
|