#include "llvm/Analysis/Expressions.h"
#include "llvm/Transforms/Scalar/ConstantHandling.h"
-#include "llvm/Method.h"
+#include "llvm/Function.h"
#include "llvm/BasicBlock.h"
#include <iostream>
switch (Expr->getValueType()) {
case Value::InstructionVal: break; // Instruction... hmmm... investigate.
case Value::TypeVal: case Value::BasicBlockVal:
- case Value::MethodVal: case Value::ModuleVal: default:
+ case Value::FunctionVal: case Value::ModuleVal: default:
//assert(0 && "Unexpected expression type to classify!");
std::cerr << "Bizarre thing to expr classify: " << Expr << "\n";
return Expr;
- case Value::GlobalVariableVal: // Global Variable & Method argument:
- case Value::MethodArgumentVal: // nothing known, return variable itself
+ case Value::GlobalVariableVal: // Global Variable & Function argument:
+ case Value::FunctionArgumentVal: // nothing known, return variable itself
return Expr;
case Value::ConstantVal: // Constant value, just return constant
Constant *CPV = cast<Constant>(Expr);
#include "llvm/Analysis/CallGraph.h"
#include "llvm/Module.h"
-#include "llvm/Method.h"
+#include "llvm/Function.h"
#include "llvm/iOther.h"
#include "llvm/iTerminators.h"
#include "Support/STLExtras.h"
// getNodeFor - Return the node for the specified method or create one if it
// does not already exist.
//
-CallGraphNode *CallGraph::getNodeFor(Method *M) {
- CallGraphNode *&CGN = MethodMap[M];
+CallGraphNode *CallGraph::getNodeFor(Function *F) {
+ CallGraphNode *&CGN = MethodMap[F];
if (CGN) return CGN;
- assert((!M || M->getParent() == Mod) && "Method not in current module!");
- return CGN = new CallGraphNode(M);
+ assert((!F || F->getParent() == Mod) && "Function not in current module!");
+ return CGN = new CallGraphNode(F);
}
// addToCallGraph - Add a method to the call graph, and link the node to all of
// the methods that it calls.
//
-void CallGraph::addToCallGraph(Method *M) {
+void CallGraph::addToCallGraph(Function *M) {
CallGraphNode *Node = getNodeFor(M);
// If this method has external linkage,
}
// Look for an indirect method call...
- for (Method::iterator BBI = M->begin(), BBE = M->end(); BBI != BBE; ++BBI) {
+ for (Function::iterator BBI = M->begin(), BBE = M->end(); BBI != BBE; ++BBI) {
BasicBlock *BB = *BBI;
for (BasicBlock::iterator II = BB->begin(), IE = BB->end(); II != IE; ++II){
Instruction *I = *II;
// Methods to keep a call graph up to date with a method that has been
// modified
//
-void CallGraph::addMethodToModule(Method *Meth) {
+void CallGraph::addMethodToModule(Function *Meth) {
assert(0 && "not implemented");
abort();
}
// methods (ie, there are no edges in it's CGN). The easiest way to do this
// is to dropAllReferences before calling this.
//
-Method *CallGraph::removeMethodFromModule(CallGraphNode *CGN) {
+Function *CallGraph::removeMethodFromModule(CallGraphNode *CGN) {
assert(CGN->CalledMethods.empty() && "Cannot remove method from call graph"
" if it references other methods!");
- Method *M = CGN->getMethod(); // Get the method for the call graph node
- delete CGN; // Delete the call graph node for this method
- MethodMap.erase(M); // Remove the call graph node from the map
+ Function *M = CGN->getMethod(); // Get the function for the call graph node
+ delete CGN; // Delete the call graph node for this func
+ MethodMap.erase(M); // Remove the call graph node from the map
- Mod->getMethodList().remove(M);
+ Mod->getFunctionList().remove(M);
return M;
}