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
403fb36a
Commit
403fb36a
authored
Jan 21, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove AST_Unreachable
parent
dc7a6171
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
7 additions
and
49 deletions
+7
-49
src/analysis/function_analysis.cpp
src/analysis/function_analysis.cpp
+0
-1
src/analysis/type_analysis.cpp
src/analysis/type_analysis.cpp
+0
-2
src/codegen/irgen/irgenerator.cpp
src/codegen/irgen/irgenerator.cpp
+0
-4
src/codegen/pypa-parser.cpp
src/codegen/pypa-parser.cpp
+4
-4
src/core/ast.cpp
src/core/ast.cpp
+0
-19
src/core/ast.h
src/core/ast.h
+0
-15
src/core/cfg.cpp
src/core/cfg.cpp
+3
-4
No files found.
src/analysis/function_analysis.cpp
View file @
403fb36a
...
...
@@ -297,7 +297,6 @@ public:
virtual
bool
visit_print
(
AST_Print
*
node
)
{
return
true
;
}
virtual
bool
visit_raise
(
AST_Raise
*
node
)
{
return
true
;
}
virtual
bool
visit_return
(
AST_Return
*
node
)
{
return
true
;
}
virtual
bool
visit_unreachable
(
AST_Unreachable
*
node
)
{
return
true
;
}
virtual
bool
visit_classdef
(
AST_ClassDef
*
node
)
{
_doSet
(
node
->
name
);
...
...
src/analysis/type_analysis.cpp
View file @
403fb36a
...
...
@@ -594,8 +594,6 @@ private:
}
}
void
visit_unreachable
(
AST_Unreachable
*
node
)
override
{}
public:
static
void
propagate
(
CFGBlock
*
block
,
const
TypeMap
&
starting
,
TypeMap
&
ending
,
ExprTypeMap
&
expr_types
,
TypeSpeculations
&
type_speculations
,
TypeAnalysis
::
SpeculationLevel
speculation
,
...
...
src/codegen/irgen/irgenerator.cpp
View file @
403fb36a
...
...
@@ -2178,10 +2178,6 @@ private:
case
AST_TYPE
:
:
Raise
:
doRaise
(
ast_cast
<
AST_Raise
>
(
node
),
unw_info
);
break
;
case
AST_TYPE
:
:
Unreachable
:
emitter
.
getBuilder
()
->
CreateUnreachable
();
endBlock
(
FINISHED
);
break
;
default:
printf
(
"Unhandled stmt type at "
__FILE__
":"
STRINGIFY
(
__LINE__
)
": %d
\n
"
,
node
->
type
);
exit
(
1
);
...
...
src/codegen/pypa-parser.cpp
View file @
403fb36a
...
...
@@ -61,7 +61,7 @@ AST_TYPE::AST_TYPE readItem(pypa::AstBoolOpType type) {
break
;
}
assert
(
"Unknown AstBoolOpType"
&&
false
);
return
AST_TYPE
::
Unreachable
;
abort
()
;
}
AST_TYPE
::
AST_TYPE
readItem
(
pypa
::
AstBinOpType
type
)
{
...
...
@@ -94,7 +94,7 @@ AST_TYPE::AST_TYPE readItem(pypa::AstBinOpType type) {
break
;
}
assert
(
"Unknown AstBinOpType"
&&
false
);
return
AST_TYPE
::
Unreachable
;
abort
()
;
}
AST_TYPE
::
AST_TYPE
readItem
(
pypa
::
AstUnaryOpType
type
)
{
...
...
@@ -111,7 +111,7 @@ AST_TYPE::AST_TYPE readItem(pypa::AstUnaryOpType type) {
break
;
}
assert
(
"Unknown AstUnaryOpType"
&&
false
);
return
AST_TYPE
::
Unreachable
;
abort
()
;
}
...
...
@@ -162,7 +162,7 @@ AST_TYPE::AST_TYPE readItem(pypa::AstCompareOpType type) {
break
;
}
assert
(
"Unknown AstCompareOpType"
&&
false
);
return
AST_TYPE
::
Unreachable
;
abort
()
;
}
std
::
string
readName
(
pypa
::
AstExpression
&
e
)
{
...
...
src/core/ast.cpp
View file @
403fb36a
...
...
@@ -869,16 +869,6 @@ void* AST_UnaryOp::accept_expr(ExprVisitor* v) {
return
v
->
visit_unaryop
(
this
);
}
void
AST_Unreachable
::
accept
(
ASTVisitor
*
v
)
{
bool
skip
=
v
->
visit_unreachable
(
this
);
if
(
skip
)
return
;
}
void
AST_Unreachable
::
accept_stmt
(
StmtVisitor
*
v
)
{
v
->
visit_unreachable
(
this
);
}
void
AST_While
::
accept
(
ASTVisitor
*
v
)
{
bool
skip
=
v
->
visit_while
(
this
);
if
(
skip
)
...
...
@@ -1726,11 +1716,6 @@ bool PrintVisitor::visit_unaryop(AST_UnaryOp* node) {
return
true
;
}
bool
PrintVisitor
::
visit_unreachable
(
AST_Unreachable
*
node
)
{
printf
(
"<unreachable>"
);
return
true
;
}
bool
PrintVisitor
::
visit_while
(
AST_While
*
node
)
{
printf
(
"while "
);
node
->
test
->
accept
(
this
);
...
...
@@ -2025,10 +2010,6 @@ public:
output
->
push_back
(
node
);
return
false
;
}
virtual
bool
visit_unreachable
(
AST_Unreachable
*
node
)
{
output
->
push_back
(
node
);
return
false
;
}
virtual
bool
visit_while
(
AST_While
*
node
)
{
output
->
push_back
(
node
);
return
false
;
...
...
src/core/ast.h
View file @
403fb36a
...
...
@@ -125,7 +125,6 @@ enum AST_TYPE {
AugBinOp
=
203
,
Invoke
=
204
,
LangPrimitive
=
205
,
Unreachable
=
206
,
// These aren't real AST types, but since we use AST types to represent binexp types
// and divmod+truediv are essentially types of binops, we add them here (at least for now):
...
...
@@ -989,16 +988,6 @@ public:
static
const
AST_TYPE
::
AST_TYPE
TYPE
=
AST_TYPE
::
LangPrimitive
;
};
class
AST_Unreachable
:
public
AST_stmt
{
public:
virtual
void
accept
(
ASTVisitor
*
v
);
virtual
void
accept_stmt
(
StmtVisitor
*
v
);
AST_Unreachable
()
:
AST_stmt
(
AST_TYPE
::
Unreachable
)
{}
static
const
AST_TYPE
::
AST_TYPE
TYPE
=
AST_TYPE
::
Unreachable
;
};
template
<
typename
T
>
T
*
ast_cast
(
AST
*
node
)
{
assert
(
node
->
type
==
T
::
TYPE
);
return
static_cast
<
T
*>
(
node
);
...
...
@@ -1066,7 +1055,6 @@ public:
virtual
bool
visit_tryfinally
(
AST_TryFinally
*
node
)
{
RELEASE_ASSERT
(
0
,
""
);
}
virtual
bool
visit_tuple
(
AST_Tuple
*
node
)
{
RELEASE_ASSERT
(
0
,
""
);
}
virtual
bool
visit_unaryop
(
AST_UnaryOp
*
node
)
{
RELEASE_ASSERT
(
0
,
""
);
}
virtual
bool
visit_unreachable
(
AST_Unreachable
*
node
)
{
RELEASE_ASSERT
(
0
,
""
);
}
virtual
bool
visit_while
(
AST_While
*
node
)
{
RELEASE_ASSERT
(
0
,
""
);
}
virtual
bool
visit_with
(
AST_With
*
node
)
{
RELEASE_ASSERT
(
0
,
""
);
}
virtual
bool
visit_yield
(
AST_Yield
*
node
)
{
RELEASE_ASSERT
(
0
,
""
);
}
...
...
@@ -1135,7 +1123,6 @@ public:
virtual
bool
visit_tryfinally
(
AST_TryFinally
*
node
)
{
return
false
;
}
virtual
bool
visit_tuple
(
AST_Tuple
*
node
)
{
return
false
;
}
virtual
bool
visit_unaryop
(
AST_UnaryOp
*
node
)
{
return
false
;
}
virtual
bool
visit_unreachable
(
AST_Unreachable
*
node
)
{
return
false
;
}
virtual
bool
visit_while
(
AST_While
*
node
)
{
return
false
;
}
virtual
bool
visit_with
(
AST_With
*
node
)
{
return
false
;
}
virtual
bool
visit_yield
(
AST_Yield
*
node
)
{
return
false
;
}
...
...
@@ -1206,7 +1193,6 @@ public:
virtual
void
visit_return
(
AST_Return
*
node
)
{
RELEASE_ASSERT
(
0
,
""
);
}
virtual
void
visit_tryexcept
(
AST_TryExcept
*
node
)
{
RELEASE_ASSERT
(
0
,
""
);
}
virtual
void
visit_tryfinally
(
AST_TryFinally
*
node
)
{
RELEASE_ASSERT
(
0
,
""
);
}
virtual
void
visit_unreachable
(
AST_Unreachable
*
node
)
{
RELEASE_ASSERT
(
0
,
""
);
}
virtual
void
visit_while
(
AST_While
*
node
)
{
RELEASE_ASSERT
(
0
,
""
);
}
virtual
void
visit_with
(
AST_With
*
node
)
{
RELEASE_ASSERT
(
0
,
""
);
}
...
...
@@ -1279,7 +1265,6 @@ public:
virtual
bool
visit_tryexcept
(
AST_TryExcept
*
node
);
virtual
bool
visit_tryfinally
(
AST_TryFinally
*
node
);
virtual
bool
visit_unaryop
(
AST_UnaryOp
*
node
);
virtual
bool
visit_unreachable
(
AST_Unreachable
*
node
);
virtual
bool
visit_while
(
AST_While
*
node
);
virtual
bool
visit_with
(
AST_With
*
node
);
virtual
bool
visit_yield
(
AST_Yield
*
node
);
...
...
src/core/cfg.cpp
View file @
403fb36a
...
...
@@ -1821,7 +1821,6 @@ public:
if
(
!
curblock
)
return
true
;
curblock
->
push_back
(
new
AST_Unreachable
());
curblock
=
NULL
;
return
true
;
...
...
@@ -1928,7 +1927,6 @@ public:
raise
->
arg1
=
makeName
(
exc_value_name
,
AST_TYPE
::
Load
,
node
->
lineno
);
raise
->
arg2
=
makeName
(
exc_traceback_name
,
AST_TYPE
::
Load
,
node
->
lineno
);
push_back
(
raise
);
curblock
->
push_back
(
new
AST_Unreachable
());
curblock
=
NULL
;
}
}
...
...
@@ -2009,7 +2007,6 @@ public:
raise
->
arg1
=
makeName
(
exc_value_name
,
AST_TYPE
::
Load
,
node
->
lineno
);
raise
->
arg2
=
makeName
(
exc_traceback_name
,
AST_TYPE
::
Load
,
node
->
lineno
);
push_back
(
raise
);
curblock
->
push_back
(
new
AST_Unreachable
());
curblock
=
noexc
;
}
...
...
@@ -2236,7 +2233,7 @@ CFG* computeCFG(SourceInfo* source, std::vector<AST_stmt*> body) {
if
(
b
->
successors
.
size
()
==
0
)
{
AST_stmt
*
terminator
=
b
->
body
.
back
();
assert
(
terminator
->
type
==
AST_TYPE
::
Return
||
terminator
->
type
==
AST_TYPE
::
Raise
||
terminator
->
type
==
AST_TYPE
::
Unreachabl
e
);
||
terminator
->
type
==
AST_TYPE
::
Rais
e
);
}
if
(
b
->
predecessors
.
size
()
==
0
)
...
...
@@ -2297,6 +2294,8 @@ CFG* computeCFG(SourceInfo* source, std::vector<AST_stmt*> body) {
no_dups
=
false
;
}
}
if
(
!
no_dups
)
rtn
->
print
();
assert
(
no_dups
);
// TODO make sure the result of Invoke nodes are not used on the exceptional path
...
...
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