mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-30 05:29:47 +00:00
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73733 91177308-0d34-0410-b5e6-96231b3b80d8
58 lines
1.6 KiB
C++
58 lines
1.6 KiB
C++
//===-- llvm-mc.cpp - Machine Code Hacking Driver -------------------------===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This utility is a simple driver that allows command line hacking on machine
|
|
// code.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "llvm/Support/CommandLine.h"
|
|
#include "llvm/Support/ManagedStatic.h"
|
|
#include "llvm/Support/MemoryBuffer.h"
|
|
#include "llvm/Support/PrettyStackTrace.h"
|
|
#include "llvm/Support/raw_ostream.h"
|
|
#include "llvm/System/Signals.h"
|
|
using namespace llvm;
|
|
|
|
static cl::opt<std::string>
|
|
InputFilename(cl::Positional, cl::desc("<input file>"), cl::init("-"));
|
|
|
|
static cl::opt<std::string>
|
|
OutputFilename("o", cl::desc("Output filename"),
|
|
cl::value_desc("filename"));
|
|
|
|
int main(int argc, char **argv) {
|
|
// Print a stack trace if we signal out.
|
|
sys::PrintStackTraceOnErrorSignal();
|
|
PrettyStackTraceProgram X(argc, argv);
|
|
|
|
llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
|
|
|
|
cl::ParseCommandLineOptions(argc, argv, "llvm machine code playground\n");
|
|
|
|
std::string ErrorMessage;
|
|
|
|
MemoryBuffer *Buffer
|
|
= MemoryBuffer::getFileOrSTDIN(InputFilename, &ErrorMessage);
|
|
|
|
if (Buffer == 0) {
|
|
errs() << argv[0] << ": ";
|
|
if (ErrorMessage.size())
|
|
errs() << ErrorMessage << "\n";
|
|
else
|
|
errs() << "input file didn't read correctly.\n";
|
|
return 1;
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|