[InstCombine] Signed saturation patterns
[llvm-core.git] / tools / llvm-xray / llvm-xray.cpp
blob9ee653e97b2ddfa58e2673333c92af6a823abf36
1 //===- llvm-xray.cpp: XRay Tool Main Program ------------------------------===//
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 // This file implements the main entry point for the suite of XRay tools. All
10 // additional functionality are implemented as subcommands.
12 //===----------------------------------------------------------------------===//
14 // Basic usage:
16 // llvm-xray [options] <subcommand> [subcommand-specific options]
18 #include "xray-registry.h"
19 #include "llvm/Support/CommandLine.h"
20 #include "llvm/Support/raw_ostream.h"
22 using namespace llvm;
23 using namespace llvm::xray;
25 int main(int argc, char *argv[]) {
26 cl::ParseCommandLineOptions(argc, argv,
27 "XRay Tools\n\n"
28 " This program consolidates multiple XRay trace "
29 "processing tools for convenient access.\n");
30 for (auto *SC : cl::getRegisteredSubcommands()) {
31 if (*SC) {
32 // If no subcommand was provided, we need to explicitly check if this is
33 // the top-level subcommand.
34 if (SC == &*cl::TopLevelSubCommand) {
35 cl::PrintHelpMessage(false, true);
36 return 0;
38 if (auto C = dispatch(SC)) {
39 ExitOnError("llvm-xray: ")(C());
40 return 0;
45 // If all else fails, we still print the usage message.
46 cl::PrintHelpMessage(false, true);
47 return 0;