Change references to the Method class to be references to the Function
class. The Method class is obsolete (renamed) and all references to it
are being converted over to Function.
llvm-svn: 2144
diff --git a/llvm/tools/analyze/analyze.cpp b/llvm/tools/analyze/analyze.cpp
index 48a600f..0a6ecf8 100644
--- a/llvm/tools/analyze/analyze.cpp
+++ b/llvm/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 @@
}
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 @@
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 *NewPrintMethod(const string &Message) {
+Pass *NewPrintFunction(const string &Message) {
return new PrintMethodPass(Message, &std::cout);
}
Pass *NewPrintModule(const string &Message) {
@@ -136,15 +136,15 @@
}
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 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 @@
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::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 @@
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/llvm/tools/dis/dis.cpp b/llvm/tools/dis/dis.cpp
index 61cea32..9aa15dc 100644
--- a/llvm/tools/dis/dis.cpp
+++ b/llvm/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 @@
// 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 @@
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 @@
// 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 @@
}
}
}
- delete C;
+ delete M;
if (Out != &std::cout) delete Out;
return 0;
diff --git a/llvm/tools/gccld/gccld.cpp b/llvm/tools/gccld/gccld.cpp
index cb77bb0..d00687f 100644
--- a/llvm/tools/gccld/gccld.cpp
+++ b/llvm/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 @@
}
}
+ // 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/llvm/tools/link/link.cpp b/llvm/tools/link/link.cpp
index bdd0468..ec77b42 100644
--- a/llvm/tools/link/link.cpp
+++ b/llvm/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/llvm/tools/llc/llc.cpp b/llvm/tools/llc/llc.cpp
index 140151b..819c80a 100644
--- a/llvm/tools/llc/llc.cpp
+++ b/llvm/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 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 @@
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/llvm/tools/llvm-dis/dis.cpp b/llvm/tools/llvm-dis/dis.cpp
index 61cea32..9aa15dc 100644
--- a/llvm/tools/llvm-dis/dis.cpp
+++ b/llvm/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 @@
// 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 @@
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 @@
// 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 @@
}
}
}
- delete C;
+ delete M;
if (Out != &std::cout) delete Out;
return 0;
diff --git a/llvm/tools/llvm-dis/llvm-dis.cpp b/llvm/tools/llvm-dis/llvm-dis.cpp
index 61cea32..9aa15dc 100644
--- a/llvm/tools/llvm-dis/llvm-dis.cpp
+++ b/llvm/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 @@
// 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 @@
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 @@
// 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 @@
}
}
}
- delete C;
+ delete M;
if (Out != &std::cout) delete Out;
return 0;
diff --git a/llvm/tools/llvm-link/llvm-link.cpp b/llvm/tools/llvm-link/llvm-link.cpp
index bdd0468..ec77b42 100644
--- a/llvm/tools/llvm-link/llvm-link.cpp
+++ b/llvm/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>