Skip to content

Commit b905d08

Browse files
committed
small fix
1 parent 4849a66 commit b905d08

File tree

2 files changed

+11
-44
lines changed

2 files changed

+11
-44
lines changed

passes/ASPIS.h

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ class RASM : public PassInfoMixin<RASM> {
156156

157157
};
158158

159-
class RacfedTry : public PassInfoMixin<RacfedTry> {
159+
class RACFED : public PassInfoMixin<RACFED> {
160160
private:
161161
std::map<Value *, StringRef> FuncAnnotations;
162162
std::map<BasicBlock *, BasicBlock *> NewBBs;
@@ -189,38 +189,5 @@ class RacfedTry : public PassInfoMixin<RacfedTry> {
189189

190190
static bool isRequired() { return true; }
191191
};
192-
class RacfedTry : public PassInfoMixin<RacfedTry> {
193-
private:
194-
std::map<Value *, StringRef> FuncAnnotations;
195-
std::map<BasicBlock *, BasicBlock *> NewBBs;
196-
197192

198-
#if (LOG_COMPILED_FUNCS == 1)
199-
std::set<Function *> CompiledFuncs;
200193
#endif
201-
202-
void initializeBlocksSignatures(Module &Md,
203-
std::map<BasicBlock *, int> &RandomNumberBBs,
204-
std::map<BasicBlock *, int> &SubRanPrevVals,
205-
std::map<BasicBlock *, int> &SumIntraInstruction);
206-
207-
void originalInstruction(BasicBlock &BB,std::vector<Instruction*> OrigInstructions);
208-
209-
void splitBBsAtCalls(Module &Md);
210-
int countOriginalInstructions(BasicBlock &BB);
211-
CallBase *isCallBB(BasicBlock &BB);
212-
void initializeEntryBlocksMap(Module &Md);
213-
Value *getCondition(Instruction &I);
214-
void createCFGVerificationBB(BasicBlock &BB,
215-
std::map<BasicBlock *, int> &RandomNumberBBs,
216-
std::map<BasicBlock *, int> &SubRanPrevVals,
217-
Value &RuntimeSig, Value &RetSig,
218-
BasicBlock &ErrBB);
219-
220-
public:
221-
PreservedAnalyses run(Module &M, ModuleAnalysisManager &);
222-
223-
static bool isRequired() { return true; }
224-
};
225-
226-
#endif

passes/RACFED.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include "ASPIS.h"
2-
#include "Utilis.h"
2+
#include "Utils/Utils.h"
33
#include "llvm/IR/IRBuilder.h"
44
#include "llvm/Passes/PassBuilder.h"
55
#include "llvm/Passes/PassPlugin.h"
@@ -25,7 +25,7 @@ bool unicity(int candidate,
2525
return false;
2626
}
2727

28-
void RacfedTry::initializeBlocksSignatures(
28+
void RACFED::initializeBlocksSignatures(
2929
Module &Md, std::map<BasicBlock *, int> &RandomNumberBBs,
3030
std::map<BasicBlock *, int> &SubRanPrevVals,
3131
std::map<BasicBlock *, int> &SumIntraInstruction) {
@@ -74,7 +74,7 @@ int countOriginalInstructions(BasicBlock &BB) {
7474
return count;
7575
}
7676

77-
void RacfedTry::splitBBsAtCalls(Module &Md) {
77+
void RACFED::splitBBsAtCalls(Module &Md) {
7878
for (Function &Fn : Md) {
7979
if (shouldCompile(Fn, FuncAnnotations)) {
8080
std::vector<CallBase *> CallInsts;
@@ -95,7 +95,7 @@ void RacfedTry::splitBBsAtCalls(Module &Md) {
9595
}
9696
}
9797

98-
CallBase *RacfedTry::isCallBB(BasicBlock &BB) {
98+
CallBase *RACFED::isCallBB(BasicBlock &BB) {
9999
for (Instruction &I : BB) {
100100
if (isa<CallBase>(&I) && !isa<IntrinsicInst>(&I)) {
101101
return cast<CallBase>(&I);
@@ -104,12 +104,12 @@ CallBase *RacfedTry::isCallBB(BasicBlock &BB) {
104104
return nullptr;
105105
}
106106

107-
void RacfedTry::initializeEntryBlocksMap(Module &Md) {
107+
void RACFED::initializeEntryBlocksMap(Module &Md) {
108108
// Implementation for INTRA_FUNCTION_CFC == 1, left empty for now as we
109109
// default to 0
110110
}
111111

112-
Value *RacfedTry::getCondition(Instruction &I) {
112+
Value *RACFED::getCondition(Instruction &I) {
113113
// Helper to get condition from terminator if it's a branch
114114
if (BranchInst *BI = dyn_cast<BranchInst>(&I)) {
115115
if (BI->isConditional()) {
@@ -119,7 +119,7 @@ Value *RacfedTry::getCondition(Instruction &I) {
119119
return nullptr;
120120
}
121121

122-
void RacfedTry::createCFGVerificationBB(
122+
void RACFED::createCFGVerificationBB(
123123
BasicBlock &BB, std::map<BasicBlock *, int> &RandomNumberBBs,
124124
std::map<BasicBlock *, int> &SubRanPrevVals, Value &RuntimeSig,
125125
Value &RetSig, BasicBlock &ErrBB) {
@@ -251,7 +251,7 @@ void RacfedTry::createCFGVerificationBB(
251251
}
252252
}
253253

254-
PreservedAnalyses RacfedTry::run(Module &Md, ModuleAnalysisManager &AM) {
254+
PreservedAnalyses RACFED::run(Module &Md, ModuleAnalysisManager &AM) {
255255
std::map<BasicBlock*, int> RandomNumberBBs;
256256
std::map<BasicBlock*, int> SubRanPrevVals;
257257
std::map<BasicBlock *, int> SumIntraInstruction;
@@ -288,12 +288,12 @@ PreservedAnalyses RacfedTry::run(Module &Md, ModuleAnalysisManager &AM) {
288288
extern "C" ::llvm::PassPluginLibraryInfo LLVM_ATTRIBUTE_WEAK
289289

290290
llvmGetPassPluginInfo() {
291-
return {LLVM_PLUGIN_API_VERSION, "RacfedTry", "v0.1", [](PassBuilder &PB) {
291+
return {LLVM_PLUGIN_API_VERSION, "RACFED", "v0.1", [](PassBuilder &PB) {
292292
PB.registerPipelineParsingCallback(
293293
[](StringRef Name, ModulePassManager &MPM,
294294
ArrayRef<PassBuilder::PipelineElement>) {
295295
if (Name == "racfed-verify") {
296-
MPM.addPass(RacfedTry());
296+
MPM.addPass(RACFED());
297297
return true;
298298
}
299299
return false;

0 commit comments

Comments
 (0)