mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-10 04:33:40 +00:00
Add header guards to files that were missing guards. Remove #endif comments as they don't seem common in LLVM (we can easily add them back if we decide they're useful) Changes made by clang-tidy with minor tweaks. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215558 91177308-0d34-0410-b5e6-96231b3b80d8
86 lines
2.6 KiB
C++
86 lines
2.6 KiB
C++
//===---- RuntimeDyldChecker.h - RuntimeDyld tester framework -----*- C++ -*-=//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LLVM_EXECUTIONENGINE_RUNTIMEDYLDCHECKER_H
|
|
#define LLVM_EXECUTIONENGINE_RUNTIMEDYLDCHECKER_H
|
|
|
|
#include "llvm/ADT/StringRef.h"
|
|
|
|
namespace llvm {
|
|
|
|
class MCDisassembler;
|
|
class MemoryBuffer;
|
|
class MCInstPrinter;
|
|
class RuntimeDyld;
|
|
class RuntimeDyldCheckerImpl;
|
|
class raw_ostream;
|
|
|
|
/// \brief RuntimeDyld invariant checker for verifying that RuntimeDyld has
|
|
/// correctly applied relocations.
|
|
///
|
|
/// The RuntimeDyldChecker class evaluates expressions against an attached
|
|
/// RuntimeDyld instance to verify that relocations have been applied
|
|
/// correctly.
|
|
///
|
|
/// The expression language supports basic pointer arithmetic and bit-masking,
|
|
/// and has limited disassembler integration for accessing instruction
|
|
/// operands and the next PC (program counter) address for each instruction.
|
|
///
|
|
/// The language syntax is:
|
|
///
|
|
/// check = expr '=' expr
|
|
///
|
|
/// expr = binary_expr
|
|
/// | sliceable_expr
|
|
///
|
|
/// sliceable_expr = '*{' number '}' load_addr_expr [slice]
|
|
/// | '(' expr ')' [slice]
|
|
/// | ident_expr [slice]
|
|
/// | number [slice]
|
|
///
|
|
/// slice = '[' high-bit-index ':' low-bit-index ']'
|
|
///
|
|
/// load_addr_expr = symbol
|
|
/// | '(' symbol '+' number ')'
|
|
/// | '(' symbol '-' number ')'
|
|
///
|
|
/// ident_expr = 'decode_operand' '(' symbol ',' operand-index ')'
|
|
/// | 'next_pc' '(' symbol ')'
|
|
/// | symbol
|
|
///
|
|
/// binary_expr = expr '+' expr
|
|
/// | expr '-' expr
|
|
/// | expr '&' expr
|
|
/// | expr '|' expr
|
|
/// | expr '<<' expr
|
|
/// | expr '>>' expr
|
|
///
|
|
class RuntimeDyldChecker {
|
|
public:
|
|
RuntimeDyldChecker(RuntimeDyld &RTDyld, MCDisassembler *Disassembler,
|
|
MCInstPrinter *InstPrinter, raw_ostream &ErrStream);
|
|
~RuntimeDyldChecker();
|
|
|
|
/// \brief Check a single expression against the attached RuntimeDyld
|
|
/// instance.
|
|
bool check(StringRef CheckExpr) const;
|
|
|
|
/// \brief Scan the given memory buffer for lines beginning with the string
|
|
/// in RulePrefix. The remainder of the line is passed to the check
|
|
/// method to be evaluated as an expression.
|
|
bool checkAllRulesInBuffer(StringRef RulePrefix, MemoryBuffer *MemBuf) const;
|
|
|
|
private:
|
|
std::unique_ptr<RuntimeDyldCheckerImpl> Impl;
|
|
};
|
|
|
|
} // end namespace llvm
|
|
|
|
#endif
|