mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-06 04:31:08 +00:00
* Make all command line arguments static
* Change -trace & -tracem options to use a 3 values enum option * Change to use new style interface to passes git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1813 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
eded4916d6
commit
4ddcd54751
@ -22,14 +22,20 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
cl::String InputFilename ("", "Input filename", cl::NoFlags, "-");
|
static cl::String InputFilename ("", "Input filename", cl::NoFlags, "-");
|
||||||
cl::String OutputFilename("o", "Output filename", cl::NoFlags, "");
|
static cl::String OutputFilename("o", "Output filename", cl::NoFlags, "");
|
||||||
cl::Flag Force ("f", "Overwrite output files");
|
static cl::Flag Force ("f", "Overwrite output files");
|
||||||
cl::Flag DumpAsm ("d", "Print bytecode before native code generation",
|
static cl::Flag DumpAsm ("d", "Print bytecode before native code generation", cl::Hidden);
|
||||||
cl::Hidden);
|
|
||||||
cl::Flag TraceBBValues ("trace",
|
enum TraceLevel {
|
||||||
"Trace values at basic block and method exits");
|
TraceOff, TraceMethods, TraceBasicBlocks
|
||||||
cl::Flag TraceMethodValues("tracem", "Trace values only at method exits");
|
};
|
||||||
|
|
||||||
|
static cl::Enum<enum TraceLevel> TraceValues("trace", cl::NoFlags,
|
||||||
|
"Trace values through methods or basic blocks",
|
||||||
|
clEnumValN(TraceOff , "off", "Disable trace code"),
|
||||||
|
clEnumValN(TraceMethods , "method", "Trace each method"),
|
||||||
|
clEnumValN(TraceBasicBlocks, "basicblock", "Trace each basic block"), 0);
|
||||||
|
|
||||||
|
|
||||||
// GetFileNameRoot - Helper function to get the basename of a filename...
|
// GetFileNameRoot - Helper function to get the basename of a filename...
|
||||||
@ -73,15 +79,19 @@ int main(int argc, char **argv) {
|
|||||||
PassManager Passes;
|
PassManager Passes;
|
||||||
|
|
||||||
// Hoist constants out of PHI nodes into predecessor BB's
|
// Hoist constants out of PHI nodes into predecessor BB's
|
||||||
Passes.add(new HoistPHIConstants());
|
Passes.add(createHoistPHIConstantsPass());
|
||||||
|
|
||||||
if (TraceBBValues || TraceMethodValues) { // If tracing enabled...
|
if (TraceValues != TraceOff) { // If tracing enabled...
|
||||||
// Insert trace code in all methods in the module
|
// Insert trace code in all methods in the module
|
||||||
Passes.add(new InsertTraceCode(TraceBBValues,
|
if (TraceValues == TraceBasicBlocks)
|
||||||
TraceBBValues ||TraceMethodValues));
|
Passes.add(createTraceValuesPassForBasicBlocks());
|
||||||
|
else if (TraceValues == TraceMethods)
|
||||||
|
Passes.add(createTraceValuesPassForMethod());
|
||||||
|
else
|
||||||
|
assert(0 && "Bad value for TraceValues!");
|
||||||
|
|
||||||
// Eliminate duplication in constant pool
|
// Eliminate duplication in constant pool
|
||||||
Passes.add(new DynamicConstantMerge());
|
Passes.add(createDynamicConstantMergePass());
|
||||||
|
|
||||||
// Then write out the module with tracing code before code generation
|
// Then write out the module with tracing code before code generation
|
||||||
assert(InputFilename != "-" &&
|
assert(InputFilename != "-" &&
|
||||||
@ -109,7 +119,7 @@ int main(int argc, char **argv) {
|
|||||||
// Replace malloc and free instructions with library calls.
|
// Replace malloc and free instructions with library calls.
|
||||||
// Do this after tracing until lli implements these lib calls.
|
// Do this after tracing until lli implements these lib calls.
|
||||||
// For now, it will emulate malloc and free internally.
|
// For now, it will emulate malloc and free internally.
|
||||||
Passes.add(new LowerAllocations(Target.DataLayout));
|
Passes.add(createLowerAllocationsPass(Target.DataLayout));
|
||||||
|
|
||||||
// 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)
|
||||||
|
Loading…
Reference in New Issue
Block a user