Path: blob/main/contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUAsanInstrumentation.h
213799 views
//===AMDGPUAsanInstrumentation.h - ASAN helper functions -*- C++- *===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===--------------------------------------------------------------===//78#ifndef LLVM_LIB_TARGET_AMDGPU_UTILS_AMDGPU_ASAN_INSTRUMENTATION_H9#define LLVM_LIB_TARGET_AMDGPU_UTILS_AMDGPU_ASAN_INSTRUMENTATION_H1011#include "AMDGPU.h"12#include "AMDGPUMemoryUtils.h"13#include "Utils/AMDGPUBaseInfo.h"14#include "llvm/ADT/SetOperations.h"15#include "llvm/ADT/StringExtras.h"16#include "llvm/ADT/StringMap.h"17#include "llvm/ADT/StringRef.h"18#include "llvm/IR/Constants.h"19#include "llvm/IR/DerivedTypes.h"20#include "llvm/IR/IRBuilder.h"21#include "llvm/IR/Instructions.h"22#include "llvm/IR/IntrinsicsAMDGPU.h"23#include "llvm/IR/MDBuilder.h"24#include "llvm/InitializePasses.h"25#include "llvm/Pass.h"26#include "llvm/Support/CommandLine.h"27#include "llvm/Support/Debug.h"28#include "llvm/Support/OptimizedStructLayout.h"29#include "llvm/Support/raw_ostream.h"30#include "llvm/Transforms/Instrumentation/AddressSanitizer.h"31#include "llvm/Transforms/Instrumentation/AddressSanitizerCommon.h"32#include "llvm/Transforms/Utils/BasicBlockUtils.h"33#include "llvm/Transforms/Utils/ModuleUtils.h"3435namespace llvm {36namespace AMDGPU {3738/// Given SizeInBytes of the Value to be instrunmented,39/// Returns the redzone size corresponding to it.40uint64_t getRedzoneSizeForGlobal(int Scale, uint64_t SizeInBytes);4142/// Instrument the memory operand Addr.43/// Generates report blocks that catch the addressing errors.44void instrumentAddress(Module &M, IRBuilder<> &IRB, Instruction *OrigIns,45Instruction *InsertBefore, Value *Addr, Align Alignment,46TypeSize TypeStoreSize, bool IsWrite,47Value *SizeArgument, bool UseCalls, bool Recover,48int Scale, int Offset);4950/// Get all the memory operands from the instruction51/// that needs to be instrumented52void getInterestingMemoryOperands(53Module &M, Instruction *I,54SmallVectorImpl<InterestingMemoryOperand> &Interesting);5556} // end namespace AMDGPU57} // end namespace llvm5859#endif // LLVM_LIB_TARGET_AMDGPU_UTILS_AMDGPU_ASAN_INSTRUMENTATION_H606162