Canonicalize header guards into a common format.
[oota-llvm.git] / lib / ExecutionEngine / RuntimeDyld / RuntimeDyldCheckerImpl.h
1 //===-- RuntimeDyldCheckerImpl.h -- RuntimeDyld test framework --*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef LLVM_LIB_EXECUTIONENGINE_RUNTIMEDYLD_RUNTIMEDYLDCHECKERIMPL_H
11 #define LLVM_LIB_EXECUTIONENGINE_RUNTIMEDYLD_RUNTIMEDYLDCHECKERIMPL_H
12
13 #include "RuntimeDyldImpl.h"
14 #include <set>
15
16 namespace llvm {
17
18 class RuntimeDyldCheckerImpl {
19   friend class RuntimeDyldImpl;
20   friend class RuntimeDyldCheckerExprEval;
21
22 public:
23   RuntimeDyldCheckerImpl(RuntimeDyld &RTDyld, MCDisassembler *Disassembler,
24                          MCInstPrinter *InstPrinter,
25                          llvm::raw_ostream &ErrStream);
26
27   bool check(StringRef CheckExpr) const;
28   bool checkAllRulesInBuffer(StringRef RulePrefix, MemoryBuffer *MemBuf) const;
29
30 private:
31   RuntimeDyldImpl &getRTDyld() const { return *RTDyld.Dyld; }
32
33   bool isSymbolValid(StringRef Symbol) const;
34   uint64_t getSymbolLinkerAddr(StringRef Symbol) const;
35   uint64_t getSymbolRemoteAddr(StringRef Symbol) const;
36   uint64_t readMemoryAtAddr(uint64_t Addr, unsigned Size) const;
37   std::pair<uint64_t, std::string> getStubAddrFor(StringRef FilePath,
38                                                   StringRef SectionName,
39                                                   StringRef Symbol,
40                                                   bool IsInsideLoad) const;
41   StringRef getSubsectionStartingAt(StringRef Name) const;
42
43   void registerStubMap(StringRef FileName, unsigned SectionID,
44                        const RuntimeDyldImpl::StubMap &RTDyldStubs);
45
46   RuntimeDyld &RTDyld;
47   MCDisassembler *Disassembler;
48   MCInstPrinter *InstPrinter;
49   llvm::raw_ostream &ErrStream;
50
51   // StubMap typedefs.
52   typedef std::pair<unsigned, uint64_t> StubLoc;
53   typedef std::map<std::string, StubLoc> SymbolStubMap;
54   typedef std::map<std::string, SymbolStubMap> SectionStubMap;
55   typedef std::map<std::string, SectionStubMap> StubMap;
56   StubMap Stubs;
57 };
58 }
59
60 #endif