Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:44:38

0001 //===--------- Definition of the AddressSanitizer class ---------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // This file declares common infrastructure for AddressSanitizer and
0010 // HWAddressSanitizer.
0011 //
0012 //===----------------------------------------------------------------------===//
0013 #ifndef LLVM_TRANSFORMS_INSTRUMENTATION_ADDRESSSANITIZERCOMMON_H
0014 #define LLVM_TRANSFORMS_INSTRUMENTATION_ADDRESSSANITIZERCOMMON_H
0015 
0016 #include "llvm/Analysis/CFG.h"
0017 #include "llvm/Analysis/PostDominators.h"
0018 #include "llvm/IR/Dominators.h"
0019 #include "llvm/IR/Instruction.h"
0020 #include "llvm/IR/IntrinsicInst.h"
0021 #include "llvm/IR/Module.h"
0022 
0023 namespace llvm {
0024 
0025 class InterestingMemoryOperand {
0026 public:
0027   Use *PtrUse;
0028   bool IsWrite;
0029   Type *OpType;
0030   TypeSize TypeStoreSize = TypeSize::getFixed(0);
0031   MaybeAlign Alignment;
0032   // The mask Value, if we're looking at a masked load/store.
0033   Value *MaybeMask;
0034   // The EVL Value, if we're looking at a vp intrinsic.
0035   Value *MaybeEVL;
0036   // The Stride Value, if we're looking at a strided load/store.
0037   Value *MaybeStride;
0038 
0039   InterestingMemoryOperand(Instruction *I, unsigned OperandNo, bool IsWrite,
0040                            class Type *OpType, MaybeAlign Alignment,
0041                            Value *MaybeMask = nullptr,
0042                            Value *MaybeEVL = nullptr,
0043                            Value *MaybeStride = nullptr)
0044       : IsWrite(IsWrite), OpType(OpType), Alignment(Alignment),
0045         MaybeMask(MaybeMask), MaybeEVL(MaybeEVL), MaybeStride(MaybeStride) {
0046     const DataLayout &DL = I->getDataLayout();
0047     TypeStoreSize = DL.getTypeStoreSizeInBits(OpType);
0048     PtrUse = &I->getOperandUse(OperandNo);
0049   }
0050 
0051   Instruction *getInsn() { return cast<Instruction>(PtrUse->getUser()); }
0052 
0053   Value *getPtr() { return PtrUse->get(); }
0054 };
0055 
0056 // Get AddressSanitizer parameters.
0057 void getAddressSanitizerParams(const Triple &TargetTriple, int LongSize,
0058                                bool IsKasan, uint64_t *ShadowBase,
0059                                int *MappingScale, bool *OrShadowOffset);
0060 
0061 } // namespace llvm
0062 
0063 #endif