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