LLVM 20.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"
18
19namespace llvm {
20class Module;
21class StringRef;
22class raw_ostream;
23
32 bool Recover;
34};
35
36/// This is a public interface to the hardware address sanitizer pass for
37/// instrumenting code to check for various memory errors at runtime, similar to
38/// AddressSanitizer but based on partial hardware assistance.
39class HWAddressSanitizerPass : public PassInfoMixin<HWAddressSanitizerPass> {
40public:
42 : Options(Options){};
44 static bool isRequired() { return true; }
46 function_ref<StringRef(StringRef)> MapClassName2PassName);
47
48private:
50};
51
52namespace HWASanAccessInfo {
53
54// Bit field positions for the accessinfo parameter to
55// llvm.hwasan.check.memaccess. Shared between the pass and the backend. Bits
56// 0-15 are also used by the runtime.
57enum {
58 AccessSizeShift = 0, // 4 bits
61 MatchAllShift = 16, // 8 bits
64};
65
66enum { RuntimeMask = 0xffff };
67
68} // namespace HWASanAccessInfo
69
70} // namespace llvm
71
72#endif
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:253
This is a public interface to the hardware address sanitizer pass for instrumenting code to check for...
PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM)
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:65
A set of analyses that are preserved following a run of a transformation pass.
Definition: Analysis.h:111
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:51
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:52
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:69