LLVM 20.0.0git
TargetExecutionUtils.h
Go to the documentation of this file.
1//===-- TargetExecutionUtils.h - Utils for execution in target --*- 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//
9// Utilities for execution in the target process.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_EXECUTIONENGINE_ORC_TARGETPROCESS_TARGETEXECUTIONUTILS_H
14#define LLVM_EXECUTIONENGINE_ORC_TARGETPROCESS_TARGETEXECUTIONUTILS_H
15
16#include "llvm/ADT/ArrayRef.h"
17#include "llvm/ADT/StringRef.h"
18#include <string>
19
20namespace llvm {
21namespace orc {
22
23/// Run a main function, returning the result.
24///
25/// If the optional ProgramName argument is given then it will be inserted
26/// before the strings in Args as the first argument to the called function.
27///
28/// It is legal to have an empty argument list and no program name, however
29/// many main functions will expect a name argument at least, and will fail
30/// if none is provided.
31int runAsMain(int (*Main)(int, char *[]), ArrayRef<std::string> Args,
32 std::optional<StringRef> ProgramName = std::nullopt);
33
34int runAsVoidFunction(int (*Func)(void));
35int runAsIntFunction(int (*Func)(int), int Arg);
36
37} // end namespace orc
38} // end namespace llvm
39
40#endif // LLVM_EXECUTIONENGINE_ORC_TARGETPROCESS_TARGETEXECUTIONUTILS_H
int runAsVoidFunction(int(*Func)(void))
int runAsIntFunction(int(*Func)(int), int Arg)
int runAsMain(int(*Main)(int, char *[]), ArrayRef< std::string > Args, std::optional< StringRef > ProgramName=std::nullopt)
Run a main function, returning the result.
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18