LLVM 19.0.0git
AddressSanitizerCommon.h
Go to the documentation of this file.
1//===--------- Definition of the AddressSanitizer class ---------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file declares common infrastructure for AddressSanitizer and
10// HWAddressSanitizer.
11//
12//===----------------------------------------------------------------------===//
13#ifndef LLVM_TRANSFORMS_INSTRUMENTATION_ADDRESSSANITIZERCOMMON_H
14#define LLVM_TRANSFORMS_INSTRUMENTATION_ADDRESSSANITIZERCOMMON_H
15
16#include "llvm/Analysis/CFG.h"
18#include "llvm/IR/Dominators.h"
19#include "llvm/IR/Instruction.h"
21#include "llvm/IR/Module.h"
22
23namespace llvm {
24
26public:
28 bool IsWrite;
32 // The mask Value, if we're looking at a masked load/store.
34 // The EVL Value, if we're looking at a vp intrinsic.
36 // The Stride Value, if we're looking at a strided load/store.
38
39 InterestingMemoryOperand(Instruction *I, unsigned OperandNo, bool IsWrite,
41 Value *MaybeMask = nullptr,
42 Value *MaybeEVL = nullptr,
43 Value *MaybeStride = nullptr)
46 const DataLayout &DL = I->getModule()->getDataLayout();
47 TypeStoreSize = DL.getTypeStoreSizeInBits(OpType);
48 PtrUse = &I->getOperandUse(OperandNo);
49 }
50
51 Instruction *getInsn() { return cast<Instruction>(PtrUse->getUser()); }
52
53 Value *getPtr() { return PtrUse->get(); }
54};
55
56// Get AddressSanitizer parameters.
57void getAddressSanitizerParams(const Triple &TargetTriple, int LongSize,
58 bool IsKasan, uint64_t *ShadowBase,
59 int *MappingScale, bool *OrShadowOffset);
60
61} // namespace llvm
62
63#endif
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
#define I(x, y, z)
Definition: MD5.cpp:58
Module.h This file contains the declarations for the Module class.
A parsed version of the target data layout string in and methods for querying it.
Definition: DataLayout.h:110
InterestingMemoryOperand(Instruction *I, unsigned OperandNo, bool IsWrite, class Type *OpType, MaybeAlign Alignment, Value *MaybeMask=nullptr, Value *MaybeEVL=nullptr, Value *MaybeStride=nullptr)
static constexpr TypeSize getFixed(ScalarTy ExactSize)
Definition: TypeSize.h:330
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
A Use represents the edge between a Value definition and its users.
Definition: Use.h:43
LLVM Value Representation.
Definition: Value.h:74
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
void getAddressSanitizerParams(const Triple &TargetTriple, int LongSize, bool IsKasan, uint64_t *ShadowBase, int *MappingScale, bool *OrShadowOffset)
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.
Definition: Alignment.h:117