llvm/llvm/tools/llvm-dis/llvm-dis.cpp

//===-- llvm-dis.cpp - The low-level LLVM disassembler --------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This utility may be invoked in the following manner:
//  llvm-dis [options]      - Read LLVM bitcode from stdin, write asm to stdout
//  llvm-dis [options] x.bc - Read LLVM bitcode from the x.bc file, write asm
//                            to the x.ll file.
//  Options:
//
//  Color Options:
//      --color                 - Use colors in output (default=autodetect)
//
//  Disassembler Options:
//      -f                      - Enable binary output on terminals
//      --materialize-metadata  - Load module without materializing metadata,
//                                then materialize only the metadata
//      -o <filename>           - Override output filename
//      --show-annotations      - Add informational comments to the .ll file
//
//  Generic Options:
//      --help                  - Display available options
//                                (--help-hidden for more)
//      --help-list             - Display list of available options
//                                (--help-list-hidden for more)
//      --version               - Display the version of this program
//
//===----------------------------------------------------------------------===//

#include "llvm/Bitcode/BitcodeReader.h"
#include "llvm/IR/AssemblyAnnotationWriter.h"
#include "llvm/IR/DebugInfo.h"
#include "llvm/IR/DiagnosticInfo.h"
#include "llvm/IR/DiagnosticPrinter.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/ModuleSummaryIndex.h"
#include "llvm/IR/Type.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/FormattedStream.h"
#include "llvm/Support/InitLLVM.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/ToolOutputFile.h"
#include "llvm/Support/WithColor.h"
#include <system_error>
usingnamespacellvm;

static cl::OptionCategory DisCategory("Disassembler Options");

static cl::list<std::string> InputFilenames(cl::Positional,
                                            cl::desc("[input bitcode]..."),
                                            cl::cat(DisCategory));

static cl::opt<std::string> OutputFilename("o",
                                           cl::desc("Override output filename"),
                                           cl::value_desc("filename"),
                                           cl::cat(DisCategory));

static cl::opt<bool> Force("f", cl::desc("Enable binary output on terminals"),
                           cl::cat(DisCategory));

static cl::opt<bool> DontPrint("disable-output",
                               cl::desc("Don't output the .ll file"),
                               cl::Hidden, cl::cat(DisCategory));

static cl::opt<bool>
    SetImporting("set-importing",
                 cl::desc("Set lazy loading to pretend to import a module"),
                 cl::Hidden, cl::cat(DisCategory));

static cl::opt<bool>
    ShowAnnotations("show-annotations",
                    cl::desc("Add informational comments to the .ll file"),
                    cl::cat(DisCategory));

static cl::opt<bool> PreserveAssemblyUseListOrder(
    "preserve-ll-uselistorder",
    cl::desc("Preserve use-list order when writing LLVM assembly."),
    cl::init(false), cl::Hidden, cl::cat(DisCategory));

static cl::opt<bool>
    MaterializeMetadata("materialize-metadata",
                        cl::desc("Load module without materializing metadata, "
                                 "then materialize only the metadata"),
                        cl::cat(DisCategory));

static cl::opt<bool> PrintThinLTOIndexOnly(
    "print-thinlto-index-only",
    cl::desc("Only read thinlto index and print the index as LLVM assembly."),
    cl::init(false), cl::Hidden, cl::cat(DisCategory));

extern cl::opt<bool> WriteNewDbgInfoFormat;

extern cl::opt<cl::boolOrDefault> LoadBitcodeIntoNewDbgInfoFormat;

namespace {

static void printDebugLoc(const DebugLoc &DL, formatted_raw_ostream &OS) {}
class CommentWriter : public AssemblyAnnotationWriter {};

struct LLVMDisDiagnosticHandler : public DiagnosticHandler {};
} // end anon namespace

static ExitOnError ExitOnErr;

int main(int argc, char **argv) {}