TargetExecutionUtils.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===-- TargetExecutionUtils.h - Utils for execution in target --*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. //
  14. // Utilities for execution in the target process.
  15. //
  16. //===----------------------------------------------------------------------===//
  17. #ifndef LLVM_EXECUTIONENGINE_ORC_TARGETPROCESS_TARGETEXECUTIONUTILS_H
  18. #define LLVM_EXECUTIONENGINE_ORC_TARGETPROCESS_TARGETEXECUTIONUTILS_H
  19. #include "llvm/ADT/ArrayRef.h"
  20. #include "llvm/ADT/StringRef.h"
  21. #include <string>
  22. namespace llvm {
  23. namespace orc {
  24. /// Run a main function, returning the result.
  25. ///
  26. /// If the optional ProgramName argument is given then it will be inserted
  27. /// before the strings in Args as the first argument to the called function.
  28. ///
  29. /// It is legal to have an empty argument list and no program name, however
  30. /// many main functions will expect a name argument at least, and will fail
  31. /// if none is provided.
  32. int runAsMain(int (*Main)(int, char *[]), ArrayRef<std::string> Args,
  33. std::optional<StringRef> ProgramName = std::nullopt);
  34. int runAsVoidFunction(int (*Func)(void));
  35. int runAsIntFunction(int (*Func)(int), int Arg);
  36. } // end namespace orc
  37. } // end namespace llvm
  38. #endif // LLVM_EXECUTIONENGINE_ORC_TARGETPROCESS_TARGETEXECUTIONUTILS_H
  39. #ifdef __GNUC__
  40. #pragma GCC diagnostic pop
  41. #endif