Stack Limit as an Argument Purpose (#372)

* Initial approach.

* Move stack_limit check before opening the frame

* Account for GPRs and frame pointer in stack check

* Check stack_limit example.

* Remove stack_limit attribute code.

Amends #359

* fmt
This commit is contained in:
Sergey Pepyakin
2018-08-04 16:16:21 +03:00
committed by Dan Gohman
parent 217786e969
commit 9dbfbbde10
10 changed files with 91 additions and 75 deletions

View File

@@ -274,15 +274,6 @@ impl<'a> Context<'a> {
}
}
// Assign the global for the stack limit.
fn set_stack_limit(&mut self, gv: GlobalValue, loc: Location) -> ParseResult<()> {
if self.function.set_stack_limit(Some(gv)).is_some() {
err!(loc, "multiple stack_limit declarations")
} else {
Ok(())
}
}
// Allocate a new EBB.
fn add_ebb(&mut self, ebb: Ebb, loc: Location) -> ParseResult<Ebb> {
self.map.def_ebb(ebb, loc)?;
@@ -1032,7 +1023,6 @@ impl<'a> Parser<'a> {
// * function-decl
// * signature-decl
// * jump-table-decl
// * stack-limit-decl
//
// The parsed decls are added to `ctx` rather than returned.
fn parse_preamble(&mut self, ctx: &mut Context) -> ParseResult<()> {
@@ -1074,9 +1064,6 @@ impl<'a> Parser<'a> {
self.parse_jump_table_decl()
.and_then(|(jt, dat)| ctx.add_jt(jt, dat, self.loc))
}
Some(Token::Identifier("stack_limit")) => self
.parse_stack_limit_decl()
.and_then(|gv| ctx.set_stack_limit(gv, self.loc)),
// More to come..
_ => return Ok(()),
}?;
@@ -1414,15 +1401,6 @@ impl<'a> Parser<'a> {
}
}
/// stack-limit-decl ::= "stack_limit" "=" GlobalValue(gv)
fn parse_stack_limit_decl(&mut self) -> ParseResult<GlobalValue> {
self.consume();
self.match_token(Token::Equal, "expected '=' in stack limit declaration")?;
let gv = self.match_gv("expected global value")?;
Ok(gv)
}
// Parse a function body, add contents to `ctx`.
//
// function-body ::= * { extended-basic-block }