aboutsummaryrefslogtreecommitdiff
path: root/include/lldb/Expression/IRInterpreter.h
blob: 36e03c6fc4f61cb374d281ad89eb9c0d3b1c028f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//===-- IRInterpreter.h -----------------------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef liblldb_IRInterpreter_h_
#define liblldb_IRInterpreter_h_

#include "lldb/Utility/ConstString.h"
#include "lldb/Utility/Stream.h"
#include "lldb/lldb-public.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/Pass.h"

namespace llvm {
class Function;
class Module;
}

namespace lldb_private {

class ClangExpressionDeclMap;
class IRMemoryMap;
}

//----------------------------------------------------------------------
/// @class IRInterpreter IRInterpreter.h "lldb/Expression/IRInterpreter.h"
/// @brief Attempt to interpret the function's code if it does not require
///        running the target.
///
/// In some cases, the IR for an expression can be evaluated entirely
/// in the debugger, manipulating variables but not executing any code
/// in the target.  The IRInterpreter attempts to do this.
//----------------------------------------------------------------------
class IRInterpreter {
public:
  static bool CanInterpret(llvm::Module &module, llvm::Function &function,
                           lldb_private::Status &error,
                           const bool support_function_calls);

  static bool Interpret(llvm::Module &module, llvm::Function &function,
                        llvm::ArrayRef<lldb::addr_t> args,
                        lldb_private::IRExecutionUnit &execution_unit,
                        lldb_private::Status &error,
                        lldb::addr_t stack_frame_bottom,
                        lldb::addr_t stack_frame_top,
                        lldb_private::ExecutionContext &exe_ctx);

private:
  static bool supportsFunction(llvm::Function &llvm_function,
                               lldb_private::Status &err);
};

#endif