Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
llvm-watermarker
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nagayama15
llvm-watermarker
Commits
b8e98f4a
Commit
b8e98f4a
authored
Nov 16, 2018
by
nagayama15
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
複数のパスを追加することを考えてファイル名の変更
parent
8f215683
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
14 deletions
+14
-14
Makefile
Makefile
+1
-1
BlockCounterPass.cpp
src/nykk/pass/BlockCounterPass.cpp
+13
-13
No files found.
Makefile
View file @
b8e98f4a
...
@@ -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/
Block
CounterPass.o
${
CXX
}
${
CXXFLAGS
}
-shared
-o
$@
$^
${
LDFLAGS
}
${
CXX
}
${
CXXFLAGS
}
-shared
-o
$@
$^
${
LDFLAGS
}
clean
:
clean
:
...
...
src/nykk/pass/CounterPass.cpp
→
src/nykk/pass/
Block
CounterPass.cpp
View file @
b8e98f4a
...
@@ -8,7 +8,7 @@ namespace
...
@@ -8,7 +8,7 @@ namespace
/**
/**
* @brief Simplest IR analyzer.
* @brief Simplest IR analyzer.
*/
*/
class
CounterPass
class
Block
CounterPass
:
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
Block
CounterPass
()
:
FunctionPass
(
ID
)
:
FunctionPass
(
ID
)
{
{
}
}
// Uncopyable, unmovable.
// Uncopyable, unmovable.
CounterPass
(
const
CounterPass
&
)
=
delete
;
BlockCounterPass
(
const
Block
CounterPass
&
)
=
delete
;
CounterPass
(
CounterPass
&&
)
=
delete
;
BlockCounterPass
(
Block
CounterPass
&&
)
=
delete
;
CounterPass
&
operator
=
(
const
CounterPass
&
)
=
delete
;
BlockCounterPass
&
operator
=
(
const
Block
CounterPass
&
)
=
delete
;
CounterPass
&
operator
=
(
CounterPass
&&
)
=
delete
;
BlockCounterPass
&
operator
=
(
Block
CounterPass
&&
)
=
delete
;
~
CounterPass
()
=
default
;
~
Block
CounterPass
()
=
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
"
;
<<
"[
Block
Counter - 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
"
;
<<
"[
Block
Counter - 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
"
;
<<
"[
Block
Counter - function ] '"
<<
func
.
getName
()
<<
"' Basic blocks: "
<<
func
.
getBasicBlockList
().
size
()
<<
"
\n
"
;
return
false
;
return
false
;
}
}
};
};
char
CounterPass
::
ID
;
char
Block
CounterPass
::
ID
;
// Register pass.
// Register pass.
llvm
::
RegisterPass
<
CounterPass
>
counter_
pass_registry
{
llvm
::
RegisterPass
<
BlockCounterPass
>
pass_registry
{
"count
erpass
"
,
"count
-block
"
,
"IR analyzer"
,
"IR analyzer"
,
};
};
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment