Commit b8e98f4a authored by nagayama15's avatar nagayama15

複数のパスを追加することを考えてファイル名の変更

parent 8f215683
...@@ -16,7 +16,7 @@ LDFLAGS := \ ...@@ -16,7 +16,7 @@ LDFLAGS := \
all: testpass.so all: testpass.so
testpass.so: src/nykk/pass/TestPass.o src/nykk/pass/CounterPass.o testpass.so: src/nykk/pass/TestPass.o src/nykk/pass/BlockCounterPass.o
${CXX} ${CXXFLAGS} -shared -o $@ $^ ${LDFLAGS} ${CXX} ${CXXFLAGS} -shared -o $@ $^ ${LDFLAGS}
clean: clean:
......
...@@ -8,7 +8,7 @@ namespace ...@@ -8,7 +8,7 @@ namespace
/** /**
* @brief Simplest IR analyzer. * @brief Simplest IR analyzer.
*/ */
class CounterPass class BlockCounterPass
: public llvm::FunctionPass : public llvm::FunctionPass
{ {
public: public:
...@@ -17,19 +17,19 @@ namespace ...@@ -17,19 +17,19 @@ namespace
/** /**
* @brief Constructor. * @brief Constructor.
*/ */
explicit CounterPass() explicit BlockCounterPass()
: FunctionPass(ID) : FunctionPass(ID)
{ {
} }
// Uncopyable, unmovable. // Uncopyable, unmovable.
CounterPass(const CounterPass&) =delete; BlockCounterPass(const BlockCounterPass&) =delete;
CounterPass(CounterPass&&) =delete; BlockCounterPass(BlockCounterPass&&) =delete;
CounterPass& operator=(const CounterPass&) =delete; BlockCounterPass& operator=(const BlockCounterPass&) =delete;
CounterPass& operator=(CounterPass&&) =delete; BlockCounterPass& operator=(BlockCounterPass&&) =delete;
~CounterPass() =default; ~BlockCounterPass() =default;
/** /**
* @brief Initialization before pass is run. * @brief Initialization before pass is run.
...@@ -41,7 +41,7 @@ namespace ...@@ -41,7 +41,7 @@ namespace
bool doInitialization(llvm::Module& module) override bool doInitialization(llvm::Module& module) override
{ {
llvm::errs() llvm::errs()
<< "[Counter - module ] start: " << module.getName() << "\n"; << "[BlockCounter - module ] start: " << module.getName() << "\n";
return false; return false;
} }
...@@ -56,7 +56,7 @@ namespace ...@@ -56,7 +56,7 @@ namespace
bool doFinalization(llvm::Module& module) override bool doFinalization(llvm::Module& module) override
{ {
llvm::errs() llvm::errs()
<< "[Counter - module ] finish: " << module.getName() << "\n"; << "[BlockCounter - module ] finish: " << module.getName() << "\n";
return false; return false;
} }
...@@ -71,17 +71,17 @@ namespace ...@@ -71,17 +71,17 @@ namespace
bool runOnFunction(llvm::Function& func) override bool runOnFunction(llvm::Function& func) override
{ {
llvm::errs() llvm::errs()
<< "[Counter - function ] '" << func.getName() << "' Basic blocks: " << func.getBasicBlockList().size() << "\n"; << "[BlockCounter - function ] '" << func.getName() << "' Basic blocks: " << func.getBasicBlockList().size() << "\n";
return false; return false;
} }
}; };
char CounterPass::ID; char BlockCounterPass::ID;
// Register pass. // Register pass.
llvm::RegisterPass<CounterPass> counter_pass_registry { llvm::RegisterPass<BlockCounterPass> pass_registry {
"counterpass", "count-block",
"IR analyzer", "IR analyzer",
}; };
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment