Commit 048c6eaf authored by nagayama15's avatar nagayama15

コマンドラインオプションのサンプルを追加

parent 97558d89
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
#include <llvm/Pass.h> #include <llvm/Pass.h>
#include <llvm/Support/raw_ostream.h> #include <llvm/Support/raw_ostream.h>
#include <llvm/Support/CommandLine.h>
namespace namespace
{ {
/** /**
...@@ -82,7 +84,8 @@ namespace ...@@ -82,7 +84,8 @@ namespace
char BlockCounterPass::ID; char BlockCounterPass::ID;
// Register pass. // Register pass.
llvm::RegisterPass<BlockCounterPass> pass_registry { const llvm::RegisterPass<BlockCounterPass> pass_registry =
{
"count-block", "count-block",
"IR analyzer", "IR analyzer",
}; };
......
...@@ -5,6 +5,14 @@ ...@@ -5,6 +5,14 @@
namespace namespace
{ {
const llvm::cl::opt<int> test_opt
{
"test_opt",
llvm::cl::desc("Test pass option"),
llvm::cl::value_desc("test"),
llvm::cl::init(10),
};
/** /**
* @brief First watermarker pass. * @brief First watermarker pass.
*/ */
...@@ -41,6 +49,7 @@ namespace ...@@ -41,6 +49,7 @@ namespace
bool doInitialization(llvm::Module& module) override bool doInitialization(llvm::Module& module) override
{ {
llvm::errs() << __FUNCTION__ << " : " << module.getName() << "\n"; llvm::errs() << __FUNCTION__ << " : " << module.getName() << "\n";
llvm::errs() << "test_opt: " << test_opt << "\n";
return false; return false;
} }
...@@ -90,7 +99,8 @@ namespace ...@@ -90,7 +99,8 @@ namespace
char TestPass::ID; char TestPass::ID;
// Register pass. // Register pass.
llvm::RegisterPass<TestPass> test_pass_registry { const llvm::RegisterPass<TestPass> pass_registry =
{
"testpass", "testpass",
"Test pass", "Test pass",
}; };
......
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