mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-04-12 23:37:33 +00:00
*** empty log message ***
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2985 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
50e3f88d38
commit
5ff62e90d0
@ -19,12 +19,16 @@ AnalysisID FunctionLiveVarInfo::ID(AnalysisID::create<FunctionLiveVarInfo>());
|
||||
|
||||
LiveVarDebugLevel_t DEBUG_LV;
|
||||
|
||||
static cl::Enum<LiveVarDebugLevel_t> DEBUG_LV_opt(DEBUG_LV, "dlivevar", cl::Hidden,
|
||||
"enable live-variable debugging information",
|
||||
clEnumValN(LV_DEBUG_None , "n", "disable debug output"),
|
||||
clEnumValN(LV_DEBUG_Normal , "y", "enable debug output"),
|
||||
clEnumValN(LV_DEBUG_Instr, "i", "print live-var sets before/after every machine instrn"),
|
||||
clEnumValN(LV_DEBUG_Verbose, "v", "print def, use sets for every instrn also"), 0);
|
||||
static cl::opt<LiveVarDebugLevel_t, true>
|
||||
DEBUG_LV_opt("dlivevar", cl::Hidden, cl::location(DEBUG_LV),
|
||||
cl::desc("enable live-variable debugging information"),
|
||||
cl::values(
|
||||
clEnumValN(LV_DEBUG_None , "n", "disable debug output"),
|
||||
clEnumValN(LV_DEBUG_Normal , "y", "enable debug output"),
|
||||
clEnumValN(LV_DEBUG_Instr, "i", "print live-var sets before/after "
|
||||
"every machine instrn"),
|
||||
clEnumValN(LV_DEBUG_Verbose, "v", "print def, use sets for every instrn also"),
|
||||
0));
|
||||
|
||||
|
||||
|
||||
|
@ -21,13 +21,16 @@ using std::vector;
|
||||
|
||||
SchedDebugLevel_t SchedDebugLevel;
|
||||
|
||||
static cl::Enum<enum SchedDebugLevel_t> Opt(SchedDebugLevel,"dsched",cl::Hidden,
|
||||
"enable instruction scheduling debugging information",
|
||||
clEnumValN(Sched_NoDebugInfo, "n", "disable debug output"),
|
||||
clEnumValN(Sched_Disable, "off", "disable instruction scheduling"),
|
||||
clEnumValN(Sched_PrintMachineCode, "y", "print machine code after scheduling"),
|
||||
clEnumValN(Sched_PrintSchedTrace, "t", "print trace of scheduling actions"),
|
||||
clEnumValN(Sched_PrintSchedGraphs, "g", "print scheduling graphs"), 0);
|
||||
static cl::opt<SchedDebugLevel_t, true>
|
||||
SDL_opt("dsched", cl::Hidden, cl::location(SchedDebugLevel),
|
||||
cl::desc("enable instruction scheduling debugging information"),
|
||||
cl::values(
|
||||
clEnumValN(Sched_NoDebugInfo, "n", "disable debug output"),
|
||||
clEnumValN(Sched_Disable, "off", "disable instruction scheduling"),
|
||||
clEnumValN(Sched_PrintMachineCode, "y", "print machine code after scheduling"),
|
||||
clEnumValN(Sched_PrintSchedTrace, "t", "print trace of scheduling actions"),
|
||||
clEnumValN(Sched_PrintSchedGraphs, "g", "print scheduling graphs"),
|
||||
0));
|
||||
|
||||
|
||||
//************************* Internal Data Types *****************************/
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include "llvm/Function.h"
|
||||
#include "llvm/iPHINode.h"
|
||||
#include "Support/CommandLine.h"
|
||||
#include <iostream>
|
||||
using std::cerr;
|
||||
using std::vector;
|
||||
|
||||
@ -40,13 +39,18 @@ enum SelectDebugLevel_t {
|
||||
Select_DebugBurgTrees,
|
||||
};
|
||||
|
||||
|
||||
// Enable Debug Options to be specified on the command line
|
||||
cl::Enum<enum SelectDebugLevel_t> SelectDebugLevel("dselect", cl::Hidden,
|
||||
"enable instruction selection debugging information",
|
||||
static cl::opt<SelectDebugLevel_t>
|
||||
SelectDebugLevel("dselect", cl::Hidden,
|
||||
cl::desc("enable instruction selection debugging information"),
|
||||
cl::values(
|
||||
clEnumValN(Select_NoDebugInfo, "n", "disable debug output"),
|
||||
clEnumValN(Select_PrintMachineCode, "y", "print generated machine code"),
|
||||
clEnumValN(Select_DebugInstTrees, "i", "print debugging info for instruction selection "),
|
||||
clEnumValN(Select_DebugBurgTrees, "b", "print burg trees"), 0);
|
||||
clEnumValN(Select_DebugInstTrees, "i",
|
||||
"print debugging info for instruction selection"),
|
||||
clEnumValN(Select_DebugBurgTrees, "b", "print burg trees"),
|
||||
0));
|
||||
|
||||
|
||||
//******************** Forward Function Declarations ***********************/
|
||||
|
@ -19,25 +19,25 @@
|
||||
#include "llvm/Analysis/LoopInfo.h"
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
#include "llvm/Target/MachineFrameInfo.h"
|
||||
#include "llvm/BasicBlock.h"
|
||||
#include "llvm/Function.h"
|
||||
#include "llvm/Type.h"
|
||||
#include "llvm/iOther.h"
|
||||
#include "llvm/CodeGen/RegAllocCommon.h"
|
||||
#include "Support/CommandLine.h"
|
||||
#include "Support/STLExtras.h"
|
||||
#include <iostream>
|
||||
#include <math.h>
|
||||
using std::cerr;
|
||||
using std::vector;
|
||||
|
||||
RegAllocDebugLevel_t DEBUG_RA;
|
||||
static cl::Enum<RegAllocDebugLevel_t> DEBUG_RA_c(DEBUG_RA, "dregalloc",
|
||||
cl::Hidden,
|
||||
"enable register allocation debugging information",
|
||||
static cl::opt<RegAllocDebugLevel_t, true>
|
||||
DRA_opt("dregalloc", cl::Hidden, cl::location(DEBUG_RA),
|
||||
cl::desc("enable register allocation debugging information"),
|
||||
cl::values(
|
||||
clEnumValN(RA_DEBUG_None , "n", "disable debug output"),
|
||||
clEnumValN(RA_DEBUG_Normal , "y", "enable debug output"),
|
||||
clEnumValN(RA_DEBUG_Verbose, "v", "enable extra debug output"), 0);
|
||||
clEnumValN(RA_DEBUG_Verbose, "v", "enable extra debug output"),
|
||||
0));
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
@ -24,10 +24,18 @@ using std::vector;
|
||||
using std::cout;
|
||||
using std::cerr;
|
||||
|
||||
cl::Flag QuietMode ("quiet" , "Do not emit any non-program output");
|
||||
cl::Alias QuietModeA("q" , "Alias for -quiet", cl::NoFlags, QuietMode);
|
||||
cl::Flag ArrayChecksEnabled("array-checks", "Enable array bound checks");
|
||||
cl::Flag AbortOnExceptions("abort-on-exception", "Halt execution on a machine exception");
|
||||
static cl::opt<bool>
|
||||
QuietMode("quiet", cl::desc("Do not emit any non-program output"));
|
||||
|
||||
static cl::alias
|
||||
QuietModeA("q", cl::desc("Alias for -quiet"), cl::aliasopt(QuietMode));
|
||||
|
||||
static cl::opt<bool>
|
||||
ArrayChecksEnabled("array-checks", cl::desc("Enable array bound checks"));
|
||||
|
||||
static cl::opt<bool>
|
||||
AbortOnExceptions("abort-on-exception",
|
||||
cl::desc("Halt execution on a machine exception"));
|
||||
|
||||
// Create a TargetData structure to handle memory addressing and size/alignment
|
||||
// computations
|
||||
@ -37,8 +45,9 @@ CachedWriter CW; // Object to accelerate printing of LLVM
|
||||
|
||||
|
||||
#ifdef PROFILE_STRUCTURE_FIELDS
|
||||
static cl::Flag ProfileStructureFields("profilestructfields",
|
||||
"Profile Structure Field Accesses");
|
||||
static cl::opt<bool>
|
||||
ProfileStructureFields("profilestructfields",
|
||||
cl::desc("Profile Structure Field Accesses"));
|
||||
#include <map>
|
||||
static std::map<const StructType *, vector<unsigned> > FieldAccessCounts;
|
||||
#endif
|
||||
|
@ -20,8 +20,16 @@
|
||||
|
||||
bool DebugFlag; // DebugFlag - Exported boolean set by the -debug option
|
||||
|
||||
static cl::Flag Enabled("stats", "Enable statistics output from program");
|
||||
static cl::Flag Debug(DebugFlag, "debug", "Enable debug output", cl::Hidden);
|
||||
// -stats - Command line option to cause transformations to emit stats about
|
||||
// what they did.
|
||||
//
|
||||
static cl::opt<bool>
|
||||
Enabled("stats", cl::desc("Enable statistics output from program"));
|
||||
|
||||
// -debug - Command line option to enable the DEBUG statements in the passes.
|
||||
static cl::opt<bool, true>
|
||||
Debug("debug", cl::desc("Enable debug output"), cl::Hidden,
|
||||
cl::location(DebugFlag));
|
||||
|
||||
// Print information when destroyed, iff command line option is specified
|
||||
void StatisticBase::destroy() const {
|
||||
|
@ -21,13 +21,16 @@ using std::vector;
|
||||
|
||||
SchedDebugLevel_t SchedDebugLevel;
|
||||
|
||||
static cl::Enum<enum SchedDebugLevel_t> Opt(SchedDebugLevel,"dsched",cl::Hidden,
|
||||
"enable instruction scheduling debugging information",
|
||||
clEnumValN(Sched_NoDebugInfo, "n", "disable debug output"),
|
||||
clEnumValN(Sched_Disable, "off", "disable instruction scheduling"),
|
||||
clEnumValN(Sched_PrintMachineCode, "y", "print machine code after scheduling"),
|
||||
clEnumValN(Sched_PrintSchedTrace, "t", "print trace of scheduling actions"),
|
||||
clEnumValN(Sched_PrintSchedGraphs, "g", "print scheduling graphs"), 0);
|
||||
static cl::opt<SchedDebugLevel_t, true>
|
||||
SDL_opt("dsched", cl::Hidden, cl::location(SchedDebugLevel),
|
||||
cl::desc("enable instruction scheduling debugging information"),
|
||||
cl::values(
|
||||
clEnumValN(Sched_NoDebugInfo, "n", "disable debug output"),
|
||||
clEnumValN(Sched_Disable, "off", "disable instruction scheduling"),
|
||||
clEnumValN(Sched_PrintMachineCode, "y", "print machine code after scheduling"),
|
||||
clEnumValN(Sched_PrintSchedTrace, "t", "print trace of scheduling actions"),
|
||||
clEnumValN(Sched_PrintSchedGraphs, "g", "print scheduling graphs"),
|
||||
0));
|
||||
|
||||
|
||||
//************************* Internal Data Types *****************************/
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include "llvm/Function.h"
|
||||
#include "llvm/iPHINode.h"
|
||||
#include "Support/CommandLine.h"
|
||||
#include <iostream>
|
||||
using std::cerr;
|
||||
using std::vector;
|
||||
|
||||
@ -40,13 +39,18 @@ enum SelectDebugLevel_t {
|
||||
Select_DebugBurgTrees,
|
||||
};
|
||||
|
||||
|
||||
// Enable Debug Options to be specified on the command line
|
||||
cl::Enum<enum SelectDebugLevel_t> SelectDebugLevel("dselect", cl::Hidden,
|
||||
"enable instruction selection debugging information",
|
||||
static cl::opt<SelectDebugLevel_t>
|
||||
SelectDebugLevel("dselect", cl::Hidden,
|
||||
cl::desc("enable instruction selection debugging information"),
|
||||
cl::values(
|
||||
clEnumValN(Select_NoDebugInfo, "n", "disable debug output"),
|
||||
clEnumValN(Select_PrintMachineCode, "y", "print generated machine code"),
|
||||
clEnumValN(Select_DebugInstTrees, "i", "print debugging info for instruction selection "),
|
||||
clEnumValN(Select_DebugBurgTrees, "b", "print burg trees"), 0);
|
||||
clEnumValN(Select_DebugInstTrees, "i",
|
||||
"print debugging info for instruction selection"),
|
||||
clEnumValN(Select_DebugBurgTrees, "b", "print burg trees"),
|
||||
0));
|
||||
|
||||
|
||||
//******************** Forward Function Declarations ***********************/
|
||||
|
@ -19,12 +19,16 @@ AnalysisID FunctionLiveVarInfo::ID(AnalysisID::create<FunctionLiveVarInfo>());
|
||||
|
||||
LiveVarDebugLevel_t DEBUG_LV;
|
||||
|
||||
static cl::Enum<LiveVarDebugLevel_t> DEBUG_LV_opt(DEBUG_LV, "dlivevar", cl::Hidden,
|
||||
"enable live-variable debugging information",
|
||||
clEnumValN(LV_DEBUG_None , "n", "disable debug output"),
|
||||
clEnumValN(LV_DEBUG_Normal , "y", "enable debug output"),
|
||||
clEnumValN(LV_DEBUG_Instr, "i", "print live-var sets before/after every machine instrn"),
|
||||
clEnumValN(LV_DEBUG_Verbose, "v", "print def, use sets for every instrn also"), 0);
|
||||
static cl::opt<LiveVarDebugLevel_t, true>
|
||||
DEBUG_LV_opt("dlivevar", cl::Hidden, cl::location(DEBUG_LV),
|
||||
cl::desc("enable live-variable debugging information"),
|
||||
cl::values(
|
||||
clEnumValN(LV_DEBUG_None , "n", "disable debug output"),
|
||||
clEnumValN(LV_DEBUG_Normal , "y", "enable debug output"),
|
||||
clEnumValN(LV_DEBUG_Instr, "i", "print live-var sets before/after "
|
||||
"every machine instrn"),
|
||||
clEnumValN(LV_DEBUG_Verbose, "v", "print def, use sets for every instrn also"),
|
||||
0));
|
||||
|
||||
|
||||
|
||||
|
@ -19,25 +19,25 @@
|
||||
#include "llvm/Analysis/LoopInfo.h"
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
#include "llvm/Target/MachineFrameInfo.h"
|
||||
#include "llvm/BasicBlock.h"
|
||||
#include "llvm/Function.h"
|
||||
#include "llvm/Type.h"
|
||||
#include "llvm/iOther.h"
|
||||
#include "llvm/CodeGen/RegAllocCommon.h"
|
||||
#include "Support/CommandLine.h"
|
||||
#include "Support/STLExtras.h"
|
||||
#include <iostream>
|
||||
#include <math.h>
|
||||
using std::cerr;
|
||||
using std::vector;
|
||||
|
||||
RegAllocDebugLevel_t DEBUG_RA;
|
||||
static cl::Enum<RegAllocDebugLevel_t> DEBUG_RA_c(DEBUG_RA, "dregalloc",
|
||||
cl::Hidden,
|
||||
"enable register allocation debugging information",
|
||||
static cl::opt<RegAllocDebugLevel_t, true>
|
||||
DRA_opt("dregalloc", cl::Hidden, cl::location(DEBUG_RA),
|
||||
cl::desc("enable register allocation debugging information"),
|
||||
cl::values(
|
||||
clEnumValN(RA_DEBUG_None , "n", "disable debug output"),
|
||||
clEnumValN(RA_DEBUG_Normal , "y", "enable debug output"),
|
||||
clEnumValN(RA_DEBUG_Verbose, "v", "enable extra debug output"), 0);
|
||||
clEnumValN(RA_DEBUG_Verbose, "v", "enable extra debug output"),
|
||||
0));
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
@ -52,13 +52,18 @@ enum PtrSize {
|
||||
Ptr8bits, Ptr16bits, Ptr32bits
|
||||
};
|
||||
|
||||
static cl::Enum<enum PtrSize> ReqPointerSize("ptrsize", 0,
|
||||
"Set pointer size for -poolalloc pass",
|
||||
static cl::opt<PtrSize>
|
||||
ReqPointerSize("poolalloc-ptr-size",
|
||||
cl::desc("Set pointer size for -poolalloc pass"),
|
||||
cl::values(
|
||||
clEnumValN(Ptr32bits, "32", "Use 32 bit indices for pointers"),
|
||||
clEnumValN(Ptr16bits, "16", "Use 16 bit indices for pointers"),
|
||||
clEnumValN(Ptr8bits , "8", "Use 8 bit indices for pointers"), 0);
|
||||
clEnumValN(Ptr8bits , "8", "Use 8 bit indices for pointers"),
|
||||
0));
|
||||
|
||||
static cl::Flag DisableRLE("no-pool-load-elim", "Disable pool load elimination after poolalloc pass", cl::Hidden);
|
||||
static cl::opt<bool>
|
||||
DisableRLE("no-pool-load-elim", cl::Hidden,
|
||||
cl::desc("Disable pool load elimination after poolalloc pass"));
|
||||
|
||||
const Type *POINTERTYPE;
|
||||
|
||||
|
@ -12,8 +12,6 @@
|
||||
#include "llvm/iMemory.h"
|
||||
#include "llvm/iTerminators.h"
|
||||
#include "llvm/iOther.h"
|
||||
#include "llvm/BasicBlock.h"
|
||||
#include "llvm/Function.h"
|
||||
#include "llvm/Module.h"
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/Assembly/Writer.h"
|
||||
@ -24,11 +22,13 @@
|
||||
using std::vector;
|
||||
using std::string;
|
||||
|
||||
static cl::Flag DisablePtrHashing("tracedisablehashdisable",
|
||||
"Disable pointer hashing", cl::NoFlags);
|
||||
static cl::opt<bool>
|
||||
DisablePtrHashing("tracedisablehashdisable", cl::Hidden,
|
||||
cl::desc("Disable pointer hashing"));
|
||||
|
||||
static cl::StringList TraceFuncName ("tracefunc", "trace only specific funct"
|
||||
"ions", cl::NoFlags);
|
||||
static cl::list<string>
|
||||
TraceFuncName("tracefunc", cl::desc("trace only specific functions"),
|
||||
cl::value_desc("function"));
|
||||
|
||||
|
||||
// We trace a particular function if no functions to trace were specified
|
||||
@ -37,7 +37,7 @@ static cl::StringList TraceFuncName ("tracefunc", "trace only specific funct"
|
||||
inline bool
|
||||
TraceThisFunction(Function* func)
|
||||
{
|
||||
if (TraceFuncName.getNumOccurances() == 0)
|
||||
if (TraceFuncName.size() == 0)
|
||||
return true;
|
||||
|
||||
return std::find(TraceFuncName.begin(), TraceFuncName.end(), func->getName())
|
||||
|
@ -26,17 +26,24 @@ using std::cerr;
|
||||
// raising pass to start at instruction "foo", which is immensely useful for
|
||||
// debugging!
|
||||
//
|
||||
static cl::String StartInst("raise-start-inst", "Start raise pass at the "
|
||||
"instruction with the specified name", cl::Hidden);
|
||||
static cl::opt<std::string>
|
||||
StartInst("raise-start-inst", cl::Hidden, cl::value_desc("inst name"),
|
||||
cl::desc("Start raise pass at the instruction with the specified name"));
|
||||
|
||||
static Statistic<> NumLoadStorePeepholes("raise\t\t- Number of load/store "
|
||||
"peepholes");
|
||||
static Statistic<> NumGEPInstFormed("raise\t\t- Number of other "
|
||||
"getelementptr's formed");
|
||||
static Statistic<> NumExprTreesConv("raise\t\t- Number of expression trees"
|
||||
" converted");
|
||||
static Statistic<> NumCastOfCast("raise\t\t- Number of cast-of-self removed");
|
||||
static Statistic<> NumDCEorCP("raise\t\t- Number of insts DCEd or constprop'd");
|
||||
static Statistic<>
|
||||
NumLoadStorePeepholes("raise\t\t- Number of load/store peepholes");
|
||||
|
||||
static Statistic<>
|
||||
NumGEPInstFormed("raise\t\t- Number of other getelementptr's formed");
|
||||
|
||||
static Statistic<>
|
||||
NumExprTreesConv("raise\t\t- Number of expression trees converted");
|
||||
|
||||
static Statistic<>
|
||||
NumCastOfCast("raise\t\t- Number of cast-of-self removed");
|
||||
|
||||
static Statistic<>
|
||||
NumDCEorCP("raise\t\t- Number of insts DCEd or constprop'd");
|
||||
|
||||
|
||||
#define PRINT_PEEPHOLE(ID, NUM, I) \
|
||||
|
@ -81,8 +81,9 @@ bool PassManager::run(Module &M) { return PM->run(M); }
|
||||
// amount of time each pass takes to execute. This only happens with
|
||||
// -time-passes is enabled on the command line.
|
||||
//
|
||||
static cl::Flag EnableTiming("time-passes", "Time each pass, printing elapsed"
|
||||
" time for each on exit");
|
||||
static cl::opt<bool>
|
||||
EnableTiming("time-passes",
|
||||
cl::desc("Time each pass, printing elapsed time for each on exit"));
|
||||
|
||||
static double getTime() {
|
||||
struct timeval T;
|
||||
@ -143,24 +144,28 @@ TimingInfo::~TimingInfo() {
|
||||
|
||||
// Different debug levels that can be enabled...
|
||||
enum PassDebugLevel {
|
||||
None, PassStructure, PassExecutions, PassDetails
|
||||
None, Structure, Executions, Details
|
||||
};
|
||||
|
||||
static cl::Enum<enum PassDebugLevel> PassDebugging("debug-pass", cl::Hidden,
|
||||
"Print PassManager debugging information",
|
||||
clEnumVal(None , "disable debug output"),
|
||||
clEnumVal(PassStructure , "print pass structure before run()"),
|
||||
clEnumVal(PassExecutions, "print pass name before it is executed"),
|
||||
clEnumVal(PassDetails , "print pass details when it is executed"), 0);
|
||||
static cl::opt<enum PassDebugLevel>
|
||||
PassDebugging("debug-pass", cl::Hidden,
|
||||
cl::desc("Print PassManager debugging information"),
|
||||
cl::values(
|
||||
clEnumVal(None , "disable debug output"),
|
||||
// TODO: add option to print out pass names "PassOptions"
|
||||
clEnumVal(Structure , "print pass structure before run()"),
|
||||
clEnumVal(Executions, "print pass name before it is executed"),
|
||||
clEnumVal(Details , "print pass details when it is executed"),
|
||||
0));
|
||||
|
||||
void PMDebug::PrintPassStructure(Pass *P) {
|
||||
if (PassDebugging >= PassStructure)
|
||||
if (PassDebugging >= Structure)
|
||||
P->dumpPassStructure();
|
||||
}
|
||||
|
||||
void PMDebug::PrintPassInformation(unsigned Depth, const char *Action,
|
||||
Pass *P, Annotable *V) {
|
||||
if (PassDebugging >= PassExecutions) {
|
||||
if (PassDebugging >= Executions) {
|
||||
std::cerr << (void*)P << std::string(Depth*2+1, ' ') << Action << " '"
|
||||
<< P->getPassName();
|
||||
if (V) {
|
||||
@ -181,7 +186,7 @@ void PMDebug::PrintPassInformation(unsigned Depth, const char *Action,
|
||||
|
||||
void PMDebug::PrintAnalysisSetInfo(unsigned Depth, const char *Msg,
|
||||
Pass *P, const std::vector<AnalysisID> &Set){
|
||||
if (PassDebugging >= PassDetails && !Set.empty()) {
|
||||
if (PassDebugging >= Details && !Set.empty()) {
|
||||
std::cerr << (void*)P << std::string(Depth*2+3, ' ') << Msg << " Analyses:";
|
||||
for (unsigned i = 0; i != Set.size(); ++i) {
|
||||
Pass *P = Set[i].createPass(); // Good thing this is just debug code...
|
||||
@ -192,7 +197,7 @@ void PMDebug::PrintAnalysisSetInfo(unsigned Depth, const char *Msg,
|
||||
}
|
||||
}
|
||||
|
||||
// dumpPassStructure - Implement the -debug-passes=PassStructure option
|
||||
// dumpPassStructure - Implement the -debug-passes=Structure option
|
||||
void Pass::dumpPassStructure(unsigned Offset = 0) {
|
||||
std::cerr << std::string(Offset*2, ' ') << getPassName() << "\n";
|
||||
}
|
||||
|
@ -20,8 +20,16 @@
|
||||
|
||||
bool DebugFlag; // DebugFlag - Exported boolean set by the -debug option
|
||||
|
||||
static cl::Flag Enabled("stats", "Enable statistics output from program");
|
||||
static cl::Flag Debug(DebugFlag, "debug", "Enable debug output", cl::Hidden);
|
||||
// -stats - Command line option to cause transformations to emit stats about
|
||||
// what they did.
|
||||
//
|
||||
static cl::opt<bool>
|
||||
Enabled("stats", cl::desc("Enable statistics output from program"));
|
||||
|
||||
// -debug - Command line option to enable the DEBUG statements in the passes.
|
||||
static cl::opt<bool, true>
|
||||
Debug("debug", cl::desc("Enable debug output"), cl::Hidden,
|
||||
cl::location(DebugFlag));
|
||||
|
||||
// Print information when destroyed, iff command line option is specified
|
||||
void StatisticBase::destroy() const {
|
||||
|
@ -20,8 +20,16 @@
|
||||
|
||||
bool DebugFlag; // DebugFlag - Exported boolean set by the -debug option
|
||||
|
||||
static cl::Flag Enabled("stats", "Enable statistics output from program");
|
||||
static cl::Flag Debug(DebugFlag, "debug", "Enable debug output", cl::Hidden);
|
||||
// -stats - Command line option to cause transformations to emit stats about
|
||||
// what they did.
|
||||
//
|
||||
static cl::opt<bool>
|
||||
Enabled("stats", cl::desc("Enable statistics output from program"));
|
||||
|
||||
// -debug - Command line option to enable the DEBUG statements in the passes.
|
||||
static cl::opt<bool, true>
|
||||
Debug("debug", cl::desc("Enable debug output"), cl::Hidden,
|
||||
cl::location(DebugFlag));
|
||||
|
||||
// Print information when destroyed, iff command line option is specified
|
||||
void StatisticBase::destroy() const {
|
||||
|
@ -18,10 +18,18 @@
|
||||
#include <memory>
|
||||
using std::cerr;
|
||||
|
||||
cl::String InputFilename ("", "Parse <arg> file, compile to bytecode", 0, "-");
|
||||
cl::String OutputFilename("o", "Override output filename", cl::NoFlags, "");
|
||||
cl::Flag Force ("f", "Overwrite output files", cl::NoFlags, false);
|
||||
cl::Flag DumpAsm ("d", "Print assembly as parsed", cl::Hidden, false);
|
||||
static cl::opt<string>
|
||||
InputFilename(cl::Positional, cl::desc("<input .llvm file>"), cl::init("-"));
|
||||
|
||||
static cl::opt<string>
|
||||
OutputFilename("o", cl::desc("Override output filename"),
|
||||
cl::value_desc("filename"));
|
||||
|
||||
static cl::opt<bool>
|
||||
Force("f", cl::desc("Overwrite output files"));
|
||||
|
||||
static cl::opt<bool>
|
||||
DumpAsm("d", cl::desc("Print assembly as parsed"), cl::Hidden);
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
cl::ParseCommandLineOptions(argc, argv, " llvm .ll -> .bc assembler\n");
|
||||
|
@ -27,13 +27,22 @@ enum OutputMode {
|
||||
c, // Generate C code
|
||||
};
|
||||
|
||||
cl::String InputFilename ("", "Load <arg> file, print as assembly", 0, "-");
|
||||
cl::String OutputFilename("o", "Override output filename", cl::NoFlags, "");
|
||||
cl::Flag Force ("f", "Overwrite output files", cl::NoFlags, false);
|
||||
cl::EnumFlags<enum OutputMode> WriteMode(cl::NoFlags,
|
||||
clEnumVal(llvm, "Output LLVM assembly"),
|
||||
clEnumVal(c , "Output C code for program"),
|
||||
0);
|
||||
static cl::opt<string>
|
||||
InputFilename(cl::Positional, cl::desc("<input bytecode>"), cl::init("-"));
|
||||
|
||||
static cl::opt<string>
|
||||
OutputFilename("o", cl::desc("Override output filename"),
|
||||
cl::value_desc("filename"));
|
||||
|
||||
static cl::opt<bool>
|
||||
Force("f", cl::desc("Overwrite output files"));
|
||||
|
||||
static cl::opt<enum OutputMode>
|
||||
WriteMode(cl::desc("Specify the output format:"),
|
||||
cl::values(
|
||||
clEnumVal(llvm, "Output LLVM assembly"),
|
||||
clEnumVal(c , "Output C code for program"),
|
||||
0));
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
cl::ParseCommandLineOptions(argc, argv, " llvm .bc -> .ll disassembler\n");
|
||||
|
@ -18,8 +18,17 @@
|
||||
#include "Support/CommandLine.h"
|
||||
#include <memory>
|
||||
|
||||
static cl::String InputFilename("", "Specify input bytecode file", 0, "-");
|
||||
static cl::String ExtractFunc("func", "Specify function to extract", 0, "main");
|
||||
// InputFilename - The filename to read from.
|
||||
static cl::opt<string>
|
||||
InputFilename(cl::Positional, cl::desc("<input bytecode file>"),
|
||||
cl::init("-"), cl::value_desc("filename"));
|
||||
|
||||
|
||||
// ExtractFunc - The function to extract from the module... defaults to main.
|
||||
static cl::opt<string>
|
||||
ExtractFunc("func", cl::desc("Specify function to extract"), cl::init("main"),
|
||||
cl::value_desc("function"));
|
||||
|
||||
|
||||
struct FunctionExtractorPass : public Pass {
|
||||
const char *getPassName() const { return "Function Extractor"; }
|
||||
|
@ -23,14 +23,25 @@
|
||||
#include <fstream>
|
||||
using std::cerr;
|
||||
|
||||
static cl::String InputFilename ("", "Parse <arg> file, compile to bytecode",
|
||||
cl::Required, "");
|
||||
static cl::String OutputFilename ("o", "Override output filename");
|
||||
static cl::Int RunNPasses ("stopAfterNPasses", "Only run the first N "
|
||||
"passes of gccas", cl::Hidden);
|
||||
static cl::Flag StopAtLevelRaise("stopraise", "Stop optimization before "
|
||||
"level raise", cl::Hidden);
|
||||
static cl::Flag Verify ("verify", "Verify each pass result");
|
||||
static cl::opt<string>
|
||||
InputFilename(cl::Positional, cl::desc("<input llvm assembly>"), cl::Required);
|
||||
|
||||
static cl::opt<string>
|
||||
OutputFilename("o", cl::desc("Override output filename"),
|
||||
cl::value_desc("filename"));
|
||||
|
||||
static cl::opt<int>
|
||||
RunNPasses("stopAfterNPasses",
|
||||
cl::desc("Only run the first N passes of gccas"), cl::Hidden,
|
||||
cl::value_desc("# passes"));
|
||||
|
||||
static cl::opt<bool>
|
||||
StopAtLevelRaise("stopraise", cl::desc("Stop optimization before level raise"),
|
||||
cl::Hidden);
|
||||
|
||||
static cl::opt<bool>
|
||||
Verify("verify", cl::desc("Verify each pass result"));
|
||||
|
||||
|
||||
static inline void addPass(PassManager &PM, Pass *P) {
|
||||
static int NumPassesCreated = 0;
|
||||
|
@ -33,13 +33,28 @@
|
||||
#include <sys/stat.h>
|
||||
using std::cerr;
|
||||
|
||||
cl::StringList InputFilenames("", "Load <arg> files, linking them together",
|
||||
cl::OneOrMore);
|
||||
cl::String OutputFilename("o", "Override output filename", cl::NoFlags,"a.out");
|
||||
cl::Flag Verbose ("v", "Print information about actions taken");
|
||||
cl::StringList LibPaths ("L", "Specify a library search path", cl::ZeroOrMore);
|
||||
cl::StringList Libraries ("l", "Specify libraries to link to", cl::ZeroOrMore);
|
||||
cl::Flag Strip ("s", "Strip symbol info from executable");
|
||||
static cl::list<string>
|
||||
InputFilenames(cl::Positional, cl::desc("<input bytecode files>"),
|
||||
cl::OneOrMore);
|
||||
|
||||
static cl::opt<string>
|
||||
OutputFilename("o", cl::desc("Override output filename"), cl::init("a.out"),
|
||||
cl::value_desc("filename"));
|
||||
|
||||
static cl::opt<bool>
|
||||
Verbose("v", cl::desc("Print information about actions taken"));
|
||||
|
||||
static cl::list<string>
|
||||
LibPaths("L", cl::desc("Specify a library search path"), cl::Prefix,
|
||||
cl::value_desc("directory"));
|
||||
|
||||
static cl::list<string>
|
||||
Libraries("l", cl::desc("Specify libraries to link to"), cl::Prefix,
|
||||
cl::value_desc("library prefix"));
|
||||
|
||||
static cl::opt<bool>
|
||||
Strip("s", cl::desc("Strip symbol info from executable"));
|
||||
|
||||
|
||||
// FileExists - Return true if the specified string is an openable file...
|
||||
static inline bool FileExists(const std::string &FN) {
|
||||
@ -83,10 +98,7 @@ static inline std::auto_ptr<Module> LoadFile(const std::string &FN) {
|
||||
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
cl::ParseCommandLineOptions(argc, argv, " llvm linker for GCC\n",
|
||||
cl::EnableSingleLetterArgValue |
|
||||
cl::DisableSingleLetterArgGrouping);
|
||||
assert(InputFilenames.size() > 0 && "OneOrMore is not working");
|
||||
cl::ParseCommandLineOptions(argc, argv, " llvm linker for GCC\n");
|
||||
|
||||
unsigned BaseArg = 0;
|
||||
std::string ErrorMessage;
|
||||
|
@ -22,13 +22,25 @@
|
||||
|
||||
using std::cerr;
|
||||
|
||||
cl::StringList InputFilenames("", "Load <arg> files, linking them together",
|
||||
cl::OneOrMore);
|
||||
cl::String OutputFilename("o", "Override output filename", cl::NoFlags, "-");
|
||||
cl::Flag Force ("f", "Overwrite output files", cl::NoFlags, false);
|
||||
cl::Flag Verbose ("v", "Print information about actions taken");
|
||||
cl::Flag DumpAsm ("d", "Print assembly as linked", cl::Hidden, false);
|
||||
cl::StringList LibPaths ("L", "Specify a library search path", cl::ZeroOrMore);
|
||||
static cl::list<std::string>
|
||||
InputFilenames(cl::Positional, cl::OneOrMore,
|
||||
cl::desc("Load <arg> files, linking them together"));
|
||||
|
||||
static cl::opt<std::string>
|
||||
OutputFilename("o", cl::desc("Override output filename"), cl::init("-"),
|
||||
cl::value_desc("filename"));
|
||||
|
||||
static cl::opt<bool> Force("f", cl::desc("Overwrite output files"));
|
||||
|
||||
static cl::opt<bool>
|
||||
Verbose("v", cl::desc("Print information about actions taken"));
|
||||
|
||||
static cl::opt<bool>
|
||||
DumpAsm("d", cl::desc("Print assembly as linked"), cl::Hidden);
|
||||
|
||||
static cl::list<std::string>
|
||||
LibPaths("L", cl::desc("Specify a library search path"), cl::ZeroOrMore,
|
||||
cl::value_desc("directory"), cl::Prefix);
|
||||
|
||||
// FileExists - Return true if the specified string is an openable file...
|
||||
static inline bool FileExists(const std::string &FN) {
|
||||
@ -74,9 +86,7 @@ static inline std::auto_ptr<Module> LoadFile(const std::string &FN) {
|
||||
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
cl::ParseCommandLineOptions(argc, argv, " llvm linker\n",
|
||||
cl::EnableSingleLetterArgValue |
|
||||
cl::DisableSingleLetterArgGrouping);
|
||||
cl::ParseCommandLineOptions(argc, argv, " llvm linker\n");
|
||||
assert(InputFilenames.size() > 0 && "OneOrMore is not working");
|
||||
|
||||
unsigned BaseArg = 0;
|
||||
|
@ -24,22 +24,33 @@
|
||||
using std::string;
|
||||
using std::cerr;
|
||||
|
||||
static cl::String InputFilename ("", "Input filename", cl::NoFlags, "-");
|
||||
static cl::String OutputFilename("o", "Output filename", cl::NoFlags, "");
|
||||
static cl::Flag Force ("f", "Overwrite output files");
|
||||
static cl::Flag DumpAsm ("d", "Print bytecode before native code generation", cl::Hidden);
|
||||
static cl::String TraceLibPath ("tracelibpath", "Path to libinstr for trace code", cl::Hidden, "");
|
||||
static cl::opt<string>
|
||||
InputFilename(cl::Positional, cl::desc("<input bytecode>"), cl::init("-"));
|
||||
|
||||
static cl::opt<string>
|
||||
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>
|
||||
DumpAsm("d", cl::desc("Print bytecode before native code generation"),
|
||||
cl::Hidden);
|
||||
|
||||
static cl::opt<string>
|
||||
TraceLibPath("tracelibpath", cl::desc("Path to libinstr for trace code"),
|
||||
cl::value_desc("directory"), cl::Hidden);
|
||||
|
||||
enum TraceLevel {
|
||||
TraceOff, TraceFunctions, TraceBasicBlocks
|
||||
};
|
||||
|
||||
static cl::Enum<enum TraceLevel> TraceValues("trace", cl::NoFlags,
|
||||
"Trace values through functions or basic blocks",
|
||||
static cl::opt<TraceLevel>
|
||||
TraceValues("trace", cl::desc("Trace values through functions or basic blocks"),
|
||||
cl::values(
|
||||
clEnumValN(TraceOff , "off", "Disable trace code"),
|
||||
clEnumValN(TraceFunctions , "function", "Trace each function"),
|
||||
clEnumValN(TraceBasicBlocks, "basicblock", "Trace each basic block"), 0);
|
||||
|
||||
clEnumValN(TraceBasicBlocks, "basicblock", "Trace each basic block"),
|
||||
0));
|
||||
|
||||
// GetFileNameRoot - Helper function to get the basename of a filename...
|
||||
static inline string GetFileNameRoot(const string &InputFilename) {
|
||||
|
@ -10,12 +10,27 @@
|
||||
#include "Interpreter.h"
|
||||
#include "Support/CommandLine.h"
|
||||
|
||||
cl::StringList InputArgv("" , "Input command line", cl::ConsumeAfter);
|
||||
cl::String MainFunction ("f" , "Function to execute", cl::NoFlags, "main");
|
||||
cl::Flag DebugMode ("debug" , "Start program in debugger");
|
||||
cl::Alias DebugModeA ("d" , "Alias for -debug", cl::NoFlags, DebugMode);
|
||||
cl::Flag TraceMode ("trace" , "Enable Tracing");
|
||||
cl::Flag ProfileMode ("profile", "Enable Profiling [unimp]");
|
||||
static cl::opt<string>
|
||||
InputFile(cl::desc("<input bytecode>"), cl::Positional, cl::init("-"));
|
||||
|
||||
static cl::list<std::string>
|
||||
InputArgv(cl::ConsumeAfter, cl::desc("<program arguments>..."));
|
||||
|
||||
static cl::opt<string>
|
||||
MainFunction ("f", cl::desc("Function to execute"), cl::init("main"),
|
||||
cl::value_desc("function name"));
|
||||
|
||||
static cl::opt<bool>
|
||||
DebugMode("debug", cl::desc("Start program in debugger"));
|
||||
|
||||
static cl::alias
|
||||
DebugModeA("d", cl::desc("Alias for -debug"), cl::aliasopt(DebugMode));
|
||||
|
||||
static cl::opt<bool>
|
||||
TraceMode("trace", cl::desc("Enable Tracing"));
|
||||
|
||||
static cl::opt<bool>
|
||||
ProfileMode("profile", cl::desc("Enable Profiling [unimp]"));
|
||||
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
@ -24,7 +39,7 @@ cl::Flag ProfileMode ("profile", "Enable Profiling [unimp]");
|
||||
Interpreter::Interpreter() : ExitCode(0), Profile(ProfileMode),
|
||||
Trace(TraceMode), CurFrame(-1) {
|
||||
CurMod = 0;
|
||||
loadModule(InputArgv.size() ? InputArgv[0] : "-");
|
||||
loadModule(InputFile);
|
||||
|
||||
// Initialize the "backend"
|
||||
initializeExecutionEngine();
|
||||
@ -37,6 +52,12 @@ Interpreter::Interpreter() : ExitCode(0), Profile(ProfileMode),
|
||||
int main(int argc, char** argv) {
|
||||
cl::ParseCommandLineOptions(argc, argv, " llvm interpreter\n");
|
||||
|
||||
// Add the module name to the start of the argv vector...
|
||||
//
|
||||
InputArgv.insert(InputArgv.begin(), InputFile);
|
||||
|
||||
|
||||
|
||||
// Create the interpreter...
|
||||
Interpreter I;
|
||||
|
||||
@ -52,13 +73,6 @@ int main(int argc, char** argv) {
|
||||
if (ProfileMode) I.enableProfiling();
|
||||
if (TraceMode) I.enableTracing();
|
||||
|
||||
// Ensure that there is at least one argument... the name of the program.
|
||||
// This is only unavailable if the program was read from stdin, instead of a
|
||||
// file.
|
||||
//
|
||||
if (InputArgv.empty())
|
||||
InputArgv.push_back("from-stdin-prog");
|
||||
|
||||
// Start interpreter into the main function...
|
||||
//
|
||||
if (!I.callMainMethod(MainFunction, InputArgv) && !DebugMode) {
|
||||
|
@ -18,10 +18,18 @@
|
||||
#include <memory>
|
||||
using std::cerr;
|
||||
|
||||
cl::String InputFilename ("", "Parse <arg> file, compile to bytecode", 0, "-");
|
||||
cl::String OutputFilename("o", "Override output filename", cl::NoFlags, "");
|
||||
cl::Flag Force ("f", "Overwrite output files", cl::NoFlags, false);
|
||||
cl::Flag DumpAsm ("d", "Print assembly as parsed", cl::Hidden, false);
|
||||
static cl::opt<string>
|
||||
InputFilename(cl::Positional, cl::desc("<input .llvm file>"), cl::init("-"));
|
||||
|
||||
static cl::opt<string>
|
||||
OutputFilename("o", cl::desc("Override output filename"),
|
||||
cl::value_desc("filename"));
|
||||
|
||||
static cl::opt<bool>
|
||||
Force("f", cl::desc("Overwrite output files"));
|
||||
|
||||
static cl::opt<bool>
|
||||
DumpAsm("d", cl::desc("Print assembly as parsed"), cl::Hidden);
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
cl::ParseCommandLineOptions(argc, argv, " llvm .ll -> .bc assembler\n");
|
||||
|
@ -18,10 +18,18 @@
|
||||
#include <memory>
|
||||
using std::cerr;
|
||||
|
||||
cl::String InputFilename ("", "Parse <arg> file, compile to bytecode", 0, "-");
|
||||
cl::String OutputFilename("o", "Override output filename", cl::NoFlags, "");
|
||||
cl::Flag Force ("f", "Overwrite output files", cl::NoFlags, false);
|
||||
cl::Flag DumpAsm ("d", "Print assembly as parsed", cl::Hidden, false);
|
||||
static cl::opt<string>
|
||||
InputFilename(cl::Positional, cl::desc("<input .llvm file>"), cl::init("-"));
|
||||
|
||||
static cl::opt<string>
|
||||
OutputFilename("o", cl::desc("Override output filename"),
|
||||
cl::value_desc("filename"));
|
||||
|
||||
static cl::opt<bool>
|
||||
Force("f", cl::desc("Overwrite output files"));
|
||||
|
||||
static cl::opt<bool>
|
||||
DumpAsm("d", cl::desc("Print assembly as parsed"), cl::Hidden);
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
cl::ParseCommandLineOptions(argc, argv, " llvm .ll -> .bc assembler\n");
|
||||
|
@ -27,13 +27,22 @@ enum OutputMode {
|
||||
c, // Generate C code
|
||||
};
|
||||
|
||||
cl::String InputFilename ("", "Load <arg> file, print as assembly", 0, "-");
|
||||
cl::String OutputFilename("o", "Override output filename", cl::NoFlags, "");
|
||||
cl::Flag Force ("f", "Overwrite output files", cl::NoFlags, false);
|
||||
cl::EnumFlags<enum OutputMode> WriteMode(cl::NoFlags,
|
||||
clEnumVal(llvm, "Output LLVM assembly"),
|
||||
clEnumVal(c , "Output C code for program"),
|
||||
0);
|
||||
static cl::opt<string>
|
||||
InputFilename(cl::Positional, cl::desc("<input bytecode>"), cl::init("-"));
|
||||
|
||||
static cl::opt<string>
|
||||
OutputFilename("o", cl::desc("Override output filename"),
|
||||
cl::value_desc("filename"));
|
||||
|
||||
static cl::opt<bool>
|
||||
Force("f", cl::desc("Overwrite output files"));
|
||||
|
||||
static cl::opt<enum OutputMode>
|
||||
WriteMode(cl::desc("Specify the output format:"),
|
||||
cl::values(
|
||||
clEnumVal(llvm, "Output LLVM assembly"),
|
||||
clEnumVal(c , "Output C code for program"),
|
||||
0));
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
cl::ParseCommandLineOptions(argc, argv, " llvm .bc -> .ll disassembler\n");
|
||||
|
@ -27,13 +27,22 @@ enum OutputMode {
|
||||
c, // Generate C code
|
||||
};
|
||||
|
||||
cl::String InputFilename ("", "Load <arg> file, print as assembly", 0, "-");
|
||||
cl::String OutputFilename("o", "Override output filename", cl::NoFlags, "");
|
||||
cl::Flag Force ("f", "Overwrite output files", cl::NoFlags, false);
|
||||
cl::EnumFlags<enum OutputMode> WriteMode(cl::NoFlags,
|
||||
clEnumVal(llvm, "Output LLVM assembly"),
|
||||
clEnumVal(c , "Output C code for program"),
|
||||
0);
|
||||
static cl::opt<string>
|
||||
InputFilename(cl::Positional, cl::desc("<input bytecode>"), cl::init("-"));
|
||||
|
||||
static cl::opt<string>
|
||||
OutputFilename("o", cl::desc("Override output filename"),
|
||||
cl::value_desc("filename"));
|
||||
|
||||
static cl::opt<bool>
|
||||
Force("f", cl::desc("Overwrite output files"));
|
||||
|
||||
static cl::opt<enum OutputMode>
|
||||
WriteMode(cl::desc("Specify the output format:"),
|
||||
cl::values(
|
||||
clEnumVal(llvm, "Output LLVM assembly"),
|
||||
clEnumVal(c , "Output C code for program"),
|
||||
0));
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
cl::ParseCommandLineOptions(argc, argv, " llvm .bc -> .ll disassembler\n");
|
||||
|
@ -18,8 +18,17 @@
|
||||
#include "Support/CommandLine.h"
|
||||
#include <memory>
|
||||
|
||||
static cl::String InputFilename("", "Specify input bytecode file", 0, "-");
|
||||
static cl::String ExtractFunc("func", "Specify function to extract", 0, "main");
|
||||
// InputFilename - The filename to read from.
|
||||
static cl::opt<string>
|
||||
InputFilename(cl::Positional, cl::desc("<input bytecode file>"),
|
||||
cl::init("-"), cl::value_desc("filename"));
|
||||
|
||||
|
||||
// ExtractFunc - The function to extract from the module... defaults to main.
|
||||
static cl::opt<string>
|
||||
ExtractFunc("func", cl::desc("Specify function to extract"), cl::init("main"),
|
||||
cl::value_desc("function"));
|
||||
|
||||
|
||||
struct FunctionExtractorPass : public Pass {
|
||||
const char *getPassName() const { return "Function Extractor"; }
|
||||
|
@ -22,13 +22,25 @@
|
||||
|
||||
using std::cerr;
|
||||
|
||||
cl::StringList InputFilenames("", "Load <arg> files, linking them together",
|
||||
cl::OneOrMore);
|
||||
cl::String OutputFilename("o", "Override output filename", cl::NoFlags, "-");
|
||||
cl::Flag Force ("f", "Overwrite output files", cl::NoFlags, false);
|
||||
cl::Flag Verbose ("v", "Print information about actions taken");
|
||||
cl::Flag DumpAsm ("d", "Print assembly as linked", cl::Hidden, false);
|
||||
cl::StringList LibPaths ("L", "Specify a library search path", cl::ZeroOrMore);
|
||||
static cl::list<std::string>
|
||||
InputFilenames(cl::Positional, cl::OneOrMore,
|
||||
cl::desc("Load <arg> files, linking them together"));
|
||||
|
||||
static cl::opt<std::string>
|
||||
OutputFilename("o", cl::desc("Override output filename"), cl::init("-"),
|
||||
cl::value_desc("filename"));
|
||||
|
||||
static cl::opt<bool> Force("f", cl::desc("Overwrite output files"));
|
||||
|
||||
static cl::opt<bool>
|
||||
Verbose("v", cl::desc("Print information about actions taken"));
|
||||
|
||||
static cl::opt<bool>
|
||||
DumpAsm("d", cl::desc("Print assembly as linked"), cl::Hidden);
|
||||
|
||||
static cl::list<std::string>
|
||||
LibPaths("L", cl::desc("Specify a library search path"), cl::ZeroOrMore,
|
||||
cl::value_desc("directory"), cl::Prefix);
|
||||
|
||||
// FileExists - Return true if the specified string is an openable file...
|
||||
static inline bool FileExists(const std::string &FN) {
|
||||
@ -74,9 +86,7 @@ static inline std::auto_ptr<Module> LoadFile(const std::string &FN) {
|
||||
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
cl::ParseCommandLineOptions(argc, argv, " llvm linker\n",
|
||||
cl::EnableSingleLetterArgValue |
|
||||
cl::DisableSingleLetterArgGrouping);
|
||||
cl::ParseCommandLineOptions(argc, argv, " llvm linker\n");
|
||||
assert(InputFilenames.size() > 0 && "OneOrMore is not working");
|
||||
|
||||
unsigned BaseArg = 0;
|
||||
|
@ -123,13 +123,27 @@ struct {
|
||||
|
||||
// Command line option handling code...
|
||||
//
|
||||
cl::String InputFilename ("", "Load <arg> file to optimize", cl::NoFlags, "-");
|
||||
cl::String OutputFilename("o", "Override output filename", cl::NoFlags, "");
|
||||
cl::Flag Force ("f", "Overwrite output files", cl::NoFlags, false);
|
||||
cl::Flag PrintEachXForm("p", "Print module after each transformation");
|
||||
cl::Flag Quiet ("q", "Don't print modifying pass names", 0, false);
|
||||
cl::Alias QuietA ("quiet", "Alias for -q", cl::NoFlags, Quiet);
|
||||
cl::EnumList<enum Opts> OptimizationList(cl::NoFlags,
|
||||
static cl::opt<string>
|
||||
InputFilename(cl::Positional, cl::desc("<input bytecode>"), cl::init("-"));
|
||||
|
||||
static cl::opt<string>
|
||||
OutputFilename("o", cl::desc("Override output filename"),
|
||||
cl::value_desc("filename"));
|
||||
|
||||
static cl::opt<bool>
|
||||
Force("f", cl::desc("Overwrite output files"));
|
||||
|
||||
static cl::opt<bool>
|
||||
PrintEachXForm("p", cl::desc("Print module after each transformation"));
|
||||
|
||||
static cl::opt<bool>
|
||||
Quiet("q", cl::desc("Don't print modifying pass names"));
|
||||
|
||||
static cl::alias
|
||||
QuietA("quiet", cl::desc("Alias for -q"), cl::aliasopt(Quiet));
|
||||
|
||||
static cl::list<enum Opts>
|
||||
OptimizationList(cl::desc("Optimizations available:"), cl::values(
|
||||
clEnumVal(dce , "Dead Code Elimination"),
|
||||
clEnumVal(die , "Dead Instruction Elimination"),
|
||||
clEnumVal(constprop , "Simple constant propogation"),
|
||||
@ -169,7 +183,7 @@ cl::EnumList<enum Opts> OptimizationList(cl::NoFlags,
|
||||
clEnumVal(printm , "Print working module to stderr"),
|
||||
clEnumVal(verify , "Verify module is well formed"),
|
||||
clEnumVal(lowerrefs , "Decompose multi-dimensional structure/array refs to use one index per instruction"),
|
||||
0);
|
||||
0));
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user