summaryrefslogtreecommitdiff
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-07-23 02:35:57 +0000
committerChris Lattner <sabre@nondot.org>2001-07-23 02:35:57 +0000
commit8f367bd3c0f56b7b318c46cee04f77735f617777 (patch)
treeef00b00e2465f9168bbbd83fd2ebef8fa857146f /lib/CodeGen
parenta28504313d4c3fe87173a71b511dd4c8e25c3312 (diff)
downloadllvm-8f367bd3c0f56b7b318c46cee04f77735f617777.tar.gz
llvm-8f367bd3c0f56b7b318c46cee04f77735f617777.tar.bz2
llvm-8f367bd3c0f56b7b318c46cee04f77735f617777.tar.xz
Large scale changes to implement new command line argument facility
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/InstrSelection/InstrSelection.cpp24
1 files changed, 17 insertions, 7 deletions
diff --git a/lib/CodeGen/InstrSelection/InstrSelection.cpp b/lib/CodeGen/InstrSelection/InstrSelection.cpp
index 4843a70dce..0ad1dbdb54 100644
--- a/lib/CodeGen/InstrSelection/InstrSelection.cpp
+++ b/lib/CodeGen/InstrSelection/InstrSelection.cpp
@@ -10,8 +10,6 @@
//***************************************************************************
-//*************************** User Include Files ***************************/
-
#include "llvm/CodeGen/InstrSelection.h"
#include "llvm/Method.h"
#include "llvm/BasicBlock.h"
@@ -20,7 +18,20 @@
#include "llvm/Instruction.h"
#include "llvm/LLC/CompileContext.h"
#include "llvm/CodeGen/MachineInstr.h"
+#include "llvm/Tools/CommandLine.h"
+
+enum DebugLev {
+ NoDebugInfo,
+ DebugInstTrees,
+ DebugBurgTrees,
+};
+// Enable Debug Options to be specified on the command line
+cl::Enum<enum DebugLev> DebugLevel("debug_select", cl::NoFlags, // cl::Hidden
+ "enable instruction selection debugging information",
+ clEnumVal(NoDebugInfo , "disable debug output"),
+ clEnumVal(DebugInstTrees, "print instruction trees"),
+ clEnumVal(DebugBurgTrees, "print burg trees"), 0);
//************************* Forward Declarations ***************************/
@@ -36,8 +47,7 @@ static bool SelectInstructionsForTree(BasicTreeNode* treeRoot, int goalnt,
// Returns true if instruction selection failed, false otherwise.
//---------------------------------------------------------------------------
-bool SelectInstructionsForMethod(Method* method, CompileContext& ccontext,
- int DebugLevel) {
+bool SelectInstructionsForMethod(Method* method, CompileContext& ccontext) {
bool failed = false;
InstrForest instrForest;
@@ -59,7 +69,7 @@ bool SelectInstructionsForMethod(Method* method, CompileContext& ccontext,
// Invoke BURM to label each tree node with a state
(void) burm_label(basicNode);
- if (DebugLevel >= DEBUG_BURG_TREES)
+ if (DebugLevel.getValue() >= DebugBurgTrees)
{
printcover(basicNode, 1, 0);
cerr << "\nCover cost == " << treecost(basicNode, 1, 0) << "\n\n";
@@ -76,7 +86,7 @@ bool SelectInstructionsForMethod(Method* method, CompileContext& ccontext,
if (!failed)
{
- if (DebugLevel >= DEBUG_INSTR_TREES)
+ if (DebugLevel.getValue() >= DebugInstTrees)
{
cout << "\n\n*** Instruction trees for method "
<< (method->hasName()? method->getName() : "")
@@ -84,7 +94,7 @@ bool SelectInstructionsForMethod(Method* method, CompileContext& ccontext,
instrForest.dump();
}
- if (DebugLevel >= DEBUG_TREES_NONE)
+ if (DebugLevel.getValue() > NoDebugInfo)
PrintMachineInstructions(method);
}