blob: 98ece967a92355753009081e69cff08e2ad412e7 [file] [log] [blame]
Andrew Walbran3d2c1972020-04-07 12:24:26 +01001//===-- IRInterpreter.h -----------------------------------------*- 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
Olivier Deprezf4ef2d02021-04-20 13:36:24 +02009#ifndef LLDB_EXPRESSION_IRINTERPRETER_H
10#define LLDB_EXPRESSION_IRINTERPRETER_H
Andrew Walbran3d2c1972020-04-07 12:24:26 +010011
12#include "lldb/Utility/ConstString.h"
13#include "lldb/Utility/Stream.h"
14#include "lldb/lldb-public.h"
15#include "llvm/ADT/ArrayRef.h"
16#include "llvm/Pass.h"
17
18namespace llvm {
19class Function;
20class Module;
21}
22
23namespace lldb_private {
24
Andrew Walbran3d2c1972020-04-07 12:24:26 +010025class IRMemoryMap;
26}
27
28/// \class IRInterpreter IRInterpreter.h "lldb/Expression/IRInterpreter.h"
29/// Attempt to interpret the function's code if it does not require
30/// running the target.
31///
32/// In some cases, the IR for an expression can be evaluated entirely in the
33/// debugger, manipulating variables but not executing any code in the target.
34/// The IRInterpreter attempts to do this.
35class IRInterpreter {
36public:
37 static bool CanInterpret(llvm::Module &module, llvm::Function &function,
38 lldb_private::Status &error,
39 const bool support_function_calls);
40
41 static bool Interpret(llvm::Module &module, llvm::Function &function,
42 llvm::ArrayRef<lldb::addr_t> args,
43 lldb_private::IRExecutionUnit &execution_unit,
44 lldb_private::Status &error,
45 lldb::addr_t stack_frame_bottom,
46 lldb::addr_t stack_frame_top,
47 lldb_private::ExecutionContext &exe_ctx);
48
49private:
50 static bool supportsFunction(llvm::Function &llvm_function,
51 lldb_private::Status &err);
52};
53
54#endif