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