Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions llvm/include/llvm/Transforms/MalininDDCount/MalininDDCount.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#ifndef LLVM_TRANSFORMS_MALININDD_COUNT_H
#define LLVM_TRANSFORMS_MALININDD_COUNT_H

#include "llvm/IR/PassManager.h"

namespace llvm {

class MalininDDPass : public PassInfoMixin<MalininDDPass> {
public:
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
};
} // namespace llvm

#endif // LLVM_TRANSFORMS_MALININDD_COUNT_H
1 change: 1 addition & 0 deletions llvm/lib/Passes/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ add_llvm_component_library(LLVMPasses
TransformUtils
Vectorize
Instrumentation
MalininDDCount
)
1 change: 1 addition & 0 deletions llvm/lib/Passes/PassBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
#include "llvm/Transforms/Instrumentation/PoisonChecking.h"
#include "llvm/Transforms/Instrumentation/SanitizerCoverage.h"
#include "llvm/Transforms/Instrumentation/ThreadSanitizer.h"
#include "llvm/Transforms/MalininDDCount/MalininDDCount.h"
#include "llvm/Transforms/ObjCARC.h"
#include "llvm/Transforms/Scalar/ADCE.h"
#include "llvm/Transforms/Scalar/AlignmentFromAssumptions.h"
Expand Down
1 change: 1 addition & 0 deletions llvm/lib/Passes/PassRegistry.def
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ FUNCTION_ALIAS_ANALYSIS("tbaa", TypeBasedAA())
#ifndef FUNCTION_PASS
#define FUNCTION_PASS(NAME, CREATE_PASS)
#endif
FUNCTION_PASS("malininddCount", MalininDDPass()) // run with option -passes=malininddTransfromer
FUNCTION_PASS("aa-eval", AAEvaluator())
FUNCTION_PASS("adce", ADCEPass())
FUNCTION_PASS("add-discriminators", AddDiscriminatorsPass())
Expand Down
1 change: 1 addition & 0 deletions llvm/lib/Transforms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ add_subdirectory(Hello)
add_subdirectory(ObjCARC)
add_subdirectory(Coroutines)
add_subdirectory(CFGuard)
add_subdirectory(MalininDDCount)
14 changes: 14 additions & 0 deletions llvm/lib/Transforms/MalininDDCount/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
add_llvm_component_library(LLVMMalininDDCount
# .cpp files
MalininDDCount.cpp

DEPENDS
intrinsics_gen # to run table_gen on our target

COMPONENT_NAME
MalininDDCount

LINK_COMPONENTS
Core # for structures
Support # for errs
)
29 changes: 29 additions & 0 deletions llvm/lib/Transforms/MalininDDCount/MalininDDCount.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include "llvm/Transforms/MalininDDCount/MalininDDCount.h"

#define DEBUG_TYPE "MalininDDCount"
#include "llvm/ADT/Statistic.h"
#include "llvm/IR/InstIterator.h"

using namespace llvm;

ALWAYS_ENABLED_STATISTIC(F_count, "Number of functions");
ALWAYS_ENABLED_STATISTIC(OPS_count, "Number of BB ");
ALWAYS_ENABLED_STATISTIC(BB_count, "Number of OPS ");


PreservedAnalyses MalininDDPass::run(Function &F,
FunctionAnalysisManager &AM) {
F_count ++;
for (auto& BB : F) {
BB_count++;
for (auto& IN : instructions(F)){
OPS_count++;
}
}

errs() << "Number of Func " << F_count << "\n";
errs() << " Number of BB " << BB_count << "\n";
errs() << " Number of OPS " << OPS_count << "\n";

return PreservedAnalyses::all();
}
1 change: 1 addition & 0 deletions llvm/projects/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ add_llvm_external_project(dragonegg)
add_llvm_external_project(parallel-libs)
add_llvm_external_project(openmp)


if(LLVM_INCLUDE_TESTS)
add_llvm_external_project(cross-project-tests)
endif()