Linting and Formatting. removed .misc-no-recursion from linting.
This commit is contained in:
parent
4a5b617bd5
commit
b9f35dca18
|
@ -1,4 +1,4 @@
|
||||||
Checks: '-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,-misc-non-private-member-variables-in-classes,readability-identifier-naming'
|
Checks: '-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,-misc-no-recursion*,-misc-non-private-member-variables-in-classes,readability-identifier-naming'
|
||||||
CheckOptions:
|
CheckOptions:
|
||||||
- key: readability-identifier-naming.ClassCase
|
- key: readability-identifier-naming.ClassCase
|
||||||
value: CamelCase
|
value: CamelCase
|
||||||
|
|
|
@ -28,10 +28,10 @@
|
||||||
#include "llvm/Pass.h"
|
#include "llvm/Pass.h"
|
||||||
#include "llvm/Passes/PassBuilder.h"
|
#include "llvm/Passes/PassBuilder.h"
|
||||||
#include "llvm/Passes/PassPlugin.h"
|
#include "llvm/Passes/PassPlugin.h"
|
||||||
|
#include "llvm/Support/raw_ostream.h"
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <llvm/Support/raw_ostream.h>
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "../include/AbstractCache.h"
|
#include "../include/AbstractCache.h"
|
||||||
|
@ -118,7 +118,7 @@ struct CacheAnalysisPass : PassInfoMixin<CacheAnalysisPass> {
|
||||||
|
|
||||||
unsigned int stringRefToInt(StringRef SR) {
|
unsigned int stringRefToInt(StringRef SR) {
|
||||||
unsigned int Length = SR.size();
|
unsigned int Length = SR.size();
|
||||||
unsigned int ret = 0;
|
unsigned int Ret = 0;
|
||||||
unsigned int Count = 1;
|
unsigned int Count = 1;
|
||||||
for (char C : SR) {
|
for (char C : SR) {
|
||||||
unsigned int Factor = (unsigned int)pow(10, (Length - Count++));
|
unsigned int Factor = (unsigned int)pow(10, (Length - Count++));
|
||||||
|
@ -126,37 +126,37 @@ struct CacheAnalysisPass : PassInfoMixin<CacheAnalysisPass> {
|
||||||
case '0':
|
case '0':
|
||||||
break;
|
break;
|
||||||
case '1':
|
case '1':
|
||||||
ret += Factor;
|
Ret += Factor;
|
||||||
break;
|
break;
|
||||||
case '2':
|
case '2':
|
||||||
ret += 2 * Factor;
|
Ret += 2 * Factor;
|
||||||
break;
|
break;
|
||||||
case '3':
|
case '3':
|
||||||
ret += 3 * Factor;
|
Ret += 3 * Factor;
|
||||||
break;
|
break;
|
||||||
case '4':
|
case '4':
|
||||||
ret += 4 * Factor;
|
Ret += 4 * Factor;
|
||||||
break;
|
break;
|
||||||
case '5':
|
case '5':
|
||||||
ret += 5 * Factor;
|
Ret += 5 * Factor;
|
||||||
break;
|
break;
|
||||||
case '6':
|
case '6':
|
||||||
ret += 6 * Factor;
|
Ret += 6 * Factor;
|
||||||
break;
|
break;
|
||||||
case '7':
|
case '7':
|
||||||
ret += 7 * Factor;
|
Ret += 7 * Factor;
|
||||||
break;
|
break;
|
||||||
case '8':
|
case '8':
|
||||||
ret += 8 * Factor;
|
Ret += 8 * Factor;
|
||||||
break;
|
break;
|
||||||
case '9':
|
case '9':
|
||||||
ret += 9 * Factor;
|
Ret += 9 * Factor;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
errs() << "StringRef is not a decimal number";
|
errs() << "StringRef is not a decimal number";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void addressCollector(Module &M) {
|
void addressCollector(Module &M) {
|
||||||
|
|
|
@ -6,12 +6,13 @@
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <llvm/IR/BasicBlock.h>
|
|
||||||
#include <llvm/Support/raw_ostream.h>
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
|
#include <llvm/IR/BasicBlock.h>
|
||||||
|
#include <llvm/Support/raw_ostream.h>
|
||||||
|
|
||||||
#include "AbstractState.h"
|
#include "AbstractState.h"
|
||||||
#include "Address.h"
|
#include "Address.h"
|
||||||
#include "ConcreteState.h"
|
#include "ConcreteState.h"
|
||||||
|
@ -48,10 +49,10 @@ public: // everything is public, because IDGAF
|
||||||
}
|
}
|
||||||
|
|
||||||
void fillAbstractCache(unsigned int NodeNr) {
|
void fillAbstractCache(unsigned int NodeNr) {
|
||||||
Nodes[NodeNr].computed = true;
|
Nodes[NodeNr].Computed = true;
|
||||||
for (unsigned int SuccNr : Nodes[NodeNr].Successors) {
|
for (unsigned int SuccNr : Nodes[NodeNr].Successors) {
|
||||||
Nodes[SuccNr];
|
Nodes[SuccNr];
|
||||||
if (Nodes[SuccNr].computed) {
|
if (Nodes[SuccNr].Computed) {
|
||||||
// Join don't call
|
// Join don't call
|
||||||
Nodes[SuccNr].mustJoin(Nodes[NodeNr]);
|
Nodes[SuccNr].mustJoin(Nodes[NodeNr]);
|
||||||
Nodes[SuccNr].mustJoin(AbstractState(NodeNr));
|
Nodes[SuccNr].mustJoin(AbstractState(NodeNr));
|
||||||
|
@ -67,10 +68,10 @@ public: // everything is public, because IDGAF
|
||||||
unsigned int collectHits() {
|
unsigned int collectHits() {
|
||||||
unsigned int Hits = 0;
|
unsigned int Hits = 0;
|
||||||
for (auto const &E : Edges) {
|
for (auto const &E : Edges) {
|
||||||
auto predecessor = Nodes[E.first];
|
auto Predecessor = Nodes[E.first];
|
||||||
for (unsigned int SuccessorAddr : E.second) {
|
for (unsigned int SuccessorAddr : E.second) {
|
||||||
// When successors Address is in predecessor, we have a Hit.
|
// When successors Address is in predecessor, we have a Hit.
|
||||||
Hits += predecessor.isHit(Address(SuccessorAddr)) ? 1 : 0;
|
Hits += Predecessor.isHit(Address(SuccessorAddr)) ? 1 : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Hits;
|
return Hits;
|
||||||
|
@ -79,10 +80,10 @@ public: // everything is public, because IDGAF
|
||||||
unsigned int collectMisses() {
|
unsigned int collectMisses() {
|
||||||
unsigned int Misses = 0;
|
unsigned int Misses = 0;
|
||||||
for (auto const &E : Edges) {
|
for (auto const &E : Edges) {
|
||||||
auto predecessor = Nodes[E.first];
|
auto Predecessor = Nodes[E.first];
|
||||||
for (unsigned int SuccessorAddr : E.second) {
|
for (unsigned int SuccessorAddr : E.second) {
|
||||||
// When successors Address is in predecessor, we have a Hit.
|
// When successors Address is in predecessor, we have a Hit.
|
||||||
Misses += predecessor.isHit(Address(SuccessorAddr)) ? 0 : 1;
|
Misses += Predecessor.isHit(Address(SuccessorAddr)) ? 0 : 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Misses;
|
return Misses;
|
||||||
|
|
|
@ -6,12 +6,13 @@
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <llvm/Support/raw_ostream.h>
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include <llvm/Support/raw_ostream.h>
|
||||||
|
|
||||||
#include "Address.h"
|
#include "Address.h"
|
||||||
// Forward declarations
|
// Forward declarations
|
||||||
|
|
||||||
|
@ -27,7 +28,7 @@ public: // everything is public, because IDGAF
|
||||||
|
|
||||||
unsigned int Addr;
|
unsigned int Addr;
|
||||||
|
|
||||||
bool computed = false;
|
bool Computed = false;
|
||||||
|
|
||||||
// Only entries below this comment are needed for the exercise.
|
// Only entries below this comment are needed for the exercise.
|
||||||
|
|
||||||
|
@ -110,8 +111,8 @@ public: // everything is public, because IDGAF
|
||||||
* @param Addr , Address
|
* @param Addr , Address
|
||||||
*/
|
*/
|
||||||
void update(Address Addr) {
|
void update(Address Addr) {
|
||||||
for (int i = 3; i > 0; i--) {
|
for (int I = 3; I > 0; I--) {
|
||||||
Sets[Addr.Index].Associativity[i] = Sets[Addr.Index].Associativity[i - 1];
|
Sets[Addr.Index].Associativity[I] = Sets[Addr.Index].Associativity[I - 1];
|
||||||
}
|
}
|
||||||
Sets[Addr.Index].Associativity[0].Blocks = {Addr.Tag};
|
Sets[Addr.Index].Associativity[0].Blocks = {Addr.Tag};
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ class CacheType;
|
||||||
*/
|
*/
|
||||||
class CacheType {
|
class CacheType {
|
||||||
public:
|
public:
|
||||||
bool isPower2(int n) { return n && !(n & (n - 1)); }
|
bool isPower2(int N) { return N && !(N & (N - 1)); }
|
||||||
|
|
||||||
int Sets; // n Sets
|
int Sets; // n Sets
|
||||||
int Associativity; // m Associativity
|
int Associativity; // m Associativity
|
||||||
|
|
Loading…
Reference in New Issue