diff options
author | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2013-03-16 16:51:42 +0000 |
---|---|---|
committer | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2013-03-16 16:51:42 +0000 |
commit | 707b6a1ae9660b13cf6f68c7c0ce74017f5981c5 (patch) | |
tree | 166a21d507612d60db40737333ddec5003fc81aa /backend/Linearize.v | |
parent | e44df4563f1cb893ab25b2a8b25d5b83095205be (diff) | |
download | compcert-707b6a1ae9660b13cf6f68c7c0ce74017f5981c5.tar.gz compcert-707b6a1ae9660b13cf6f68c7c0ce74017f5981c5.zip |
Assorted changes to reduce stack and heap requirements when compiling very big functions.
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2151 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'backend/Linearize.v')
-rw-r--r-- | backend/Linearize.v | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/backend/Linearize.v b/backend/Linearize.v index 636cb224..6fc8e489 100644 --- a/backend/Linearize.v +++ b/backend/Linearize.v @@ -198,17 +198,15 @@ Definition linearize_instr (b: LTL.instruction) (k: code) : code := (** Linearize a function body according to an enumeration of its nodes. *) -Fixpoint linearize_body (f: LTL.function) (enum: list node) - {struct enum} : code := - match enum with - | nil => nil - | pc :: rem => - match f.(LTL.fn_code)!pc with - | None => linearize_body f rem - | Some b => Llabel pc :: linearize_instr b (linearize_body f rem) - end +Definition linearize_node (f: LTL.function) (pc: node) (k: code) : code := + match f.(LTL.fn_code)!pc with + | None => k + | Some b => Llabel pc :: linearize_instr b k end. +Definition linearize_body (f: LTL.function) (enum: list node) : code := + list_fold_right (linearize_node f) enum nil. + (** * Entry points for code linearization *) Definition transf_function (f: LTL.function) : res LTLin.function := |