aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/analyze/analyze.cpp36
-rw-r--r--tools/dis/dis.cpp30
-rw-r--r--tools/gccld/gccld.cpp10
-rw-r--r--tools/link/link.cpp1
-rw-r--r--tools/llc/llc.cpp12
-rw-r--r--tools/llvm-dis/dis.cpp30
-rw-r--r--tools/llvm-dis/llvm-dis.cpp30
-rw-r--r--tools/llvm-link/llvm-link.cpp1
8 files changed, 78 insertions, 72 deletions
diff --git a/tools/analyze/analyze.cpp b/tools/analyze/analyze.cpp
index 48a600f14b..0a6ecf81af 100644
--- a/tools/analyze/analyze.cpp
+++ b/tools/analyze/analyze.cpp
@@ -12,7 +12,7 @@
#include "llvm/Instruction.h"
#include "llvm/Module.h"
-#include "llvm/Method.h"
+#include "llvm/Function.h"
#include "llvm/iPHINode.h"
#include "llvm/PassManager.h"
#include "llvm/Bytecode/Reader.h"
@@ -47,7 +47,7 @@ static void printPass(PassType &P, ostream &O, Module *M) {
}
template<class PassType>
-static void printPass(PassType &P, ostream &O, Method *M) {
+static void printPass(PassType &P, ostream &O, Function *F) {
O << P;
}
@@ -102,9 +102,9 @@ class PassPrinter<MethodPass, PassName> : public MethodPass {
public:
PassPrinter(const string &M, AnalysisID id) : Message(M), ID(id) {}
- virtual bool runOnMethod(Method *M) {
- std::cout << Message << " on method '" << M->getName() << "'\n";
- printPass(getAnalysis<PassName>(ID), std::cout, M);
+ virtual bool runOnMethod(Function *F) {
+ std::cout << Message << " on method '" << F->getName() << "'\n";
+ printPass(getAnalysis<PassName>(ID), std::cout, F);
return false;
}
@@ -128,7 +128,7 @@ Pass *New(const string &Message) {
-Pass *NewPrintMethod(const string &Message) {
+Pass *NewPrintFunction(const string &Message) {
return new PrintMethodPass(Message, &std::cout);
}
Pass *NewPrintModule(const string &Message) {
@@ -136,15 +136,15 @@ Pass *NewPrintModule(const string &Message) {
}
struct InstForest : public MethodPass {
- void doit(Method *M) {
- std::cout << analysis::InstForest<char>(M);
+ void doit(Function *F) {
+ std::cout << analysis::InstForest<char>(F);
}
};
struct IndVars : public MethodPass {
- void doit(Method *M) {
+ void doit(Function *F) {
cfg::LoopInfo &LI = getAnalysis<cfg::LoopInfo>();
- for (inst_iterator I = inst_begin(M), E = inst_end(M); I != E; ++I)
+ for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I)
if (PHINode *PN = dyn_cast<PHINode>(*I)) {
InductionVariable IV(PN, &LI);
if (IV.InductionType != InductionVariable::Unknown)
@@ -159,9 +159,9 @@ struct IndVars : public MethodPass {
};
struct Exprs : public MethodPass {
- static void doit(Method *M) {
- std::cout << "Classified expressions for: " << M->getName() << "\n";
- for (inst_iterator I = inst_begin(M), E = inst_end(M); I != E; ++I) {
+ static void doit(Function *F) {
+ std::cout << "Classified expressions for: " << F->getName() << "\n";
+ for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I) {
std::cout << *I;
if ((*I)->getType() == Type::VoidTy) continue;
@@ -195,10 +195,10 @@ class PrinterPass : public TraitClass {
public:
PrinterPass(const string &M) : Message(M) {}
- virtual bool runOnMethod(Method *M) {
- std::cout << Message << " on method '" << M->getName() << "'\n";
+ virtual bool runOnMethod(Function *F) {
+ std::cout << Message << " on method '" << F->getName() << "'\n";
- TraitClass::doit(M);
+ TraitClass::doit(F);
return false;
}
};
@@ -226,7 +226,7 @@ cl::String InputFilename ("", "Load <arg> file to analyze", cl::NoFlags, "-");
cl::Flag Quiet ("q", "Don't print analysis pass names");
cl::Alias QuietA ("quiet", "Alias for -q", cl::NoFlags, Quiet);
cl::EnumList<enum Ans> AnalysesList(cl::NoFlags,
- clEnumVal(print , "Print each method"),
+ clEnumVal(print , "Print each function"),
clEnumVal(intervals , "Print Interval Partitions"),
clEnumVal(exprs , "Classify Expressions"),
clEnumVal(instforest , "Print Instruction Forest"),
@@ -256,7 +256,7 @@ struct {
Pass *(*PassConstructor)(const string &Message);
} AnTable[] = {
// Global analyses
- { print , NewPrintMethod },
+ { print , NewPrintFunction },
{ intervals , New<MethodPass, cfg::IntervalPartition> },
{ loops , New<MethodPass, cfg::LoopInfo> },
{ instforest , Create<PrinterPass<InstForest> > },
diff --git a/tools/dis/dis.cpp b/tools/dis/dis.cpp
index 61cea325e2..9aa15dc827 100644
--- a/tools/dis/dis.cpp
+++ b/tools/dis/dis.cpp
@@ -19,7 +19,7 @@
#include "llvm/Module.h"
#include "llvm/Assembly/Writer.h"
#include "llvm/Bytecode/Reader.h"
-#include "llvm/Method.h"
+#include "llvm/Function.h"
#include "llvm/Support/CFG.h"
#include "Support/DepthFirstIterator.h"
#include "Support/PostOrderIterator.h"
@@ -30,7 +30,7 @@ using std::cerr;
// OutputMode - The different orderings to print basic blocks in...
enum OutputMode {
- Default = 0, // Method Order (list order)
+ Default = 0, // Function Order (list order)
dfo, // Depth First ordering
rdfo, // Reverse Depth First ordering
po, // Post Order
@@ -52,8 +52,8 @@ int main(int argc, char **argv) {
cl::ParseCommandLineOptions(argc, argv, " llvm .bc -> .ll disassembler\n");
std::ostream *Out = &std::cout; // Default to printing to stdout...
- Module *C = ParseBytecodeFile(InputFilename);
- if (C == 0) {
+ Module *M = ParseBytecodeFile(InputFilename);
+ if (M == 0) {
cerr << "bytecode didn't read correctly.\n";
return 1;
}
@@ -100,32 +100,32 @@ int main(int argc, char **argv) {
// what the writer library is supposed to do...
//
if (WriteMode == Default) {
- (*Out) << C; // Print out in list order
+ (*Out) << M; // Print out in list order
} else {
// TODO: This does not print anything other than the basic blocks in the
- // methods... more should definately be printed. It should be valid output
- // consumable by the assembler.
+ // functions... more should definately be printed. It should be valid
+ // output consumable by the assembler.
//
- for (Module::iterator I = C->begin(), End = C->end(); I != End; ++I) {
- Method *M = *I;
- (*Out) << "-------------- Method: " << M->getName() << " -------------\n";
+ for (Module::iterator I = M->begin(), End = M->end(); I != End; ++I) {
+ Function *F = *I;
+ (*Out) << "-------------- Method: " << F->getName() << " -------------\n";
switch (WriteMode) {
case dfo: // Depth First ordering
- copy(df_begin(M), df_end(M),
+ copy(df_begin(F), df_end(F),
std::ostream_iterator<BasicBlock*>(*Out, "\n"));
break;
case rdfo: // Reverse Depth First ordering
- copy(df_begin(M, true), df_end(M),
+ copy(df_begin(F, true), df_end(F),
std::ostream_iterator<BasicBlock*>(*Out, "\n"));
break;
case po: // Post Order
- copy(po_begin(M), po_end(M),
+ copy(po_begin(F), po_end(F),
std::ostream_iterator<BasicBlock*>(*Out, "\n"));
break;
case rpo: { // Reverse Post Order
#if 0 // FIXME, GCC 3.0.4 bug
- ReversePostOrderTraversal<Method*> RPOT(M());
+ ReversePostOrderTraversal<Function*> RPOT(F);
copy(RPOT.begin(), RPOT.end(),
std::ostream_iterator<BasicBlock*>(*Out, "\n"));
#endif
@@ -137,7 +137,7 @@ int main(int argc, char **argv) {
}
}
}
- delete C;
+ delete M;
if (Out != &std::cout) delete Out;
return 0;
diff --git a/tools/gccld/gccld.cpp b/tools/gccld/gccld.cpp
index cb77bb03c0..d00687fcec 100644
--- a/tools/gccld/gccld.cpp
+++ b/tools/gccld/gccld.cpp
@@ -18,7 +18,6 @@
#include "llvm/Bytecode/Reader.h"
#include "llvm/Bytecode/Writer.h"
#include "llvm/Module.h"
-#include "llvm/Method.h"
#include "Support/CommandLine.h"
#include <fstream>
#include <memory>
@@ -116,6 +115,15 @@ int main(int argc, char **argv) {
}
}
+ // Now that composite has been compiled, scan through the module, looking for
+ // a main function. If main is defined, mark all other functions internal.
+ //
+
+ // Next run globaldce...
+
+ // next ?
+
+
std::ofstream Out((OutputFilename+".bc").c_str());
if (!Out.good()) {
cerr << "Error opening '" << OutputFilename << ".bc' for writing!\n";
diff --git a/tools/link/link.cpp b/tools/link/link.cpp
index bdd04685ce..ec77b42eff 100644
--- a/tools/link/link.cpp
+++ b/tools/link/link.cpp
@@ -14,7 +14,6 @@
#include "llvm/Bytecode/Writer.h"
#include "llvm/Assembly/Writer.h"
#include "llvm/Module.h"
-#include "llvm/Method.h"
#include "Support/CommandLine.h"
#include <fstream>
#include <memory>
diff --git a/tools/llc/llc.cpp b/tools/llc/llc.cpp
index 140151b69f..819c80a279 100644
--- a/tools/llc/llc.cpp
+++ b/tools/llc/llc.cpp
@@ -15,7 +15,7 @@
#include "llvm/Bytecode/WriteBytecodePass.h"
#include "llvm/Transforms/ConstantMerge.h"
#include "llvm/Module.h"
-#include "llvm/Method.h"
+#include "llvm/Function.h"
#include "llvm/PassManager.h"
#include "Support/CommandLine.h"
#include <memory>
@@ -29,13 +29,13 @@ static cl::Flag Force ("f", "Overwrite output files");
static cl::Flag DumpAsm ("d", "Print bytecode before native code generation", cl::Hidden);
enum TraceLevel {
- TraceOff, TraceMethods, TraceBasicBlocks
+ TraceOff, TraceFunctions, TraceBasicBlocks
};
static cl::Enum<enum TraceLevel> TraceValues("trace", cl::NoFlags,
- "Trace values through methods or basic blocks",
+ "Trace values through functions or basic blocks",
clEnumValN(TraceOff , "off", "Disable trace code"),
- clEnumValN(TraceMethods , "method", "Trace each method"),
+ clEnumValN(TraceFunctions , "function", "Trace each function"),
clEnumValN(TraceBasicBlocks, "basicblock", "Trace each basic block"), 0);
@@ -83,10 +83,10 @@ int main(int argc, char **argv) {
Passes.add(createHoistPHIConstantsPass());
if (TraceValues != TraceOff) { // If tracing enabled...
- // Insert trace code in all methods in the module
+ // Insert trace code in all functions in the module
if (TraceValues == TraceBasicBlocks)
Passes.add(createTraceValuesPassForBasicBlocks());
- else if (TraceValues == TraceMethods)
+ else if (TraceValues == TraceFunctions)
Passes.add(createTraceValuesPassForMethod());
else
assert(0 && "Bad value for TraceValues!");
diff --git a/tools/llvm-dis/dis.cpp b/tools/llvm-dis/dis.cpp
index 61cea325e2..9aa15dc827 100644
--- a/tools/llvm-dis/dis.cpp
+++ b/tools/llvm-dis/dis.cpp
@@ -19,7 +19,7 @@
#include "llvm/Module.h"
#include "llvm/Assembly/Writer.h"
#include "llvm/Bytecode/Reader.h"
-#include "llvm/Method.h"
+#include "llvm/Function.h"
#include "llvm/Support/CFG.h"
#include "Support/DepthFirstIterator.h"
#include "Support/PostOrderIterator.h"
@@ -30,7 +30,7 @@ using std::cerr;
// OutputMode - The different orderings to print basic blocks in...
enum OutputMode {
- Default = 0, // Method Order (list order)
+ Default = 0, // Function Order (list order)
dfo, // Depth First ordering
rdfo, // Reverse Depth First ordering
po, // Post Order
@@ -52,8 +52,8 @@ int main(int argc, char **argv) {
cl::ParseCommandLineOptions(argc, argv, " llvm .bc -> .ll disassembler\n");
std::ostream *Out = &std::cout; // Default to printing to stdout...
- Module *C = ParseBytecodeFile(InputFilename);
- if (C == 0) {
+ Module *M = ParseBytecodeFile(InputFilename);
+ if (M == 0) {
cerr << "bytecode didn't read correctly.\n";
return 1;
}
@@ -100,32 +100,32 @@ int main(int argc, char **argv) {
// what the writer library is supposed to do...
//
if (WriteMode == Default) {
- (*Out) << C; // Print out in list order
+ (*Out) << M; // Print out in list order
} else {
// TODO: This does not print anything other than the basic blocks in the
- // methods... more should definately be printed. It should be valid output
- // consumable by the assembler.
+ // functions... more should definately be printed. It should be valid
+ // output consumable by the assembler.
//
- for (Module::iterator I = C->begin(), End = C->end(); I != End; ++I) {
- Method *M = *I;
- (*Out) << "-------------- Method: " << M->getName() << " -------------\n";
+ for (Module::iterator I = M->begin(), End = M->end(); I != End; ++I) {
+ Function *F = *I;
+ (*Out) << "-------------- Method: " << F->getName() << " -------------\n";
switch (WriteMode) {
case dfo: // Depth First ordering
- copy(df_begin(M), df_end(M),
+ copy(df_begin(F), df_end(F),
std::ostream_iterator<BasicBlock*>(*Out, "\n"));
break;
case rdfo: // Reverse Depth First ordering
- copy(df_begin(M, true), df_end(M),
+ copy(df_begin(F, true), df_end(F),
std::ostream_iterator<BasicBlock*>(*Out, "\n"));
break;
case po: // Post Order
- copy(po_begin(M), po_end(M),
+ copy(po_begin(F), po_end(F),
std::ostream_iterator<BasicBlock*>(*Out, "\n"));
break;
case rpo: { // Reverse Post Order
#if 0 // FIXME, GCC 3.0.4 bug
- ReversePostOrderTraversal<Method*> RPOT(M());
+ ReversePostOrderTraversal<Function*> RPOT(F);
copy(RPOT.begin(), RPOT.end(),
std::ostream_iterator<BasicBlock*>(*Out, "\n"));
#endif
@@ -137,7 +137,7 @@ int main(int argc, char **argv) {
}
}
}
- delete C;
+ delete M;
if (Out != &std::cout) delete Out;
return 0;
diff --git a/tools/llvm-dis/llvm-dis.cpp b/tools/llvm-dis/llvm-dis.cpp
index 61cea325e2..9aa15dc827 100644
--- a/tools/llvm-dis/llvm-dis.cpp
+++ b/tools/llvm-dis/llvm-dis.cpp
@@ -19,7 +19,7 @@
#include "llvm/Module.h"
#include "llvm/Assembly/Writer.h"
#include "llvm/Bytecode/Reader.h"
-#include "llvm/Method.h"
+#include "llvm/Function.h"
#include "llvm/Support/CFG.h"
#include "Support/DepthFirstIterator.h"
#include "Support/PostOrderIterator.h"
@@ -30,7 +30,7 @@ using std::cerr;
// OutputMode - The different orderings to print basic blocks in...
enum OutputMode {
- Default = 0, // Method Order (list order)
+ Default = 0, // Function Order (list order)
dfo, // Depth First ordering
rdfo, // Reverse Depth First ordering
po, // Post Order
@@ -52,8 +52,8 @@ int main(int argc, char **argv) {
cl::ParseCommandLineOptions(argc, argv, " llvm .bc -> .ll disassembler\n");
std::ostream *Out = &std::cout; // Default to printing to stdout...
- Module *C = ParseBytecodeFile(InputFilename);
- if (C == 0) {
+ Module *M = ParseBytecodeFile(InputFilename);
+ if (M == 0) {
cerr << "bytecode didn't read correctly.\n";
return 1;
}
@@ -100,32 +100,32 @@ int main(int argc, char **argv) {
// what the writer library is supposed to do...
//
if (WriteMode == Default) {
- (*Out) << C; // Print out in list order
+ (*Out) << M; // Print out in list order
} else {
// TODO: This does not print anything other than the basic blocks in the
- // methods... more should definately be printed. It should be valid output
- // consumable by the assembler.
+ // functions... more should definately be printed. It should be valid
+ // output consumable by the assembler.
//
- for (Module::iterator I = C->begin(), End = C->end(); I != End; ++I) {
- Method *M = *I;
- (*Out) << "-------------- Method: " << M->getName() << " -------------\n";
+ for (Module::iterator I = M->begin(), End = M->end(); I != End; ++I) {
+ Function *F = *I;
+ (*Out) << "-------------- Method: " << F->getName() << " -------------\n";
switch (WriteMode) {
case dfo: // Depth First ordering
- copy(df_begin(M), df_end(M),
+ copy(df_begin(F), df_end(F),
std::ostream_iterator<BasicBlock*>(*Out, "\n"));
break;
case rdfo: // Reverse Depth First ordering
- copy(df_begin(M, true), df_end(M),
+ copy(df_begin(F, true), df_end(F),
std::ostream_iterator<BasicBlock*>(*Out, "\n"));
break;
case po: // Post Order
- copy(po_begin(M), po_end(M),
+ copy(po_begin(F), po_end(F),
std::ostream_iterator<BasicBlock*>(*Out, "\n"));
break;
case rpo: { // Reverse Post Order
#if 0 // FIXME, GCC 3.0.4 bug
- ReversePostOrderTraversal<Method*> RPOT(M());
+ ReversePostOrderTraversal<Function*> RPOT(F);
copy(RPOT.begin(), RPOT.end(),
std::ostream_iterator<BasicBlock*>(*Out, "\n"));
#endif
@@ -137,7 +137,7 @@ int main(int argc, char **argv) {
}
}
}
- delete C;
+ delete M;
if (Out != &std::cout) delete Out;
return 0;
diff --git a/tools/llvm-link/llvm-link.cpp b/tools/llvm-link/llvm-link.cpp
index bdd04685ce..ec77b42eff 100644
--- a/tools/llvm-link/llvm-link.cpp
+++ b/tools/llvm-link/llvm-link.cpp
@@ -14,7 +14,6 @@
#include "llvm/Bytecode/Writer.h"
#include "llvm/Assembly/Writer.h"
#include "llvm/Module.h"
-#include "llvm/Method.h"
#include "Support/CommandLine.h"
#include <fstream>
#include <memory>