mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-25 12:50:00 +00:00
Update makefile for more accurate deps
Include support to print out Expression types git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
37bf6308ab
commit
1546bff423
@ -5,6 +5,8 @@ all:: analyze
|
||||
clean ::
|
||||
rm -f analyze
|
||||
|
||||
analyze : $(ObjectsG) Debug/.dir Depend/.dir
|
||||
LIBDEPS = ../../lib/Optimizations/Debug/libopt.a ../../lib/Analysis/Debug/libanalysis.a
|
||||
|
||||
analyze : $(ObjectsG) Debug/.dir Depend/.dir $(LIBDEPS)
|
||||
$(LinkG) -o $@ $(ObjectsG) -lopt -lasmparser \
|
||||
-lbcreader -lvmcore -lasmwriter -lanalysis
|
||||
-lbcreader -lvmcore -lasmwriter -lanalysis -lopt
|
||||
|
@ -11,7 +11,9 @@
|
||||
//===------------------------------------------------------------------------===
|
||||
|
||||
#include <iostream>
|
||||
#include "llvm/Instruction.h"
|
||||
#include "llvm/Module.h"
|
||||
#include "llvm/Method.h"
|
||||
#include "llvm/Bytecode/Reader.h"
|
||||
#include "llvm/Assembly/Parser.h"
|
||||
#include "llvm/Tools/CommandLine.h"
|
||||
@ -19,6 +21,7 @@
|
||||
|
||||
#include "llvm/Analysis/Dominators.h"
|
||||
#include "llvm/Analysis/IntervalPartition.h"
|
||||
#include "llvm/Analysis/Expressions.h"
|
||||
|
||||
static void PrintMethod(Method *M) {
|
||||
cout << M;
|
||||
@ -28,6 +31,34 @@ static void PrintIntervalPartition(Method *M) {
|
||||
cout << cfg::IntervalPartition(M);
|
||||
}
|
||||
|
||||
static void PrintClassifiedExprs(Method *M) {
|
||||
cout << "Classified expressions for: " << M->getName() << endl;
|
||||
Method::inst_iterator I = M->inst_begin(), E = M->inst_end();
|
||||
for (; I != E; ++I) {
|
||||
cout << *I;
|
||||
|
||||
if ((*I)->getType() == Type::VoidTy) continue;
|
||||
ExprAnalysisResult R = ClassifyExpression(*I);
|
||||
if (R.Var == *I) continue; // Doesn't tell us anything
|
||||
|
||||
cout << "\t\tExpr =";
|
||||
switch (R.ExprType) {
|
||||
case ExprAnalysisResult::ScaledLinear:
|
||||
WriteAsOperand(cout, (Value*)R.Scale) << " *";
|
||||
// fall through
|
||||
case ExprAnalysisResult::Linear:
|
||||
WriteAsOperand(cout, R.Var);
|
||||
if (R.Offset == 0) break;
|
||||
else cout << " +";
|
||||
// fall through
|
||||
case ExprAnalysisResult::Constant:
|
||||
if (R.Offset) WriteAsOperand(cout, (Value*)R.Offset); else cout << " 0";
|
||||
break;
|
||||
}
|
||||
cout << endl << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void PrintDominatorSets(Method *M) {
|
||||
cout << cfg::DominatorSet(M);
|
||||
@ -61,6 +92,7 @@ struct {
|
||||
} AnTable[] = {
|
||||
{ "-print" , "Print each Method" , PrintMethod },
|
||||
{ "-intervals" , "Interval Partition" , PrintIntervalPartition },
|
||||
{ "-exprclassify" , "Classify Expressions" , PrintClassifiedExprs },
|
||||
|
||||
{ "-domset" , "Dominator Sets" , PrintDominatorSets },
|
||||
{ "-idom" , "Immediate Dominators" , PrintImmediateDominators },
|
||||
@ -102,8 +134,9 @@ int main(int argc, char **argv) {
|
||||
// Loop over all of the methods in the module...
|
||||
for (Module::iterator I = C->begin(), E = C->end(); I != E; ++I) {
|
||||
Method *M = *I;
|
||||
if (M->isExternal()) continue;
|
||||
|
||||
// Loop over all of the optimizations to be run...
|
||||
// Loop over all of the analyses to be run...
|
||||
for (int i = 1; i < argc; i++) {
|
||||
if (argv[i] == 0) continue;
|
||||
unsigned j;
|
||||
|
Loading…
Reference in New Issue
Block a user