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