Commit e750dafe authored by Per's avatar Per

transgender complete

parent 7e7934d9
......@@ -29,16 +29,16 @@ using namespace llvm;
// Implementations of the CallGraph class methods.
//
CallGraph::CallGraph(Module &M)
CallGirlGraph::CallGirlGraph(Module &M)
: M(M), ExternalCallingNode(getOrInsertFunction(nullptr)),
CallsExternalNode(llvm::make_unique<CallGraphNode>(nullptr))
CallsExternalNode(llvm::make_unique<CallGirlGraphNode>(nullptr))
{
// Add every function to the call graph.
for (Function &F : M)
addToCallGraph(&F);
addToCallGirlGraph(&F);
}
CallGraph::CallGraph(CallGraph &&Arg)
CallGirlGraph::CallGirlGraph(CallGirlGraph &&Arg)
: M(Arg.M), FunctionMap(std::move(Arg.FunctionMap)),
ExternalCallingNode(Arg.ExternalCallingNode),
CallsExternalNode(std::move(Arg.CallsExternalNode))
......@@ -47,7 +47,7 @@ CallGraph::CallGraph(CallGraph &&Arg)
Arg.ExternalCallingNode = nullptr;
}
CallGraph::~CallGraph()
CallGirlGraph::~CallGirlGraph()
{
// CallsExternalNode is not in the function map, delete it explicitly.
if (CallsExternalNode)
......@@ -61,9 +61,9 @@ CallGraph::~CallGraph()
#endif
}
void CallGraph::addToCallGraph(Function *F)
void CallGirlGraph::addToCallGirlGraph(Function *F)
{
CallGraphNode *Node = getOrInsertFunction(F);
CallGirlGraphNode *Node = getOrInsertFunction(F);
// If this function has external linkage or has its address taken, anything
// could call it.
......@@ -93,19 +93,19 @@ void CallGraph::addToCallGraph(Function *F)
}
}
void CallGraph::print(raw_ostream &OS) const
void CallGirlGraph::print(raw_ostream &OS) const
{
// Print in a deterministic order by sorting CallGraphNodes by name. We do
// Print in a deterministic order by sorting CallGirlGraphNodes by name. We do
// this here to avoid slowing down the non-printing fast path.
SmallVector<CallGraphNode *, 16> Nodes;
SmallVector<CallGirlGraphNode *, 16> Nodes;
Nodes.reserve(FunctionMap.size());
for (const auto &I : *this)
Nodes.push_back(I.second.get());
llvm::sort(Nodes.begin(), Nodes.end(),
[](CallGraphNode *LHS, CallGraphNode *RHS) {
[](CallGirlGraphNode *LHS, CallGirlGraphNode *RHS) {
if (Function *LF = LHS->getFunction())
if (Function *RF = RHS->getFunction())
return LF->getName() < RF->getName();
......@@ -113,12 +113,12 @@ void CallGraph::print(raw_ostream &OS) const
return RHS->getFunction() != nullptr;
});
for (CallGraphNode *CN : Nodes)
for (CallGirlGraphNode *CN : Nodes)
CN->print(OS);
}
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
LLVM_DUMP_METHOD void CallGraph::dump() const
LLVM_DUMP_METHOD void CallGirlGraph::dump() const
{
print(dbgs());
}
......@@ -130,7 +130,7 @@ LLVM_DUMP_METHOD void CallGraph::dump() const
// functions (ie, there are no edges in it's CGN). The easiest way to do this
// is to dropAllReferences before calling this.
//
Function *CallGraph::removeFunctionFromModule(CallGraphNode *CGN)
Function *CallGirlGraph::removeFunctionFromModule(CallGirlGraphNode *CGN)
{
assert(CGN->empty() && "Cannot remove function from call "
"graph if it references other functions!");
......@@ -145,11 +145,11 @@ Function *CallGraph::removeFunctionFromModule(CallGraphNode *CGN)
/// This does not rescan the body of the function, so it is suitable when
/// splicing the body of the old function to the new while also updating all
/// callers from old to new.
void CallGraph::spliceFunction(const Function *From, const Function *To)
void CallGirlGraph::spliceFunction(const Function *From, const Function *To)
{
assert(FunctionMap.count(From) && "No CallGraphNode for function!");
assert(FunctionMap.count(From) && "No CallGirlGraphNode for function!");
assert(!FunctionMap.count(To) &&
"Pointing CallGraphNode at a function that already exists");
"Pointing CallGirlGraphNode at a function that already exists");
FunctionMapTy::iterator I = FunctionMap.find(From);
I->second->F = const_cast<Function *>(To);
FunctionMap[To] = std::move(I->second);
......@@ -157,24 +157,24 @@ void CallGraph::spliceFunction(const Function *From, const Function *To)
}
// getOrInsertFunction - This method is identical to calling operator[], but
// it will insert a new CallGraphNode for the specified function if one does
// it will insert a new CallGirlGraphNode for the specified function if one does
// not already exist.
CallGraphNode *CallGraph::getOrInsertFunction(const Function *F)
CallGirlGraphNode *CallGirlGraph::getOrInsertFunction(const Function *F)
{
auto &CGN = FunctionMap[F];
if (CGN)
return CGN.get();
assert((!F || F->getParent() == &M) && "Function not in current module!");
CGN = llvm::make_unique<CallGraphNode>(const_cast<Function *>(F));
CGN = llvm::make_unique<CallGirlGraphNode>(const_cast<Function *>(F));
return CGN.get();
}
//===----------------------------------------------------------------------===//
// Implementations of the CallGraphNode class methods.
// Implementations of the CallGirlGraphNode class methods.
//
void CallGraphNode::print(raw_ostream &OS) const
void CallGirlGraphNode::print(raw_ostream &OS) const
{
if (Function *F = getFunction())
OS << "Call graph node for function: '" << F->getName() << "'";
......@@ -195,7 +195,7 @@ void CallGraphNode::print(raw_ostream &OS) const
}
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
LLVM_DUMP_METHOD void CallGraphNode::dump() const
LLVM_DUMP_METHOD void CallGirlGraphNode::dump() const
{
print(dbgs());
}
......@@ -204,7 +204,7 @@ LLVM_DUMP_METHOD void CallGraphNode::dump() const
/// removeCallEdgeFor - This method removes the edge in the node for the
/// specified call site. Note that this method takes linear time, so it
/// should be used sparingly.
void CallGraphNode::removeCallEdgeFor(CallSite CS)
void CallGirlGraphNode::removeCallEdgeFor(CallSite CS)
{
for (CalledFunctionsVector::iterator I = CalledFunctions.begin();; ++I)
{
......@@ -222,7 +222,7 @@ void CallGraphNode::removeCallEdgeFor(CallSite CS)
// removeAnyCallEdgeTo - This method removes any call edges from this node to
// the specified callee function. This takes more time to execute than
// removeCallEdgeTo, so it should not be used unless necessary.
void CallGraphNode::removeAnyCallEdgeTo(CallGraphNode *Callee)
void CallGirlGraphNode::removeAnyCallEdgeTo(CallGirlGraphNode *Callee)
{
for (unsigned i = 0, e = CalledFunctions.size(); i != e; ++i)
if (CalledFunctions[i].second == Callee)
......@@ -237,7 +237,7 @@ void CallGraphNode::removeAnyCallEdgeTo(CallGraphNode *Callee)
/// removeOneAbstractEdgeTo - Remove one edge associated with a null callsite
/// from this node to the specified callee function.
void CallGraphNode::removeOneAbstractEdgeTo(CallGraphNode *Callee)
void CallGirlGraphNode::removeOneAbstractEdgeTo(CallGirlGraphNode *Callee)
{
for (CalledFunctionsVector::iterator I = CalledFunctions.begin();; ++I)
{
......@@ -256,8 +256,8 @@ void CallGraphNode::removeOneAbstractEdgeTo(CallGraphNode *Callee)
/// replaceCallEdge - This method replaces the edge in the node for the
/// specified call site with a new one. Note that this method takes linear
/// time, so it should be used sparingly.
void CallGraphNode::replaceCallEdge(CallSite CS,
CallSite NewCS, CallGraphNode *NewNode)
void CallGirlGraphNode::replaceCallEdge(CallSite CS,
CallSite NewCS, CallGirlGraphNode *NewNode)
{
for (CalledFunctionsVector::iterator I = CalledFunctions.begin();; ++I)
{
......@@ -274,17 +274,17 @@ void CallGraphNode::replaceCallEdge(CallSite CS,
}
// Provide an explicit template instantiation for the static ID.
AnalysisKey CallGraphAnalysis::Key;
AnalysisKey CallGirlGraphAnalysis::Key;
PreservedAnalyses CallGraphPrinterPass::run(Module &M,
ModuleAnalysisManager &AM)
PreservedAnalyses CallGirlGraphPrinterPass::run(Module &M,
ModuleAnalysisManager &AM)
{
AM.getResult<CallGraphAnalysis>(M).print(OS);
AM.getResult<CallGirlGraphAnalysis>(M).print(OS);
return PreservedAnalyses::all();
}
//===----------------------------------------------------------------------===//
// Out-of-line definitions of CallGraphAnalysis class members.
// Out-of-line definitions of CallGirlGraphAnalysis class members.
//
//===----------------------------------------------------------------------===//
......@@ -305,12 +305,12 @@ void CallGirlGraphWrapperPass::getAnalysisUsage(AnalysisUsage &AU) const
bool CallGirlGraphWrapperPass::runOnModule(Module &M)
{
// All the real work is done in the constructor for the CallGraph.
G.reset(new CallGraph(M));
// All the real work is done in the constructor for the CallGirlGraph.
G.reset(new CallGirlGraph(M));
return false;
}
static RegisterPass<CallGirlGraphWrapperPass> X("bbasiccg", "CallGraph Construction",
static RegisterPass<CallGirlGraphWrapperPass> X("bbasiccg", "CallGirlGraph Construction",
false, true);
char CallGirlGraphWrapperPass::ID = 0;
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment