Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
Pyston
Commits
f96c49ab
Commit
f96c49ab
authored
Sep 08, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #904 from undingen/printvisitor
PrintVisitor: use raw_ostream
parents
1782dd56
fe6885a6
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
209 additions
and
206 deletions
+209
-206
src/core/ast.cpp
src/core/ast.cpp
+189
-189
src/core/ast.h
src/core/ast.h
+4
-1
src/core/cfg.cpp
src/core/cfg.cpp
+14
-14
src/core/cfg.h
src/core/cfg.h
+2
-2
No files found.
src/core/ast.cpp
View file @
f96c49ab
This diff is collapsed.
Click to expand it.
src/core/ast.h
View file @
f96c49ab
...
...
@@ -22,6 +22,7 @@
#include <vector>
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/raw_ostream.h"
#include "analysis/scoping_analysis.h"
#include "core/common.h"
...
...
@@ -1329,11 +1330,13 @@ public:
void
print_ast
(
AST
*
ast
);
class
PrintVisitor
:
public
ASTVisitor
{
private:
llvm
::
raw_ostream
&
stream
;
int
indent
;
void
printIndent
();
void
printOp
(
AST_TYPE
::
AST_TYPE
op_type
);
public:
PrintVisitor
(
int
indent
=
0
)
:
indent
(
indent
)
{}
PrintVisitor
(
int
indent
=
0
,
llvm
::
raw_ostream
&
stream
=
llvm
::
outs
())
:
stream
(
stream
),
indent
(
indent
)
{}
virtual
~
PrintVisitor
()
{}
virtual
bool
visit_alias
(
AST_alias
*
node
);
...
...
src/core/cfg.cpp
View file @
f96c49ab
...
...
@@ -56,26 +56,26 @@ void CFGBlock::unconnectFrom(CFGBlock* successor) {
successor
->
predecessors
.
end
());
}
void
CFGBlock
::
print
()
{
printf
(
"Block %d"
,
idx
)
;
void
CFGBlock
::
print
(
llvm
::
raw_ostream
&
stream
)
{
stream
<<
"Block "
<<
idx
;
if
(
info
)
printf
(
" '%s'"
,
info
)
;
stream
<<
" '"
<<
info
<<
"'"
;
printf
(
"; Predecessors:"
)
;
stream
<<
"; Predecessors:"
;
for
(
int
j
=
0
;
j
<
predecessors
.
size
();
j
++
)
{
printf
(
" %d"
,
predecessors
[
j
]
->
idx
)
;
stream
<<
" "
<<
predecessors
[
j
]
->
idx
;
}
printf
(
" Successors:"
)
;
stream
<<
" Successors:"
;
for
(
int
j
=
0
;
j
<
successors
.
size
();
j
++
)
{
printf
(
" %d"
,
successors
[
j
]
->
idx
)
;
stream
<<
" "
<<
successors
[
j
]
->
idx
;
}
printf
(
"
\n
"
)
;
stream
<<
"
\n
"
;
PrintVisitor
pv
(
4
);
for
(
int
j
=
0
;
j
<
body
.
size
();
j
++
)
{
printf
(
" "
)
;
stream
<<
" "
;
body
[
j
]
->
accept
(
&
pv
);
printf
(
"
\n
"
)
;
stream
<<
"
\n
"
;
}
}
...
...
@@ -2518,11 +2518,11 @@ public:
}
};
void
CFG
::
print
()
{
printf
(
"CFG:
\n
"
)
;
printf
(
"%ld blocks
\n
"
,
blocks
.
size
())
;
void
CFG
::
print
(
llvm
::
raw_ostream
&
stream
)
{
stream
<<
"CFG:
\n
"
;
stream
<<
blocks
.
size
()
<<
" blocks
\n
"
;
for
(
int
i
=
0
;
i
<
blocks
.
size
();
i
++
)
blocks
[
i
]
->
print
();
blocks
[
i
]
->
print
(
stream
);
}
class
AssignVRegsVisitor
:
public
NoopASTVisitor
{
...
...
src/core/cfg.h
View file @
f96c49ab
...
...
@@ -66,7 +66,7 @@ public:
void
unconnectFrom
(
CFGBlock
*
successor
);
void
push_back
(
AST_stmt
*
node
)
{
body
.
push_back
(
node
);
}
void
print
();
void
print
(
llvm
::
raw_ostream
&
stream
=
llvm
::
outs
()
);
};
// Control Flow Graph
...
...
@@ -108,7 +108,7 @@ public:
blocks
.
push_back
(
block
);
}
void
print
();
void
print
(
llvm
::
raw_ostream
&
stream
=
llvm
::
outs
()
);
bool
hasVregsAssigned
()
{
return
has_vregs_assigned
;
}
void
assignVRegs
(
const
ParamNames
&
param_names
,
ScopeInfo
*
scope_info
);
...
...
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