IRInterpreter.h 1.8 KB

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