1 | //===- orc-rt-executor.cpp ------------------------------------------------===// |
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 | // Contains the orc-rt-executor test tool. This is a "blank executable" that |
10 | // links the ORC runtime and can accept code from a JIT controller like lii or |
11 | // llvm-jitlink. |
12 | // |
13 | //===----------------------------------------------------------------------===// |
14 | |
15 | #include <cstring> |
16 | #include <iostream> |
17 | #include <optional> |
18 | #include <string_view> |
19 | |
20 | void printHelp(std::string_view ProgName, std::ostream &OS) { |
21 | OS << "usage: " << ProgName << " [help] [<mode>] <program arguments>...\n" |
22 | << " <mode> -- specify how to listen for JIT'd program\n" |
23 | << " filedesc=<in>,<out> -- read from <in> filedesc, write to out\n" |
24 | << " tcp=<host>:<port> -- listen on the given host/port\n" |
25 | << " help -- print help and exit\n" |
26 | << "\n" |
27 | << " Notes:\n" |
28 | << " Program arguments will be made available to the JIT controller.\n" |
29 | << " When running a JIT'd program containing a main function the\n" |
30 | << " controller may choose to pass these on to main, however\n" |
31 | << " orc-rt-executor does not enforce this.\n" ; |
32 | } |
33 | |
34 | int main(int argc, char *argv[]) { |
35 | if (argc < 2) { |
36 | printHelp(ProgName: "orc-rt-executor" , OS&: std::cerr); |
37 | std::cerr << "error: insufficient arguments.\n" ; |
38 | exit(status: 1); |
39 | } |
40 | |
41 | if (!strcmp(s1: argv[1], s2: "help" )) { |
42 | printHelp(ProgName: argv[0], OS&: std::cerr); |
43 | exit(status: 0); |
44 | } |
45 | |
46 | std::cerr << "error: One day I will be a real program, but I am not yet.\n" ; |
47 | |
48 | return 0; |
49 | } |
50 | |