[IRBuilder] Add Align argument for CreateMaskedExpandLoad and CreateMaskedCompressSto...
[llvm-project.git] / llvm / lib / ExecutionEngine / RuntimeDyld / RuntimeDyldCheckerImpl.h
blobbda554e9e5b673c61e6685081af2fe57d44636b6
1 //===-- RuntimeDyldCheckerImpl.h -- RuntimeDyld test framework --*- 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 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_LIB_EXECUTIONENGINE_RUNTIMEDYLD_RUNTIMEDYLDCHECKERIMPL_H
10 #define LLVM_LIB_EXECUTIONENGINE_RUNTIMEDYLD_RUNTIMEDYLDCHECKERIMPL_H
12 #include "RuntimeDyldImpl.h"
14 namespace llvm {
16 /// Holds target-specific properties for a symbol.
17 using TargetFlagsType = uint8_t;
19 class RuntimeDyldCheckerImpl {
20 friend class RuntimeDyldChecker;
21 friend class RuntimeDyldCheckerExprEval;
23 using IsSymbolValidFunction =
24 RuntimeDyldChecker::IsSymbolValidFunction;
25 using GetSymbolInfoFunction = RuntimeDyldChecker::GetSymbolInfoFunction;
26 using GetSectionInfoFunction = RuntimeDyldChecker::GetSectionInfoFunction;
27 using GetStubInfoFunction = RuntimeDyldChecker::GetStubInfoFunction;
28 using GetGOTInfoFunction = RuntimeDyldChecker::GetGOTInfoFunction;
30 public:
31 RuntimeDyldCheckerImpl(IsSymbolValidFunction IsSymbolValid,
32 GetSymbolInfoFunction GetSymbolInfo,
33 GetSectionInfoFunction GetSectionInfo,
34 GetStubInfoFunction GetStubInfo,
35 GetGOTInfoFunction GetGOTInfo,
36 llvm::endianness Endianness, Triple TT, StringRef CPU,
37 SubtargetFeatures TF, llvm::raw_ostream &ErrStream);
39 bool check(StringRef CheckExpr) const;
40 bool checkAllRulesInBuffer(StringRef RulePrefix, MemoryBuffer *MemBuf) const;
42 private:
44 // StubMap typedefs.
46 Expected<JITSymbolResolver::LookupResult>
47 lookup(const JITSymbolResolver::LookupSet &Symbols) const;
49 bool isSymbolValid(StringRef Symbol) const;
50 uint64_t getSymbolLocalAddr(StringRef Symbol) const;
51 uint64_t getSymbolRemoteAddr(StringRef Symbol) const;
52 uint64_t readMemoryAtAddr(uint64_t Addr, unsigned Size) const;
54 StringRef getSymbolContent(StringRef Symbol) const;
56 TargetFlagsType getTargetFlag(StringRef Symbol) const;
57 Triple getTripleForSymbol(TargetFlagsType Flag) const;
58 StringRef getCPU() const { return CPU; }
59 SubtargetFeatures getFeatures() const { return TF; }
61 std::pair<uint64_t, std::string> getSectionAddr(StringRef FileName,
62 StringRef SectionName,
63 bool IsInsideLoad) const;
65 std::pair<uint64_t, std::string>
66 getStubOrGOTAddrFor(StringRef StubContainerName, StringRef Symbol,
67 StringRef StubKindFilter, bool IsInsideLoad,
68 bool IsStubAddr) const;
70 std::optional<uint64_t> getSectionLoadAddress(void *LocalAddr) const;
72 IsSymbolValidFunction IsSymbolValid;
73 GetSymbolInfoFunction GetSymbolInfo;
74 GetSectionInfoFunction GetSectionInfo;
75 GetStubInfoFunction GetStubInfo;
76 GetGOTInfoFunction GetGOTInfo;
77 llvm::endianness Endianness;
78 Triple TT;
79 std::string CPU;
80 SubtargetFeatures TF;
81 llvm::raw_ostream &ErrStream;
85 #endif