diff options
Diffstat (limited to 'source/compiler/aslcompile.c')
| -rw-r--r-- | source/compiler/aslcompile.c | 74 | 
1 files changed, 49 insertions, 25 deletions
diff --git a/source/compiler/aslcompile.c b/source/compiler/aslcompile.c index 4b8f15ed572b0..54c863e7638b5 100644 --- a/source/compiler/aslcompile.c +++ b/source/compiler/aslcompile.c @@ -138,7 +138,7 @@ CmDoCompile (      /* Did the parse tree get successfully constructed? */ -    if (!RootNode) +    if (!Gbl_ParseTreeRoot)      {          /*           * If there are no errors, then we have some sort of @@ -166,22 +166,22 @@ CmDoCompile (      LsDumpParseTree (); -    OpcGetIntegerWidth (RootNode->Asl.Child); +    OpcGetIntegerWidth (Gbl_ParseTreeRoot->Asl.Child);      UtEndEvent (Event);      /* Pre-process parse tree for any operator transforms */      Event = UtBeginEvent ("Parse tree transforms");      DbgPrint (ASL_DEBUG_OUTPUT, "\nParse tree transforms\n\n"); -    TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, -        TrAmlTransformWalk, NULL, NULL); +    TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_TWICE, +        TrAmlTransformWalkBegin, TrAmlTransformWalkEnd, NULL);      UtEndEvent (Event);      /* Generate AML opcodes corresponding to the parse tokens */      Event = UtBeginEvent ("Generate AML opcodes"); -    DbgPrint (ASL_DEBUG_OUTPUT, "\nGenerating AML opcodes\n\n"); -    TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL, +    DbgPrint (ASL_DEBUG_OUTPUT, "Generating AML opcodes\n\n"); +    TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, NULL,          OpcAmlOpcodeWalk, NULL);      UtEndEvent (Event); @@ -203,11 +203,11 @@ CmDoCompile (      Event = UtBeginEvent ("Constant folding via AML interpreter");      DbgPrint (ASL_DEBUG_OUTPUT, -        "\nInterpreting compile-time constant expressions\n\n"); +        "Interpreting compile-time constant expressions\n\n");      if (Gbl_FoldConstants)      { -        TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, +        TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD,              OpcAmlConstantWalk, NULL, NULL);      }      else @@ -220,16 +220,16 @@ CmDoCompile (      Event = UtBeginEvent ("Updating AML opcodes after constant folding");      DbgPrint (ASL_DEBUG_OUTPUT, -        "\nUpdating AML opcodes after constant folding\n\n"); -    TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, +        "Updating AML opcodes after constant folding\n\n"); +    TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD,          NULL, OpcAmlOpcodeUpdateWalk, NULL);      UtEndEvent (Event);      /* Calculate all AML package lengths */      Event = UtBeginEvent ("Generate AML package lengths"); -    DbgPrint (ASL_DEBUG_OUTPUT, "\nGenerating Package lengths\n\n"); -    TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL, +    DbgPrint (ASL_DEBUG_OUTPUT, "Generating Package lengths\n\n"); +    TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, NULL,          LnPackageLengthWalk, NULL);      UtEndEvent (Event); @@ -255,7 +255,8 @@ CmDoCompile (      /* Namespace loading */      Event = UtBeginEvent ("Create ACPI Namespace"); -    Status = LdLoadNamespace (RootNode); +    DbgPrint (ASL_DEBUG_OUTPUT, "Creating ACPI Namespace\n\n"); +    Status = LdLoadNamespace (Gbl_ParseTreeRoot);      UtEndEvent (Event);      if (ACPI_FAILURE (Status))      { @@ -266,6 +267,7 @@ CmDoCompile (      AslGbl_NamespaceEvent = UtBeginEvent (          "Cross reference parse tree and Namespace"); +    DbgPrint (ASL_DEBUG_OUTPUT, "Cross referencing namespace\n\n");      Status = XfCrossReferenceNamespace ();      if (ACPI_FAILURE (Status))      { @@ -277,6 +279,14 @@ CmDoCompile (      LkFindUnreferencedObjects ();      UtEndEvent (AslGbl_NamespaceEvent); +    /* Resolve External Declarations */ + +    Event = UtBeginEvent ("Resolve all Externals"); +    DbgPrint (ASL_DEBUG_OUTPUT, "\nResolve Externals\n\n"); +    TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_TWICE, +        ExAmlExternalWalkBegin, ExAmlExternalWalkEnd, NULL); +    UtEndEvent (Event); +      /*       * Semantic analysis. This can happen only after the       * namespace has been loaded and cross-referenced. @@ -286,17 +296,30 @@ CmDoCompile (      Event = UtBeginEvent ("Analyze control method return types");      AnalysisWalkInfo.MethodStack = NULL; -    DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - Method analysis\n\n"); -    TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE, +    DbgPrint (ASL_DEBUG_OUTPUT, "Semantic analysis - Method analysis\n\n"); + +    if (Gbl_CrossReferenceOutput) +    { +        OtPrintHeaders ("Part 1: Object Reference Map " +            "(Object references from within each control method)"); +    } + +    TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_TWICE,          MtMethodAnalysisWalkBegin,          MtMethodAnalysisWalkEnd, &AnalysisWalkInfo);      UtEndEvent (Event); +    /* Generate the object cross-reference file if requested */ + +    Event = UtBeginEvent ("Generate cross-reference file"); +    OtCreateXrefFile (); +    UtEndEvent (Event); +      /* Semantic error checking part two - typing of method returns */      Event = UtBeginEvent ("Determine object types returned by methods"); -    DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - Method typing\n\n"); -    TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, +    DbgPrint (ASL_DEBUG_OUTPUT, "Semantic analysis - Method typing\n\n"); +    TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD,          NULL, AnMethodTypingWalkEnd, NULL);      UtEndEvent (Event); @@ -304,10 +327,10 @@ CmDoCompile (      Event = UtBeginEvent ("Analyze AML operand types");      DbgPrint (ASL_DEBUG_OUTPUT, -        "\nSemantic analysis - Operand type checking\n\n"); +        "Semantic analysis - Operand type checking\n\n");      if (Gbl_DoTypechecking)      { -        TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, +        TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD,              NULL, AnOperandTypecheckWalkEnd, &AnalysisWalkInfo);      }      UtEndEvent (Event); @@ -315,8 +338,8 @@ CmDoCompile (      /* Semantic error checking part four - other miscellaneous checks */      Event = UtBeginEvent ("Miscellaneous analysis"); -    DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - miscellaneous\n\n"); -    TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, +    DbgPrint (ASL_DEBUG_OUTPUT, "Semantic analysis - miscellaneous\n\n"); +    TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD,          AnOtherSemanticAnalysisWalkBegin,          NULL, &AnalysisWalkInfo);      UtEndEvent (Event); @@ -324,16 +347,17 @@ CmDoCompile (      /* Calculate all AML package lengths */      Event = UtBeginEvent ("Finish AML package length generation"); -    DbgPrint (ASL_DEBUG_OUTPUT, "\nGenerating Package lengths\n\n"); -    TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL, +    DbgPrint (ASL_DEBUG_OUTPUT, "Generating Package lengths\n\n"); +    TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, NULL,          LnInitLengthsWalk, NULL); -    TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL, +    TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, NULL,          LnPackageLengthWalk, NULL);      UtEndEvent (Event);      /* Code generation - emit the AML */      Event = UtBeginEvent ("Generate AML code and write output files"); +    DbgPrint (ASL_DEBUG_OUTPUT, "Writing AML byte code\n\n");      CgGenerateAmlOutput ();      UtEndEvent (Event); @@ -816,7 +840,7 @@ CmDeleteCaches (      Gbl_ParseOpCount = 0;      Gbl_ParseOpCacheNext = NULL;      Gbl_ParseOpCacheLast = NULL; -    RootNode = NULL; +    Gbl_ParseTreeRoot = NULL;      /* Generic string cache */  | 
