mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-19 06:31:18 +00:00
Kill using declarations
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5934 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
322bc2b5aa
commit
b5881f126d
@ -21,8 +21,6 @@
|
|||||||
#include "Support/Signals.h"
|
#include "Support/Signals.h"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
using std::string;
|
|
||||||
using std::cerr;
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// Option declarations for LLC.
|
// Option declarations for LLC.
|
||||||
@ -43,10 +41,10 @@ OptimizationList(cl::desc("Optimizations available:"));
|
|||||||
// within the corresponding llc passes, and target-specific options
|
// within the corresponding llc passes, and target-specific options
|
||||||
// and back-end code generation options are specified with the target machine.
|
// and back-end code generation options are specified with the target machine.
|
||||||
//
|
//
|
||||||
static cl::opt<string>
|
static cl::opt<std::string>
|
||||||
InputFilename(cl::Positional, cl::desc("<input bytecode>"), cl::init("-"));
|
InputFilename(cl::Positional, cl::desc("<input bytecode>"), cl::init("-"));
|
||||||
|
|
||||||
static cl::opt<string>
|
static cl::opt<std::string>
|
||||||
OutputFilename("o", cl::desc("Output filename"), cl::value_desc("filename"));
|
OutputFilename("o", cl::desc("Output filename"), cl::value_desc("filename"));
|
||||||
|
|
||||||
static cl::opt<bool> Force("f", cl::desc("Overwrite output files"));
|
static cl::opt<bool> Force("f", cl::desc("Overwrite output files"));
|
||||||
@ -55,7 +53,7 @@ static cl::opt<bool>
|
|||||||
DumpAsm("d", cl::desc("Print bytecode before native code generation"),
|
DumpAsm("d", cl::desc("Print bytecode before native code generation"),
|
||||||
cl::Hidden);
|
cl::Hidden);
|
||||||
|
|
||||||
static cl::opt<string>
|
static cl::opt<std::string>
|
||||||
TraceLibPath("tracelibpath", cl::desc("Path to libinstr for trace code"),
|
TraceLibPath("tracelibpath", cl::desc("Path to libinstr for trace code"),
|
||||||
cl::value_desc("directory"), cl::Hidden);
|
cl::value_desc("directory"), cl::Hidden);
|
||||||
|
|
||||||
@ -66,14 +64,14 @@ static bool TraceBasicBlocks = false;
|
|||||||
|
|
||||||
|
|
||||||
// GetFileNameRoot - Helper function to get the basename of a filename...
|
// GetFileNameRoot - Helper function to get the basename of a filename...
|
||||||
static inline string
|
static inline std::string
|
||||||
GetFileNameRoot(const string &InputFilename)
|
GetFileNameRoot(const std::string &InputFilename)
|
||||||
{
|
{
|
||||||
string IFN = InputFilename;
|
std::string IFN = InputFilename;
|
||||||
string outputFilename;
|
std::string outputFilename;
|
||||||
int Len = IFN.length();
|
int Len = IFN.length();
|
||||||
if (IFN[Len-3] == '.' && IFN[Len-2] == 'b' && IFN[Len-1] == 'c') {
|
if (IFN[Len-3] == '.' && IFN[Len-2] == 'b' && IFN[Len-1] == 'c') {
|
||||||
outputFilename = string(IFN.begin(), IFN.end()-3); // s/.bc/.s/
|
outputFilename = std::string(IFN.begin(), IFN.end()-3); // s/.bc/.s/
|
||||||
} else {
|
} else {
|
||||||
outputFilename = IFN;
|
outputFilename = IFN;
|
||||||
}
|
}
|
||||||
@ -116,7 +114,7 @@ insertTraceCodeFor(Module &M)
|
|||||||
|
|
||||||
// If we still didn't get it, cancel trying to link it in...
|
// If we still didn't get it, cancel trying to link it in...
|
||||||
if (TraceModule == 0)
|
if (TraceModule == 0)
|
||||||
cerr << "Warning, could not load trace routines to link into program!\n";
|
std::cerr <<"WARNING: couldn't load trace routines to link into program!\n";
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Link in the trace routines... if this fails, don't panic, because the
|
// Link in the trace routines... if this fails, don't panic, because the
|
||||||
@ -124,22 +122,22 @@ insertTraceCodeFor(Module &M)
|
|||||||
//
|
//
|
||||||
std::auto_ptr<Module> TraceRoutines(TraceModule);
|
std::auto_ptr<Module> TraceRoutines(TraceModule);
|
||||||
if (LinkModules(&M, TraceRoutines.get(), &ErrorMessage))
|
if (LinkModules(&M, TraceRoutines.get(), &ErrorMessage))
|
||||||
cerr << "Warning: Error linking in trace routines: "
|
std::cerr << "WARNING: Error linking in trace routines: "
|
||||||
<< ErrorMessage << "\n";
|
<< ErrorMessage << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write out the module with tracing code just before code generation
|
// Write out the module with tracing code just before code generation
|
||||||
assert (InputFilename != "-"
|
assert (InputFilename != "-"
|
||||||
&& "Cannot write out traced bytecode when reading input from stdin");
|
&& "Cannot write out traced bytecode when reading input from stdin");
|
||||||
string TraceFilename = GetFileNameRoot(InputFilename) + ".trace.bc";
|
std::string TraceFilename = GetFileNameRoot(InputFilename) + ".trace.bc";
|
||||||
|
|
||||||
std::ofstream Out(TraceFilename.c_str());
|
std::ofstream Out(TraceFilename.c_str());
|
||||||
if (!Out.good())
|
if (!Out.good())
|
||||||
cerr << "Error opening '" << TraceFilename
|
std::cerr << "Error opening '" << TraceFilename
|
||||||
<< "'!: Skipping output of trace code as bytecode\n";
|
<< "'!: Skipping output of trace code as bytecode\n";
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cerr << "Emitting trace code to '" << TraceFilename
|
std::cerr << "Emitting trace code to '" << TraceFilename
|
||||||
<< "' for comparison...\n";
|
<< "' for comparison...\n";
|
||||||
WriteBytecodeToFile(&M, Out);
|
WriteBytecodeToFile(&M, Out);
|
||||||
}
|
}
|
||||||
@ -179,7 +177,7 @@ main(int argc, char **argv)
|
|||||||
std::auto_ptr<Module> M(ParseBytecodeFile(InputFilename));
|
std::auto_ptr<Module> M(ParseBytecodeFile(InputFilename));
|
||||||
if (M.get() == 0)
|
if (M.get() == 0)
|
||||||
{
|
{
|
||||||
cerr << argv[0] << ": bytecode didn't read correctly.\n";
|
std::cerr << argv[0] << ": bytecode didn't read correctly.\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,7 +206,7 @@ main(int argc, char **argv)
|
|||||||
else if (Opt->getTargetCtor())
|
else if (Opt->getTargetCtor())
|
||||||
Passes.add(Opt->getTargetCtor()(Target));
|
Passes.add(Opt->getTargetCtor()(Target));
|
||||||
else
|
else
|
||||||
cerr << argv[0] << ": cannot create pass: "
|
std::cerr << argv[0] << ": cannot create pass: "
|
||||||
<< Opt->getPassName() << "\n";
|
<< Opt->getPassName() << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -227,7 +225,7 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
// If LLVM dumping after transformations is requested, add it to the pipeline
|
// If LLVM dumping after transformations is requested, add it to the pipeline
|
||||||
if (DumpAsm)
|
if (DumpAsm)
|
||||||
Passes.add(new PrintFunctionPass("Code after xformations: \n", &cerr));
|
Passes.add(new PrintFunctionPass("Code after xformations: \n", &std::cerr));
|
||||||
|
|
||||||
// Strip all of the symbols from the bytecode so that it will be smaller...
|
// Strip all of the symbols from the bytecode so that it will be smaller...
|
||||||
Passes.add(createSymbolStrippingPass());
|
Passes.add(createSymbolStrippingPass());
|
||||||
@ -238,7 +236,7 @@ main(int argc, char **argv)
|
|||||||
{ // Specified an output filename?
|
{ // Specified an output filename?
|
||||||
if (!Force && std::ifstream(OutputFilename.c_str())) {
|
if (!Force && std::ifstream(OutputFilename.c_str())) {
|
||||||
// If force is not specified, make sure not to overwrite a file!
|
// If force is not specified, make sure not to overwrite a file!
|
||||||
cerr << argv[0] << ": error opening '" << OutputFilename
|
std::cerr << argv[0] << ": error opening '" << OutputFilename
|
||||||
<< "': file exists!\n"
|
<< "': file exists!\n"
|
||||||
<< "Use -f command line argument to force output\n";
|
<< "Use -f command line argument to force output\n";
|
||||||
return 1;
|
return 1;
|
||||||
@ -258,13 +256,13 @@ main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string OutputFilename = GetFileNameRoot(InputFilename);
|
std::string OutputFilename = GetFileNameRoot(InputFilename);
|
||||||
OutputFilename += ".s";
|
OutputFilename += ".s";
|
||||||
|
|
||||||
if (!Force && std::ifstream(OutputFilename.c_str()))
|
if (!Force && std::ifstream(OutputFilename.c_str()))
|
||||||
{
|
{
|
||||||
// If force is not specified, make sure not to overwrite a file!
|
// If force is not specified, make sure not to overwrite a file!
|
||||||
cerr << argv[0] << ": error opening '" << OutputFilename
|
std::cerr << argv[0] << ": error opening '" << OutputFilename
|
||||||
<< "': file exists!\n"
|
<< "': file exists!\n"
|
||||||
<< "Use -f command line argument to force output\n";
|
<< "Use -f command line argument to force output\n";
|
||||||
return 1;
|
return 1;
|
||||||
@ -273,7 +271,8 @@ main(int argc, char **argv)
|
|||||||
Out = new std::ofstream(OutputFilename.c_str());
|
Out = new std::ofstream(OutputFilename.c_str());
|
||||||
if (!Out->good())
|
if (!Out->good())
|
||||||
{
|
{
|
||||||
cerr << argv[0] << ": error opening " << OutputFilename << "!\n";
|
std::cerr << argv[0] << ": error opening " << OutputFilename
|
||||||
|
<< "!\n";
|
||||||
delete Out;
|
delete Out;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -286,7 +285,7 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
// Ask the target to add backend passes as neccesary
|
// Ask the target to add backend passes as neccesary
|
||||||
if (Target.addPassesToEmitAssembly(Passes, *Out)) {
|
if (Target.addPassesToEmitAssembly(Passes, *Out)) {
|
||||||
cerr << argv[0] << ": target '" << Target.getName()
|
std::cerr << argv[0] << ": target '" << Target.getName()
|
||||||
<< " does not support static compilation!\n";
|
<< " does not support static compilation!\n";
|
||||||
} else {
|
} else {
|
||||||
// Run our queue of passes all at once now, efficiently.
|
// Run our queue of passes all at once now, efficiently.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user