Move the stack layout computation into its own module.

This is trying to keep algorithms out if the ir module which deals with
the intermediate representation.

Also give the layout_stack() function a Result return value so it can
report a soft error when the stack frame is too large instead of
asserting. Since local variables can be arbitrarily large, it is easy
enough to overflow the stack with even a small function.
This commit is contained in:
Jakob Stoklund Olesen
2017-08-03 13:31:58 -07:00
parent c96d4daa20
commit 39cc7efc2d
4 changed files with 194 additions and 172 deletions

View File

@@ -7,7 +7,7 @@ use std::fmt;
/// A compilation error.
///
/// When Cretonne fails to compile a function, it will return one of these error codes.
#[derive(Debug)]
#[derive(Debug, PartialEq, Eq)]
pub enum CtonError {
/// An IL verifier error.
///