diff options
author | Ben Gamari <bgamari.foss@gmail.com> | 2017-02-07 22:56:36 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2017-02-08 10:26:00 -0500 |
commit | 3328ddb88b6eb11cb1f6e844f883e7e9d2b8f21b (patch) | |
tree | 3bb04ff1f086a95e8f93041d13a10af7ec1f9011 /compiler/cmm/CmmParse.y | |
parent | 733e845d0f66541a06415c6b420e51fc99eb9d95 (diff) | |
download | haskell-3328ddb88b6eb11cb1f6e844f883e7e9d2b8f21b.tar.gz |
Cmm: Add support for undefined unwinding statements
And use to mark `stg_stack_underflow_frame`, which we are unable to
determine a caller from.
To simplify parsing at the moment we steal the `return` keyword to
indicate an undefined unwind value. Perhaps this should be revisited.
Reviewers: scpmw, simonmar, austin, erikd
Subscribers: dfeuer, thomie
Differential Revision: https://phabricator.haskell.org/D2738
Diffstat (limited to 'compiler/cmm/CmmParse.y')
-rw-r--r-- | compiler/cmm/CmmParse.y | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/compiler/cmm/CmmParse.y b/compiler/cmm/CmmParse.y index cfadc61e84..69925811ce 100644 --- a/compiler/cmm/CmmParse.y +++ b/compiler/cmm/CmmParse.y @@ -639,12 +639,20 @@ stmt :: { CmmParse () } { $2 >>= code . emitUnwind } unwind_regs - :: { CmmParse [(GlobalReg, CmmExpr)] } - : GLOBALREG '=' expr ',' unwind_regs + :: { CmmParse [(GlobalReg, Maybe CmmExpr)] } + : GLOBALREG '=' expr_or_unknown ',' unwind_regs { do e <- $3; rest <- $5; return (($1, e) : rest) } - | GLOBALREG '=' expr + | GLOBALREG '=' expr_or_unknown { do e <- $3; return [($1, e)] } +-- | Used by unwind to indicate unknown unwinding values. +expr_or_unknown + :: { CmmParse (Maybe CmmExpr) } + : 'return' + { do return Nothing } + | expr + { do e <- $1; return (Just e) } + foreignLabel :: { CmmParse CmmExpr } : NAME { return (CmmLit (CmmLabel (mkForeignLabel $1 Nothing ForeignLabelInThisPackage IsFunction))) } |