forked from nils.hoelscher/RTSA-lab01-CacheAnalysis
removed some warnings.
This commit is contained in:
parent
6772180507
commit
c9f529662d
|
@ -159,7 +159,7 @@ struct CacheAnalysisPass : PassInfoMixin<CacheAnalysisPass> {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void address_collector(Module &M) {
|
void addressCollector(Module &M) {
|
||||||
for (Function &F : M) {
|
for (Function &F : M) {
|
||||||
if (F.getName().equals(EntryPoint)) {
|
if (F.getName().equals(EntryPoint)) {
|
||||||
EntryAddress = AddressCounter;
|
EntryAddress = AddressCounter;
|
||||||
|
@ -179,7 +179,7 @@ struct CacheAnalysisPass : PassInfoMixin<CacheAnalysisPass> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void address_printer(Function &F) {
|
void addressPrinter(Function &F) {
|
||||||
outs() << "F: " << Value2Addr[&F] << ".\n";
|
outs() << "F: " << Value2Addr[&F] << ".\n";
|
||||||
for (BasicBlock &BB : F) {
|
for (BasicBlock &BB : F) {
|
||||||
outs() << "-BB: " << Value2Addr[&BB] << "\n";
|
outs() << "-BB: " << Value2Addr[&BB] << "\n";
|
||||||
|
@ -189,10 +189,10 @@ struct CacheAnalysisPass : PassInfoMixin<CacheAnalysisPass> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void init_edges(Function &F) {
|
void initEdges(Function &F) {
|
||||||
for (BasicBlock &BB : F) {
|
for (BasicBlock &BB : F) {
|
||||||
// Collect Controll flow in F
|
// Collect Controll flow in F
|
||||||
for (auto Pred : predecessors(&BB)) {
|
for (auto *Pred : predecessors(&BB)) {
|
||||||
AC.addEdge(Value2Addr[&Pred->getInstList().back()],
|
AC.addEdge(Value2Addr[&Pred->getInstList().back()],
|
||||||
Value2Addr[&BB.getInstList().front()]);
|
Value2Addr[&BB.getInstList().front()]);
|
||||||
if (PrintEdges)
|
if (PrintEdges)
|
||||||
|
@ -241,7 +241,7 @@ struct CacheAnalysisPass : PassInfoMixin<CacheAnalysisPass> {
|
||||||
// Resume CFG construction in called function
|
// Resume CFG construction in called function
|
||||||
if (VisitedFunctions.find(Callee) == VisitedFunctions.end()) {
|
if (VisitedFunctions.find(Callee) == VisitedFunctions.end()) {
|
||||||
VisitedFunctions[Callee] = true;
|
VisitedFunctions[Callee] = true;
|
||||||
init_edges(*Callee);
|
initEdges(*Callee);
|
||||||
}
|
}
|
||||||
PrevInst = nullptr;
|
PrevInst = nullptr;
|
||||||
if (PrintEdges)
|
if (PrintEdges)
|
||||||
|
@ -263,16 +263,16 @@ struct CacheAnalysisPass : PassInfoMixin<CacheAnalysisPass> {
|
||||||
FunctionAnalysisManager &FAM =
|
FunctionAnalysisManager &FAM =
|
||||||
MAM.getResult<FunctionAnalysisManagerModuleProxy>(M).getManager();
|
MAM.getResult<FunctionAnalysisManagerModuleProxy>(M).getManager();
|
||||||
|
|
||||||
address_collector(M);
|
addressCollector(M);
|
||||||
Function *EntryFunction;
|
Function *EntryFunction;
|
||||||
for (Function &F : M.getFunctionList()) {
|
for (Function &F : M.getFunctionList()) {
|
||||||
// Start iterating through CFG from entry point
|
// Start iterating through CFG from entry point
|
||||||
if (F.getName().equals(EntryPoint)) {
|
if (F.getName().equals(EntryPoint)) {
|
||||||
EntryFunction = &F;
|
EntryFunction = &F;
|
||||||
init_edges(F);
|
initEdges(F);
|
||||||
}
|
}
|
||||||
if (PrintAddresses)
|
if (PrintAddresses)
|
||||||
address_printer(F);
|
addressPrinter(F);
|
||||||
}
|
}
|
||||||
if (PrintEdgesPost)
|
if (PrintEdgesPost)
|
||||||
AC.dumpEdges();
|
AC.dumpEdges();
|
||||||
|
|
Reference in New Issue