LLVM 22.0.0git
HWAddressSanitizer.h
Go to the documentation of this file.
1//===--------- Definition of the HWAddressSanitizer 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 the Hardware AddressSanitizer class which is a port of the
10// legacy HWAddressSanitizer pass to use the new PassManager infrastructure.
11//
12//===----------------------------------------------------------------------===//
13#ifndef LLVM_TRANSFORMS_INSTRUMENTATION_HWADDRESSSANITIZER_H
14#define LLVM_TRANSFORMS_INSTRUMENTATION_HWADDRESSSANITIZER_H
15
17#include "llvm/IR/PassManager.h"
19
20namespace llvm {
21class Module;
22class StringRef;
23class raw_ostream;
24
33 bool Recover;
35};
36
37/// This is a public interface to the hardware address sanitizer pass for
38/// instrumenting code to check for various memory errors at runtime, similar to
39/// AddressSanitizer but based on partial hardware assistance.
40class HWAddressSanitizerPass : public PassInfoMixin<HWAddressSanitizerPass> {
41public:
43 : Options(Options){};
45 static bool isRequired() { return true; }
46 LLVM_ABI void
48 function_ref<StringRef(StringRef)> MapClassName2PassName);
49
50private:
52};
53
54namespace HWASanAccessInfo {
55
56// Bit field positions for the accessinfo parameter to
57// llvm.hwasan.check.memaccess. Shared between the pass and the backend. Bits
58// 0-15 are also used by the runtime.
59enum {
60 AccessSizeShift = 0, // 4 bits
63 MatchAllShift = 16, // 8 bits
66};
67
68enum { RuntimeMask = 0xffff };
69
70} // namespace HWASanAccessInfo
71
72} // namespace llvm
73
74#endif
#define LLVM_ABI
Definition: Compiler.h:213
This header defines various interfaces for pass management in LLVM.
Machine Check Debug Module
ModuleAnalysisManager MAM
raw_pwrite_stream & OS
A container for analyses that lazily runs them and caches their results.
Definition: PassManager.h:255
This is a public interface to the hardware address sanitizer pass for instrumenting code to check for...
LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM)
LLVM_ABI void printPipeline(raw_ostream &OS, function_ref< StringRef(StringRef)> MapClassName2PassName)
HWAddressSanitizerPass(HWAddressSanitizerOptions Options)
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:67
A set of analyses that are preserved following a run of a transformation pass.
Definition: Analysis.h:112
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:55
An efficient, type-erasing, non-owning reference to a callable.
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
HWAddressSanitizerOptions(bool CompileKernel, bool Recover, bool DisableOptimization)
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:70