brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.8 KiB · da45a2d Raw
50 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8//9// Contains the orc-rt-executor test tool. This is a "blank executable" that10// links the ORC runtime and can accept code from a JIT controller like lii or11// llvm-jitlink.12//13//===----------------------------------------------------------------------===//14 15#include <cstring>16#include <iostream>17#include <optional>18#include <string_view>19 20void 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 34int main(int argc, char *argv[]) {35  if (argc < 2) {36    printHelp("orc-rt-executor", std::cerr);37    std::cerr << "error: insufficient arguments.\n";38    exit(1);39  }40 41  if (!strcmp(argv[1], "help")) {42    printHelp(argv[0], std::cerr);43    exit(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