about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-11-04 20:41:36 -0800
committerKartik K. Agaram <vc@akkartik.com>2015-11-04 23:35:21 -0800
commit5a4810855d34ce74b787d70383a712eef9e053f4 (patch)
treecefe72d37575c64d31bbdee2009f619b4cc4fc6b
parent18c57d32aec20e47ea7827460c0628ed218ef333 (diff)
downloadmu-5a4810855d34ce74b787d70383a712eef9e053f4.tar.gz
2358 - starting to tackle the phase ordering problem
A new externality is starting to make its presence felt.

Until I sort this out it's going to be hard to finish making duplex-list
generic.
-rw-r--r--012transform.cc6
-rw-r--r--013update_operation.cc5
-rw-r--r--021check_instruction.cc2
-rw-r--r--030container.cc6
-rw-r--r--040brace.cc5
-rw-r--r--041jump_target.cc4
-rw-r--r--042name.cc4
-rw-r--r--043new.cc2
-rw-r--r--046closure_name.cc4
-rw-r--r--048check_type_by_name.cc4
-rw-r--r--052tangle.cc6
-rw-r--r--056recipe_header.cc10
-rw-r--r--057static_dispatch.cc4
13 files changed, 32 insertions, 30 deletions
diff --git a/012transform.cc b/012transform.cc
index 4152339c..facbea38 100644
--- a/012transform.cc
+++ b/012transform.cc
@@ -14,6 +14,10 @@ typedef void (*transform_fn)(recipe_ordinal);
 :(before "End Globals")
 vector<transform_fn> Transform;
 
+:(after "int main")
+  // Begin Transforms
+  // End Transforms
+
 :(code)
 void transform_all() {
   trace(9990, "transform") << "=== transform_all()" << end();
@@ -29,7 +33,7 @@ void transform_all() {
     }
   }
   parse_int_reagents();  // do this after all other transforms have run
-  // End Transform
+  // End Transform All
 }
 
 void parse_int_reagents() {
diff --git a/013update_operation.cc b/013update_operation.cc
index edfda882..22a8f538 100644
--- a/013update_operation.cc
+++ b/013update_operation.cc
@@ -1,9 +1,8 @@
 //: Once all code is loaded, save operation ids of instructions and check that
 //: nothing's undefined.
 
-:(after "int main")
-  // do this before any other transforms
-  Transform.push_back(update_instruction_operations);
+:(after "Begin Transforms")
+Transform.push_back(update_instruction_operations);
 
 :(code)
 void update_instruction_operations(recipe_ordinal r) {
diff --git a/021check_instruction.cc b/021check_instruction.cc
index 0ceba623..d0efd2a2 100644
--- a/021check_instruction.cc
+++ b/021check_instruction.cc
@@ -9,7 +9,7 @@
 //: transform it in a separate layer or set of layers.
 
 :(after "Transform.push_back(update_instruction_operations)")
-  Transform.push_back(check_instruction);
+Transform.push_back(check_instruction);
 
 :(code)
 void check_instruction(const recipe_ordinal r) {
diff --git a/030container.cc b/030container.cc
index 9618dd2a..05b3a6e9 100644
--- a/030container.cc
+++ b/030container.cc
@@ -510,8 +510,8 @@ container bar [
 -error: unknown type: bar
 $error: 0
 
-:(after "int main")
-  Transform.push_back(check_invalid_types);
+:(after "Begin Transforms")
+Transform.push_back(check_invalid_types);
 
 :(code)
 void check_invalid_types(const recipe_ordinal r) {
@@ -556,7 +556,7 @@ container foo [
 +parse: element name: y
 +parse: type: 1
 
-:(before "End Transform")
+:(before "End Transform All")
 check_container_field_types();
 
 :(code)
diff --git a/040brace.cc b/040brace.cc
index c3c74ad9..fb6698b5 100644
--- a/040brace.cc
+++ b/040brace.cc
@@ -31,9 +31,8 @@ recipe main [
 +transform: jump 1:offset
 +transform: copy ...
 
-//: one-time setup
-:(after "int main")
-  Transform.push_back(transform_braces);
+:(after "Begin Transforms")
+Transform.push_back(transform_braces);
 
 :(code)
 void transform_braces(const recipe_ordinal r) {
diff --git a/041jump_target.cc b/041jump_target.cc
index 1f0e2212..56a2cbce 100644
--- a/041jump_target.cc
+++ b/041jump_target.cc
@@ -18,8 +18,8 @@ recipe main [
 :(before "End Mu Types Initialization")
 Type_ordinal["label"] = 0;
 
-:(after "int main")
-  Transform.push_back(transform_labels);
+:(after "Begin Transforms")
+Transform.push_back(transform_labels);
 
 :(code)
 void transform_labels(const recipe_ordinal r) {
diff --git a/042name.cc b/042name.cc
index 6e56b2e3..0454e9dd 100644
--- a/042name.cc
+++ b/042name.cc
@@ -18,8 +18,8 @@ recipe main [
 +error: main: use before set: y
 # todo: detect conditional defines
 
-:(after "int main")
-  Transform.push_back(transform_names);
+:(after "Begin Transforms")
+Transform.push_back(transform_names);
 
 :(before "End Globals")
 map<recipe_ordinal, map<string, long long int> > Name;
diff --git a/043new.cc b/043new.cc
index 70cac35b..e1cf3e68 100644
--- a/043new.cc
+++ b/043new.cc
@@ -50,7 +50,7 @@ case NEW: {
 
 //:: translate 'new' to 'alloc' instructions that take a size instead of a type
 :(after "Transform.push_back(check_instruction)" following "Transform.push_back(check_invalid_types)")  // so that all types are defined
-  Transform.push_back(transform_new_to_allocate);
+Transform.push_back(transform_new_to_allocate);
 
 :(code)
 void transform_new_to_allocate(recipe_ordinal r) {
diff --git a/046closure_name.cc b/046closure_name.cc
index 6671d00b..d6197fce 100644
--- a/046closure_name.cc
+++ b/046closure_name.cc
@@ -35,8 +35,8 @@ recipe increment-counter [
 :(before "End Globals")
 map<recipe_ordinal, recipe_ordinal> Surrounding_space;
 
-:(after "int main")
-  Transform.push_back(collect_surrounding_spaces);
+:(after "Begin Transforms")
+Transform.push_back(collect_surrounding_spaces);
 
 :(code)
 void collect_surrounding_spaces(const recipe_ordinal r) {
diff --git a/048check_type_by_name.cc b/048check_type_by_name.cc
index 438e45c3..fb193d78 100644
--- a/048check_type_by_name.cc
+++ b/048check_type_by_name.cc
@@ -14,8 +14,8 @@ recipe main [
 ]
 +error: main: x used with multiple types
 
-:(after "int main")
-  Transform.push_back(check_types_by_name);
+:(after "Begin Transforms")
+Transform.push_back(check_types_by_name);
 
 :(code)
 void check_types_by_name(const recipe_ordinal r) {
diff --git a/052tangle.cc b/052tangle.cc
index 0eab6c5c..618dd981 100644
--- a/052tangle.cc
+++ b/052tangle.cc
@@ -54,8 +54,8 @@ else if (command == "after") {
 
 //: after all recipes are loaded, insert fragments at appropriate labels.
 
-:(after "int main")
-  Transform.push_back(insert_fragments);
+:(after "Begin Transforms")
+Transform.push_back(insert_fragments);
 
 //: We might need to perform multiple passes, in case inserted fragments
 //: include more labels that need further insertions. Track which labels we've
@@ -135,7 +135,7 @@ bool is_waypoint(string label) {
 //: complain about unapplied fragments
 :(before "End Globals")
 bool Transform_check_insert_fragments_Ran = false;
-:(before "End One-time Setup")
+:(before "End Transforms")
 Transform.push_back(check_insert_fragments);  // final transform
 :(code)
 void check_insert_fragments(unused recipe_ordinal) {
diff --git a/056recipe_header.cc b/056recipe_header.cc
index cad74e5d..a0a88640 100644
--- a/056recipe_header.cc
+++ b/056recipe_header.cc
@@ -101,8 +101,8 @@ recipe add2 x:number, y:number -> z:number [
 ]
 +error: add2: replied with the wrong type at 'reply z'
 
-:(before "End One-time Setup")
-  Transform.push_back(check_header_products);
+:(before "End Transforms")
+Transform.push_back(check_header_products);
 
 :(code)
 void check_header_products(const recipe_ordinal r) {
@@ -139,7 +139,7 @@ recipe add2 x:number, y:number -> z:number [
 +mem: storing 8 in location 1
 
 :(before "Transform.push_back(transform_names)")
-  Transform.push_back(deduce_types_from_header);
+Transform.push_back(deduce_types_from_header);
 
 :(code)
 void deduce_types_from_header(const recipe_ordinal r) {
@@ -225,8 +225,8 @@ recipe add2 x:number, y:number -> z:number [
 +transform: reply z:number
 +mem: storing 8 in location 1
 
-:(after "int main")
-  Transform.push_back(deduce_fallthrough_reply);
+:(after "Begin Transforms")
+Transform.push_back(deduce_fallthrough_reply);
 
 :(code)
 void deduce_fallthrough_reply(const recipe_ordinal r) {
diff --git a/057static_dispatch.cc b/057static_dispatch.cc
index 3a19714a..20bc82f8 100644
--- a/057static_dispatch.cc
+++ b/057static_dispatch.cc
@@ -102,8 +102,8 @@ recipe test a:number, b:number -> z:number [
 ]
 +mem: storing 2 in location 7
 
-:(after "int main")
-  Transform.push_back(resolve_ambiguous_calls);
+:(after "Begin Transforms")
+Transform.push_back(resolve_ambiguous_calls);
 
 :(code)
 void resolve_ambiguous_calls(recipe_ordinal r) {