Chisel
Reduction.h
Go to the documentation of this file.
1 #ifndef REDUCTION_H
2 #define REDUCTION_H
3 
4 #include <vector>
5 
6 #include "ProbabilisticModel.h"
7 #include "Transformation.h"
8 
9 using DDElement = llvm::PointerUnion<clang::Decl *, clang::Stmt *>;
10 using DDElementVector = std::vector<DDElement>;
11 using DDElementSet = std::set<DDElement>;
12 
14 class Reduction : public Transformation {
15 public:
16  Reduction() {}
18 
19 protected:
20  virtual void Initialize(clang::ASTContext &Ctx);
21 
22  DDElementSet doDeltaDebugging(std::vector<DDElement> &Decls);
23 
24  virtual bool test(DDElementVector &ToBeRemoved) = 0;
25  virtual bool callOracle();
26  virtual bool isInvalidChunk(DDElementVector &Chunk) = 0;
27 
30 
31 private:
32  ProbabilisticModel TheModel;
33  std::set<DDElementVector> Cache;
34  DDElementVector toVector(DDElementSet &Set);
35 
36  std::vector<DDElementVector> getCandidates(DDElementVector &Decls,
37  int ChunkSize);
38 };
39 
40 #endif // REDUCTION_H
Represents the probabilistic model that is utilized in the reduction phase.
Definition: ProbabilisticModel.h:15
Represents a general reduction step.
Definition: Reduction.h:14
DDElementSet doDeltaDebugging(std::vector< DDElement > &Decls)
Definition: Reduction.cpp:75
virtual bool isInvalidChunk(DDElementVector &Chunk)=0
DDElementSet setDifference(DDElementSet &A, DDElementSet &B)
Definition: Reduction.cpp:28
~Reduction()
Definition: Reduction.h:17
std::vector< DDElement > DDElementVector
Definition: ProbabilisticModel.h:12
virtual bool test(DDElementVector &ToBeRemoved)=0
DDElementSet toSet(DDElementVector &Vec)
Definition: Reduction.cpp:23
Represesnts a transformation action on an AST.
Definition: Transformation.h:10
virtual bool callOracle()
Definition: Reduction.cpp:15
Reduction()
Definition: Reduction.h:16
virtual void Initialize(clang::ASTContext &Ctx)
Definition: Reduction.cpp:11
llvm::PointerUnion< clang::Decl *, clang::Stmt * > DDElement
Definition: ProbabilisticModel.h:11
std::set< DDElement > DDElementSet
Definition: Reduction.h:11