Home | History | Annotate | Line # | Download | only in compiler
aslcompile.c revision 1.1.1.12
      1       1.1    jruoho /******************************************************************************
      2       1.1    jruoho  *
      3       1.1    jruoho  * Module Name: aslcompile - top level compile module
      4       1.1    jruoho  *
      5       1.1    jruoho  *****************************************************************************/
      6       1.1    jruoho 
      7   1.1.1.2    jruoho /*
      8   1.1.1.9  christos  * Copyright (C) 2000 - 2017, Intel Corp.
      9       1.1    jruoho  * All rights reserved.
     10       1.1    jruoho  *
     11   1.1.1.2    jruoho  * Redistribution and use in source and binary forms, with or without
     12   1.1.1.2    jruoho  * modification, are permitted provided that the following conditions
     13   1.1.1.2    jruoho  * are met:
     14   1.1.1.2    jruoho  * 1. Redistributions of source code must retain the above copyright
     15   1.1.1.2    jruoho  *    notice, this list of conditions, and the following disclaimer,
     16   1.1.1.2    jruoho  *    without modification.
     17   1.1.1.2    jruoho  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
     18   1.1.1.2    jruoho  *    substantially similar to the "NO WARRANTY" disclaimer below
     19   1.1.1.2    jruoho  *    ("Disclaimer") and any redistribution must be conditioned upon
     20   1.1.1.2    jruoho  *    including a substantially similar Disclaimer requirement for further
     21   1.1.1.2    jruoho  *    binary redistribution.
     22   1.1.1.2    jruoho  * 3. Neither the names of the above-listed copyright holders nor the names
     23   1.1.1.2    jruoho  *    of any contributors may be used to endorse or promote products derived
     24   1.1.1.2    jruoho  *    from this software without specific prior written permission.
     25   1.1.1.2    jruoho  *
     26   1.1.1.2    jruoho  * Alternatively, this software may be distributed under the terms of the
     27   1.1.1.2    jruoho  * GNU General Public License ("GPL") version 2 as published by the Free
     28   1.1.1.2    jruoho  * Software Foundation.
     29   1.1.1.2    jruoho  *
     30   1.1.1.2    jruoho  * NO WARRANTY
     31   1.1.1.2    jruoho  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     32   1.1.1.2    jruoho  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     33   1.1.1.2    jruoho  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
     34   1.1.1.2    jruoho  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     35   1.1.1.2    jruoho  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     36   1.1.1.2    jruoho  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     37   1.1.1.2    jruoho  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     38   1.1.1.2    jruoho  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     39   1.1.1.2    jruoho  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
     40   1.1.1.2    jruoho  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     41   1.1.1.2    jruoho  * POSSIBILITY OF SUCH DAMAGES.
     42   1.1.1.2    jruoho  */
     43   1.1.1.2    jruoho 
     44   1.1.1.2    jruoho #include "aslcompiler.h"
     45   1.1.1.4  christos #include "acnamesp.h"
     46       1.1    jruoho 
     47       1.1    jruoho #include <stdio.h>
     48       1.1    jruoho #include <time.h>
     49   1.1.1.2    jruoho #include <acapps.h>
     50       1.1    jruoho 
     51       1.1    jruoho #define _COMPONENT          ACPI_COMPILER
     52       1.1    jruoho         ACPI_MODULE_NAME    ("aslcompile")
     53       1.1    jruoho 
     54   1.1.1.3  christos /*
     55   1.1.1.3  christos  * Main parser entry
     56   1.1.1.3  christos  * External is here in case the parser emits the same external in the
     57   1.1.1.3  christos  * generated header. (Newer versions of Bison)
     58   1.1.1.3  christos  */
     59   1.1.1.3  christos int
     60   1.1.1.3  christos AslCompilerparse(
     61   1.1.1.3  christos     void);
     62   1.1.1.3  christos 
     63       1.1    jruoho /* Local prototypes */
     64       1.1    jruoho 
     65       1.1    jruoho static void
     66       1.1    jruoho CmFlushSourceCode (
     67       1.1    jruoho     void);
     68       1.1    jruoho 
     69   1.1.1.2    jruoho static void
     70   1.1.1.4  christos CmDumpAllEvents (
     71   1.1.1.4  christos     void);
     72       1.1    jruoho 
     73       1.1    jruoho 
     74       1.1    jruoho /*******************************************************************************
     75       1.1    jruoho  *
     76       1.1    jruoho  * FUNCTION:    CmDoCompile
     77       1.1    jruoho  *
     78       1.1    jruoho  * PARAMETERS:  None
     79       1.1    jruoho  *
     80       1.1    jruoho  * RETURN:      Status (0 = OK)
     81       1.1    jruoho  *
     82       1.1    jruoho  * DESCRIPTION: This procedure performs the entire compile
     83       1.1    jruoho  *
     84       1.1    jruoho  ******************************************************************************/
     85       1.1    jruoho 
     86       1.1    jruoho int
     87       1.1    jruoho CmDoCompile (
     88       1.1    jruoho     void)
     89       1.1    jruoho {
     90       1.1    jruoho     ACPI_STATUS             Status;
     91       1.1    jruoho     UINT8                   FullCompile;
     92       1.1    jruoho     UINT8                   Event;
     93       1.1    jruoho 
     94       1.1    jruoho 
     95       1.1    jruoho     FullCompile = UtBeginEvent ("*** Total Compile time ***");
     96       1.1    jruoho     Event = UtBeginEvent ("Open input and output files");
     97       1.1    jruoho     UtEndEvent (Event);
     98       1.1    jruoho 
     99   1.1.1.3  christos     Event = UtBeginEvent ("Preprocess input file");
    100   1.1.1.3  christos     if (Gbl_PreprocessFlag)
    101   1.1.1.3  christos     {
    102   1.1.1.6  christos         /* Enter compiler name as a #define */
    103   1.1.1.6  christos 
    104   1.1.1.6  christos         PrAddDefine (ASL_DEFINE, "", FALSE);
    105   1.1.1.6  christos 
    106   1.1.1.3  christos         /* Preprocessor */
    107   1.1.1.3  christos 
    108   1.1.1.3  christos         PrDoPreprocess ();
    109   1.1.1.6  christos         Gbl_CurrentLineNumber = 1;
    110   1.1.1.6  christos         Gbl_LogicalLineNumber = 1;
    111   1.1.1.6  christos 
    112   1.1.1.3  christos         if (Gbl_PreprocessOnly)
    113   1.1.1.3  christos         {
    114   1.1.1.3  christos             UtEndEvent (Event);
    115   1.1.1.3  christos             CmCleanupAndExit ();
    116   1.1.1.3  christos             return (0);
    117   1.1.1.3  christos         }
    118   1.1.1.3  christos     }
    119   1.1.1.3  christos     UtEndEvent (Event);
    120   1.1.1.3  christos 
    121   1.1.1.6  christos 
    122       1.1    jruoho     /* Build the parse tree */
    123       1.1    jruoho 
    124       1.1    jruoho     Event = UtBeginEvent ("Parse source code and build parse tree");
    125       1.1    jruoho     AslCompilerparse();
    126       1.1    jruoho     UtEndEvent (Event);
    127       1.1    jruoho 
    128   1.1.1.5  christos     /* Check for parser-detected syntax errors */
    129       1.1    jruoho 
    130   1.1.1.5  christos     if (Gbl_SyntaxError)
    131   1.1.1.3  christos     {
    132   1.1.1.7  christos         fprintf (stderr,
    133   1.1.1.7  christos             "Compiler aborting due to parser-detected syntax error(s)\n");
    134   1.1.1.3  christos         LsDumpParseTree ();
    135   1.1.1.3  christos         goto ErrorExit;
    136   1.1.1.3  christos     }
    137       1.1    jruoho 
    138       1.1    jruoho     /* Did the parse tree get successfully constructed? */
    139       1.1    jruoho 
    140   1.1.1.8  christos     if (!Gbl_ParseTreeRoot)
    141       1.1    jruoho     {
    142   1.1.1.3  christos         /*
    143   1.1.1.3  christos          * If there are no errors, then we have some sort of
    144   1.1.1.3  christos          * internal problem.
    145   1.1.1.3  christos          */
    146   1.1.1.3  christos         AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL,
    147   1.1.1.3  christos             NULL, "- Could not resolve parse tree root node");
    148   1.1.1.3  christos 
    149   1.1.1.3  christos         goto ErrorExit;
    150       1.1    jruoho     }
    151       1.1    jruoho 
    152   1.1.1.3  christos     /* Flush out any remaining source after parse tree is complete */
    153   1.1.1.3  christos 
    154   1.1.1.3  christos     Event = UtBeginEvent ("Flush source input");
    155   1.1.1.3  christos     CmFlushSourceCode ();
    156   1.1.1.3  christos 
    157   1.1.1.5  christos     /* Prune the parse tree if requested (debug purposes only) */
    158   1.1.1.5  christos 
    159   1.1.1.5  christos     if (Gbl_PruneParseTree)
    160   1.1.1.5  christos     {
    161   1.1.1.5  christos         AslPruneParseTree (Gbl_PruneDepth, Gbl_PruneType);
    162   1.1.1.5  christos     }
    163   1.1.1.5  christos 
    164       1.1    jruoho     /* Optional parse tree dump, compiler debug output only */
    165       1.1    jruoho 
    166       1.1    jruoho     LsDumpParseTree ();
    167       1.1    jruoho 
    168   1.1.1.8  christos     OpcGetIntegerWidth (Gbl_ParseTreeRoot->Asl.Child);
    169       1.1    jruoho     UtEndEvent (Event);
    170       1.1    jruoho 
    171       1.1    jruoho     /* Pre-process parse tree for any operator transforms */
    172       1.1    jruoho 
    173       1.1    jruoho     Event = UtBeginEvent ("Parse tree transforms");
    174       1.1    jruoho     DbgPrint (ASL_DEBUG_OUTPUT, "\nParse tree transforms\n\n");
    175   1.1.1.8  christos     TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_TWICE,
    176   1.1.1.8  christos         TrAmlTransformWalkBegin, TrAmlTransformWalkEnd, NULL);
    177       1.1    jruoho     UtEndEvent (Event);
    178       1.1    jruoho 
    179       1.1    jruoho     /* Generate AML opcodes corresponding to the parse tokens */
    180       1.1    jruoho 
    181       1.1    jruoho     Event = UtBeginEvent ("Generate AML opcodes");
    182   1.1.1.8  christos     DbgPrint (ASL_DEBUG_OUTPUT, "Generating AML opcodes\n\n");
    183   1.1.1.8  christos     TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, NULL,
    184       1.1    jruoho         OpcAmlOpcodeWalk, NULL);
    185       1.1    jruoho     UtEndEvent (Event);
    186       1.1    jruoho 
    187       1.1    jruoho     /*
    188       1.1    jruoho      * Now that the input is parsed, we can open the AML output file.
    189   1.1.1.7  christos      * Note: by default, the name of this file comes from the table
    190   1.1.1.7  christos      * descriptor within the input file.
    191       1.1    jruoho      */
    192       1.1    jruoho     Event = UtBeginEvent ("Open AML output file");
    193       1.1    jruoho     Status = FlOpenAmlOutputFile (Gbl_OutputFilenamePrefix);
    194   1.1.1.3  christos     UtEndEvent (Event);
    195       1.1    jruoho     if (ACPI_FAILURE (Status))
    196       1.1    jruoho     {
    197       1.1    jruoho         AePrintErrorLog (ASL_FILE_STDERR);
    198   1.1.1.3  christos         return (-1);
    199       1.1    jruoho     }
    200       1.1    jruoho 
    201       1.1    jruoho     /* Interpret and generate all compile-time constants */
    202       1.1    jruoho 
    203       1.1    jruoho     Event = UtBeginEvent ("Constant folding via AML interpreter");
    204       1.1    jruoho     DbgPrint (ASL_DEBUG_OUTPUT,
    205   1.1.1.8  christos         "Interpreting compile-time constant expressions\n\n");
    206   1.1.1.5  christos 
    207   1.1.1.5  christos     if (Gbl_FoldConstants)
    208   1.1.1.5  christos     {
    209   1.1.1.8  christos         TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD,
    210   1.1.1.8  christos             NULL, OpcAmlConstantWalk, NULL);
    211   1.1.1.5  christos     }
    212   1.1.1.5  christos     else
    213   1.1.1.5  christos     {
    214   1.1.1.5  christos         DbgPrint (ASL_PARSE_OUTPUT, "    Optional folding disabled\n");
    215   1.1.1.5  christos     }
    216       1.1    jruoho     UtEndEvent (Event);
    217       1.1    jruoho 
    218       1.1    jruoho     /* Update AML opcodes if necessary, after constant folding */
    219       1.1    jruoho 
    220       1.1    jruoho     Event = UtBeginEvent ("Updating AML opcodes after constant folding");
    221       1.1    jruoho     DbgPrint (ASL_DEBUG_OUTPUT,
    222   1.1.1.8  christos         "Updating AML opcodes after constant folding\n\n");
    223   1.1.1.8  christos     TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD,
    224       1.1    jruoho         NULL, OpcAmlOpcodeUpdateWalk, NULL);
    225       1.1    jruoho     UtEndEvent (Event);
    226       1.1    jruoho 
    227       1.1    jruoho     /* Calculate all AML package lengths */
    228       1.1    jruoho 
    229       1.1    jruoho     Event = UtBeginEvent ("Generate AML package lengths");
    230   1.1.1.8  christos     DbgPrint (ASL_DEBUG_OUTPUT, "Generating Package lengths\n\n");
    231   1.1.1.8  christos     TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, NULL,
    232       1.1    jruoho         LnPackageLengthWalk, NULL);
    233       1.1    jruoho     UtEndEvent (Event);
    234       1.1    jruoho 
    235       1.1    jruoho     if (Gbl_ParseOnlyFlag)
    236       1.1    jruoho     {
    237   1.1.1.3  christos         AePrintErrorLog (ASL_FILE_STDERR);
    238   1.1.1.3  christos         UtDisplaySummary (ASL_FILE_STDERR);
    239       1.1    jruoho         if (Gbl_DebugFlag)
    240       1.1    jruoho         {
    241   1.1.1.3  christos             /* Print error summary to the stdout also */
    242       1.1    jruoho 
    243   1.1.1.3  christos             AePrintErrorLog (ASL_FILE_STDOUT);
    244   1.1.1.3  christos             UtDisplaySummary (ASL_FILE_STDOUT);
    245       1.1    jruoho         }
    246   1.1.1.3  christos         UtEndEvent (FullCompile);
    247   1.1.1.3  christos         return (0);
    248       1.1    jruoho     }
    249       1.1    jruoho 
    250       1.1    jruoho     /*
    251       1.1    jruoho      * Create an internal namespace and use it as a symbol table
    252       1.1    jruoho      */
    253       1.1    jruoho 
    254       1.1    jruoho     /* Namespace loading */
    255       1.1    jruoho 
    256       1.1    jruoho     Event = UtBeginEvent ("Create ACPI Namespace");
    257   1.1.1.8  christos     DbgPrint (ASL_DEBUG_OUTPUT, "Creating ACPI Namespace\n\n");
    258   1.1.1.8  christos     Status = LdLoadNamespace (Gbl_ParseTreeRoot);
    259       1.1    jruoho     UtEndEvent (Event);
    260       1.1    jruoho     if (ACPI_FAILURE (Status))
    261       1.1    jruoho     {
    262   1.1.1.3  christos         goto ErrorExit;
    263       1.1    jruoho     }
    264       1.1    jruoho 
    265       1.1    jruoho     /* Namespace cross-reference */
    266       1.1    jruoho 
    267   1.1.1.7  christos     AslGbl_NamespaceEvent = UtBeginEvent (
    268   1.1.1.7  christos         "Cross reference parse tree and Namespace");
    269   1.1.1.8  christos     DbgPrint (ASL_DEBUG_OUTPUT, "Cross referencing namespace\n\n");
    270   1.1.1.3  christos     Status = XfCrossReferenceNamespace ();
    271       1.1    jruoho     if (ACPI_FAILURE (Status))
    272       1.1    jruoho     {
    273   1.1.1.3  christos         goto ErrorExit;
    274       1.1    jruoho     }
    275       1.1    jruoho 
    276       1.1    jruoho     /* Namespace - Check for non-referenced objects */
    277       1.1    jruoho 
    278       1.1    jruoho     LkFindUnreferencedObjects ();
    279       1.1    jruoho     UtEndEvent (AslGbl_NamespaceEvent);
    280       1.1    jruoho 
    281   1.1.1.8  christos     /* Resolve External Declarations */
    282   1.1.1.8  christos 
    283   1.1.1.8  christos     if (Gbl_DoExternals)
    284   1.1.1.8  christos     {
    285   1.1.1.8  christos         Event = UtBeginEvent ("Resolve all Externals");
    286   1.1.1.8  christos         DbgPrint (ASL_DEBUG_OUTPUT, "\nResolve Externals\n\n");
    287  1.1.1.10  christos 
    288  1.1.1.10  christos         if (Gbl_DoExternalsInPlace)
    289  1.1.1.10  christos         {
    290  1.1.1.10  christos             TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD,
    291  1.1.1.10  christos                 ExAmlExternalWalkBegin, NULL, NULL);
    292  1.1.1.10  christos         }
    293  1.1.1.10  christos         else
    294  1.1.1.10  christos         {
    295  1.1.1.10  christos             TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_TWICE,
    296  1.1.1.10  christos                 ExAmlExternalWalkBegin, ExAmlExternalWalkEnd, NULL);
    297  1.1.1.10  christos         }
    298   1.1.1.8  christos         UtEndEvent (Event);
    299   1.1.1.8  christos     }
    300   1.1.1.8  christos 
    301       1.1    jruoho     /*
    302   1.1.1.3  christos      * Semantic analysis. This can happen only after the
    303       1.1    jruoho      * namespace has been loaded and cross-referenced.
    304       1.1    jruoho      *
    305       1.1    jruoho      * part one - check control methods
    306       1.1    jruoho      */
    307       1.1    jruoho     Event = UtBeginEvent ("Analyze control method return types");
    308       1.1    jruoho     AnalysisWalkInfo.MethodStack = NULL;
    309       1.1    jruoho 
    310   1.1.1.8  christos     DbgPrint (ASL_DEBUG_OUTPUT, "Semantic analysis - Method analysis\n\n");
    311   1.1.1.8  christos 
    312   1.1.1.8  christos     if (Gbl_CrossReferenceOutput)
    313   1.1.1.8  christos     {
    314   1.1.1.8  christos         OtPrintHeaders ("Part 1: Object Reference Map "
    315   1.1.1.8  christos             "(Object references from within each control method)");
    316   1.1.1.8  christos     }
    317   1.1.1.8  christos 
    318   1.1.1.8  christos     TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_TWICE,
    319   1.1.1.3  christos         MtMethodAnalysisWalkBegin,
    320   1.1.1.3  christos         MtMethodAnalysisWalkEnd, &AnalysisWalkInfo);
    321       1.1    jruoho     UtEndEvent (Event);
    322       1.1    jruoho 
    323   1.1.1.8  christos     /* Generate the object cross-reference file if requested */
    324   1.1.1.8  christos 
    325   1.1.1.8  christos     Event = UtBeginEvent ("Generate cross-reference file");
    326   1.1.1.8  christos     OtCreateXrefFile ();
    327   1.1.1.8  christos     UtEndEvent (Event);
    328   1.1.1.8  christos 
    329       1.1    jruoho     /* Semantic error checking part two - typing of method returns */
    330       1.1    jruoho 
    331       1.1    jruoho     Event = UtBeginEvent ("Determine object types returned by methods");
    332   1.1.1.8  christos     DbgPrint (ASL_DEBUG_OUTPUT, "Semantic analysis - Method typing\n\n");
    333   1.1.1.8  christos     TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD,
    334   1.1.1.2    jruoho         NULL, AnMethodTypingWalkEnd, NULL);
    335       1.1    jruoho     UtEndEvent (Event);
    336       1.1    jruoho 
    337       1.1    jruoho     /* Semantic error checking part three - operand type checking */
    338       1.1    jruoho 
    339       1.1    jruoho     Event = UtBeginEvent ("Analyze AML operand types");
    340   1.1.1.7  christos     DbgPrint (ASL_DEBUG_OUTPUT,
    341   1.1.1.8  christos         "Semantic analysis - Operand type checking\n\n");
    342   1.1.1.7  christos     if (Gbl_DoTypechecking)
    343   1.1.1.7  christos     {
    344   1.1.1.8  christos         TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD,
    345   1.1.1.7  christos             NULL, AnOperandTypecheckWalkEnd, &AnalysisWalkInfo);
    346   1.1.1.7  christos     }
    347       1.1    jruoho     UtEndEvent (Event);
    348       1.1    jruoho 
    349       1.1    jruoho     /* Semantic error checking part four - other miscellaneous checks */
    350       1.1    jruoho 
    351       1.1    jruoho     Event = UtBeginEvent ("Miscellaneous analysis");
    352   1.1.1.8  christos     DbgPrint (ASL_DEBUG_OUTPUT, "Semantic analysis - miscellaneous\n\n");
    353   1.1.1.8  christos     TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD,
    354       1.1    jruoho         AnOtherSemanticAnalysisWalkBegin,
    355   1.1.1.2    jruoho         NULL, &AnalysisWalkInfo);
    356       1.1    jruoho     UtEndEvent (Event);
    357       1.1    jruoho 
    358  1.1.1.10  christos     /*
    359  1.1.1.10  christos      * ASL-/ASL+ converter: Gbl_ParseTreeRoot->CommentList contains the
    360  1.1.1.10  christos      * very last comment of a given ASL file because it's the last constructed
    361  1.1.1.10  christos      * node during compilation. We take the very last comment and save it in a
    362  1.1.1.10  christos      * global for it to be used by the disassembler.
    363  1.1.1.10  christos      */
    364  1.1.1.10  christos     if (Gbl_CaptureComments)
    365  1.1.1.10  christos     {
    366  1.1.1.10  christos         AcpiGbl_LastListHead = Gbl_ParseTreeRoot->Asl.CommentList;
    367  1.1.1.10  christos         Gbl_ParseTreeRoot->Asl.CommentList = NULL;
    368  1.1.1.10  christos     }
    369  1.1.1.10  christos 
    370       1.1    jruoho     /* Calculate all AML package lengths */
    371       1.1    jruoho 
    372       1.1    jruoho     Event = UtBeginEvent ("Finish AML package length generation");
    373   1.1.1.8  christos     DbgPrint (ASL_DEBUG_OUTPUT, "Generating Package lengths\n\n");
    374   1.1.1.8  christos     TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, NULL,
    375       1.1    jruoho         LnInitLengthsWalk, NULL);
    376   1.1.1.8  christos     TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, NULL,
    377       1.1    jruoho         LnPackageLengthWalk, NULL);
    378       1.1    jruoho     UtEndEvent (Event);
    379       1.1    jruoho 
    380       1.1    jruoho     /* Code generation - emit the AML */
    381       1.1    jruoho 
    382       1.1    jruoho     Event = UtBeginEvent ("Generate AML code and write output files");
    383   1.1.1.8  christos     DbgPrint (ASL_DEBUG_OUTPUT, "Writing AML byte code\n\n");
    384       1.1    jruoho     CgGenerateAmlOutput ();
    385       1.1    jruoho     UtEndEvent (Event);
    386       1.1    jruoho 
    387       1.1    jruoho     Event = UtBeginEvent ("Write optional output files");
    388       1.1    jruoho     CmDoOutputFiles ();
    389       1.1    jruoho     UtEndEvent (Event);
    390       1.1    jruoho 
    391       1.1    jruoho     UtEndEvent (FullCompile);
    392       1.1    jruoho     CmCleanupAndExit ();
    393   1.1.1.3  christos     return (0);
    394   1.1.1.3  christos 
    395   1.1.1.3  christos ErrorExit:
    396   1.1.1.3  christos     UtEndEvent (FullCompile);
    397   1.1.1.3  christos     CmCleanupAndExit ();
    398   1.1.1.3  christos     return (-1);
    399       1.1    jruoho }
    400       1.1    jruoho 
    401       1.1    jruoho 
    402       1.1    jruoho /*******************************************************************************
    403       1.1    jruoho  *
    404   1.1.1.4  christos  * FUNCTION:    AslCompilerSignon
    405   1.1.1.4  christos  *
    406   1.1.1.4  christos  * PARAMETERS:  FileId      - ID of the output file
    407   1.1.1.4  christos  *
    408   1.1.1.4  christos  * RETURN:      None
    409   1.1.1.4  christos  *
    410   1.1.1.4  christos  * DESCRIPTION: Display compiler signon
    411   1.1.1.4  christos  *
    412   1.1.1.4  christos  ******************************************************************************/
    413   1.1.1.4  christos 
    414   1.1.1.4  christos void
    415   1.1.1.4  christos AslCompilerSignon (
    416   1.1.1.4  christos     UINT32                  FileId)
    417   1.1.1.4  christos {
    418   1.1.1.4  christos     char                    *Prefix = "";
    419   1.1.1.4  christos     char                    *UtilityName;
    420   1.1.1.4  christos 
    421   1.1.1.4  christos 
    422   1.1.1.4  christos     /* Set line prefix depending on the destination file type */
    423   1.1.1.4  christos 
    424   1.1.1.4  christos     switch (FileId)
    425   1.1.1.4  christos     {
    426   1.1.1.4  christos     case ASL_FILE_ASM_SOURCE_OUTPUT:
    427   1.1.1.4  christos     case ASL_FILE_ASM_INCLUDE_OUTPUT:
    428   1.1.1.4  christos 
    429   1.1.1.4  christos         Prefix = "; ";
    430   1.1.1.4  christos         break;
    431   1.1.1.4  christos 
    432   1.1.1.4  christos     case ASL_FILE_HEX_OUTPUT:
    433   1.1.1.4  christos 
    434   1.1.1.4  christos         if (Gbl_HexOutputFlag == HEX_OUTPUT_ASM)
    435   1.1.1.4  christos         {
    436   1.1.1.4  christos             Prefix = "; ";
    437   1.1.1.4  christos         }
    438   1.1.1.4  christos         else if ((Gbl_HexOutputFlag == HEX_OUTPUT_C) ||
    439   1.1.1.4  christos                  (Gbl_HexOutputFlag == HEX_OUTPUT_ASL))
    440   1.1.1.4  christos         {
    441   1.1.1.4  christos             FlPrintFile (ASL_FILE_HEX_OUTPUT, "/*\n");
    442   1.1.1.4  christos             Prefix = " * ";
    443   1.1.1.4  christos         }
    444   1.1.1.4  christos         break;
    445   1.1.1.4  christos 
    446   1.1.1.4  christos     case ASL_FILE_C_SOURCE_OUTPUT:
    447   1.1.1.4  christos     case ASL_FILE_C_OFFSET_OUTPUT:
    448   1.1.1.4  christos     case ASL_FILE_C_INCLUDE_OUTPUT:
    449   1.1.1.4  christos 
    450   1.1.1.4  christos         Prefix = " * ";
    451   1.1.1.4  christos         break;
    452   1.1.1.4  christos 
    453   1.1.1.4  christos     default:
    454   1.1.1.4  christos 
    455   1.1.1.4  christos         /* No other output types supported */
    456   1.1.1.4  christos 
    457   1.1.1.4  christos         break;
    458   1.1.1.4  christos     }
    459   1.1.1.4  christos 
    460   1.1.1.4  christos     /* Running compiler or disassembler? */
    461   1.1.1.4  christos 
    462  1.1.1.11  christos     if (AcpiGbl_DisasmFlag)
    463   1.1.1.4  christos     {
    464   1.1.1.4  christos         UtilityName = AML_DISASSEMBLER_NAME;
    465   1.1.1.4  christos     }
    466   1.1.1.4  christos     else
    467   1.1.1.4  christos     {
    468   1.1.1.4  christos         UtilityName = ASL_COMPILER_NAME;
    469   1.1.1.4  christos     }
    470   1.1.1.4  christos 
    471   1.1.1.4  christos     /* Compiler signon with copyright */
    472   1.1.1.4  christos 
    473   1.1.1.4  christos     FlPrintFile (FileId, "%s\n", Prefix);
    474   1.1.1.4  christos     FlPrintFile (FileId, ACPI_COMMON_HEADER (UtilityName, Prefix));
    475   1.1.1.4  christos }
    476   1.1.1.4  christos 
    477   1.1.1.4  christos 
    478   1.1.1.4  christos /*******************************************************************************
    479   1.1.1.4  christos  *
    480   1.1.1.4  christos  * FUNCTION:    AslCompilerFileHeader
    481   1.1.1.4  christos  *
    482   1.1.1.4  christos  * PARAMETERS:  FileId      - ID of the output file
    483   1.1.1.4  christos  *
    484   1.1.1.4  christos  * RETURN:      None
    485   1.1.1.4  christos  *
    486   1.1.1.4  christos  * DESCRIPTION: Header used at the beginning of output files
    487   1.1.1.4  christos  *
    488   1.1.1.4  christos  ******************************************************************************/
    489   1.1.1.4  christos 
    490   1.1.1.4  christos void
    491   1.1.1.4  christos AslCompilerFileHeader (
    492   1.1.1.4  christos     UINT32                  FileId)
    493   1.1.1.4  christos {
    494   1.1.1.4  christos     struct tm               *NewTime;
    495   1.1.1.4  christos     time_t                  Aclock;
    496   1.1.1.4  christos     char                    *Prefix = "";
    497   1.1.1.4  christos 
    498   1.1.1.4  christos 
    499   1.1.1.4  christos     /* Set line prefix depending on the destination file type */
    500   1.1.1.4  christos 
    501   1.1.1.4  christos     switch (FileId)
    502   1.1.1.4  christos     {
    503   1.1.1.4  christos     case ASL_FILE_ASM_SOURCE_OUTPUT:
    504   1.1.1.4  christos     case ASL_FILE_ASM_INCLUDE_OUTPUT:
    505   1.1.1.4  christos 
    506   1.1.1.4  christos         Prefix = "; ";
    507   1.1.1.4  christos         break;
    508   1.1.1.4  christos 
    509   1.1.1.4  christos     case ASL_FILE_HEX_OUTPUT:
    510   1.1.1.4  christos 
    511   1.1.1.4  christos         if (Gbl_HexOutputFlag == HEX_OUTPUT_ASM)
    512   1.1.1.4  christos         {
    513   1.1.1.4  christos             Prefix = "; ";
    514   1.1.1.4  christos         }
    515   1.1.1.4  christos         else if ((Gbl_HexOutputFlag == HEX_OUTPUT_C) ||
    516   1.1.1.4  christos                  (Gbl_HexOutputFlag == HEX_OUTPUT_ASL))
    517   1.1.1.4  christos         {
    518   1.1.1.4  christos             Prefix = " * ";
    519   1.1.1.4  christos         }
    520   1.1.1.4  christos         break;
    521   1.1.1.4  christos 
    522   1.1.1.4  christos     case ASL_FILE_C_SOURCE_OUTPUT:
    523   1.1.1.4  christos     case ASL_FILE_C_OFFSET_OUTPUT:
    524   1.1.1.4  christos     case ASL_FILE_C_INCLUDE_OUTPUT:
    525   1.1.1.4  christos 
    526   1.1.1.4  christos         Prefix = " * ";
    527   1.1.1.4  christos         break;
    528   1.1.1.4  christos 
    529   1.1.1.4  christos     default:
    530   1.1.1.4  christos 
    531   1.1.1.4  christos         /* No other output types supported */
    532   1.1.1.4  christos 
    533   1.1.1.4  christos         break;
    534   1.1.1.4  christos     }
    535   1.1.1.4  christos 
    536   1.1.1.4  christos     /* Compilation header with timestamp */
    537   1.1.1.4  christos 
    538   1.1.1.4  christos     (void) time (&Aclock);
    539   1.1.1.4  christos     NewTime = localtime (&Aclock);
    540   1.1.1.4  christos 
    541   1.1.1.4  christos     FlPrintFile (FileId,
    542   1.1.1.4  christos         "%sCompilation of \"%s\" - %s%s\n",
    543   1.1.1.4  christos         Prefix, Gbl_Files[ASL_FILE_INPUT].Filename, asctime (NewTime),
    544   1.1.1.4  christos         Prefix);
    545   1.1.1.4  christos 
    546   1.1.1.4  christos     switch (FileId)
    547   1.1.1.4  christos     {
    548   1.1.1.4  christos     case ASL_FILE_C_SOURCE_OUTPUT:
    549   1.1.1.4  christos     case ASL_FILE_C_OFFSET_OUTPUT:
    550   1.1.1.4  christos     case ASL_FILE_C_INCLUDE_OUTPUT:
    551   1.1.1.4  christos 
    552   1.1.1.4  christos         FlPrintFile (FileId, " */\n");
    553   1.1.1.4  christos         break;
    554   1.1.1.4  christos 
    555   1.1.1.4  christos     default:
    556   1.1.1.4  christos 
    557   1.1.1.4  christos         /* Nothing to do for other output types */
    558   1.1.1.4  christos 
    559   1.1.1.4  christos         break;
    560   1.1.1.4  christos     }
    561   1.1.1.4  christos }
    562   1.1.1.4  christos 
    563   1.1.1.4  christos 
    564   1.1.1.4  christos /*******************************************************************************
    565   1.1.1.4  christos  *
    566   1.1.1.4  christos  * FUNCTION:    CmFlushSourceCode
    567   1.1.1.4  christos  *
    568   1.1.1.4  christos  * PARAMETERS:  None
    569   1.1.1.4  christos  *
    570   1.1.1.4  christos  * RETURN:      None
    571   1.1.1.4  christos  *
    572   1.1.1.4  christos  * DESCRIPTION: Read in any remaining source code after the parse tree
    573   1.1.1.4  christos  *              has been constructed.
    574   1.1.1.4  christos  *
    575   1.1.1.4  christos  ******************************************************************************/
    576   1.1.1.4  christos 
    577   1.1.1.4  christos static void
    578   1.1.1.4  christos CmFlushSourceCode (
    579   1.1.1.4  christos     void)
    580   1.1.1.4  christos {
    581   1.1.1.4  christos     char                    Buffer;
    582   1.1.1.4  christos 
    583   1.1.1.4  christos 
    584   1.1.1.4  christos     while (FlReadFile (ASL_FILE_INPUT, &Buffer, 1) != AE_ERROR)
    585   1.1.1.4  christos     {
    586   1.1.1.4  christos         AslInsertLineBuffer ((int) Buffer);
    587   1.1.1.4  christos     }
    588   1.1.1.4  christos 
    589   1.1.1.4  christos     AslResetCurrentLineBuffer ();
    590   1.1.1.4  christos }
    591   1.1.1.4  christos 
    592   1.1.1.4  christos 
    593   1.1.1.4  christos /*******************************************************************************
    594   1.1.1.4  christos  *
    595       1.1    jruoho  * FUNCTION:    CmDoOutputFiles
    596       1.1    jruoho  *
    597       1.1    jruoho  * PARAMETERS:  None
    598       1.1    jruoho  *
    599       1.1    jruoho  * RETURN:      None.
    600       1.1    jruoho  *
    601       1.1    jruoho  * DESCRIPTION: Create all "listing" type files
    602       1.1    jruoho  *
    603       1.1    jruoho  ******************************************************************************/
    604       1.1    jruoho 
    605       1.1    jruoho void
    606       1.1    jruoho CmDoOutputFiles (
    607       1.1    jruoho     void)
    608       1.1    jruoho {
    609       1.1    jruoho 
    610       1.1    jruoho     /* Create listings and hex files */
    611       1.1    jruoho 
    612       1.1    jruoho     LsDoListings ();
    613   1.1.1.3  christos     HxDoHexOutput ();
    614       1.1    jruoho 
    615       1.1    jruoho     /* Dump the namespace to the .nsp file if requested */
    616       1.1    jruoho 
    617   1.1.1.3  christos     (void) NsDisplayNamespace ();
    618   1.1.1.4  christos 
    619   1.1.1.4  christos     /* Dump the device mapping file */
    620   1.1.1.4  christos 
    621   1.1.1.4  christos     MpEmitMappingInfo ();
    622       1.1    jruoho }
    623       1.1    jruoho 
    624       1.1    jruoho 
    625       1.1    jruoho /*******************************************************************************
    626       1.1    jruoho  *
    627   1.1.1.3  christos  * FUNCTION:    CmDumpAllEvents
    628       1.1    jruoho  *
    629   1.1.1.3  christos  * PARAMETERS:  None
    630       1.1    jruoho  *
    631       1.1    jruoho  * RETURN:      None.
    632       1.1    jruoho  *
    633   1.1.1.3  christos  * DESCRIPTION: Dump all compiler events
    634       1.1    jruoho  *
    635       1.1    jruoho  ******************************************************************************/
    636       1.1    jruoho 
    637       1.1    jruoho static void
    638   1.1.1.3  christos CmDumpAllEvents (
    639   1.1.1.3  christos     void)
    640       1.1    jruoho {
    641   1.1.1.3  christos     ASL_EVENT_INFO          *Event;
    642       1.1    jruoho     UINT32                  Delta;
    643   1.1.1.7  christos     UINT32                  MicroSeconds;
    644   1.1.1.7  christos     UINT32                  MilliSeconds;
    645   1.1.1.3  christos     UINT32                  i;
    646   1.1.1.3  christos 
    647       1.1    jruoho 
    648   1.1.1.3  christos     Event = AslGbl_Events;
    649   1.1.1.3  christos 
    650   1.1.1.3  christos     DbgPrint (ASL_DEBUG_OUTPUT, "\n\nElapsed time for major events\n\n");
    651   1.1.1.3  christos     if (Gbl_CompileTimesFlag)
    652       1.1    jruoho     {
    653   1.1.1.3  christos         printf ("\nElapsed time for major events\n\n");
    654       1.1    jruoho     }
    655       1.1    jruoho 
    656   1.1.1.3  christos     for (i = 0; i < AslGbl_NextEvent; i++)
    657   1.1.1.3  christos     {
    658   1.1.1.3  christos         if (Event->Valid)
    659   1.1.1.3  christos         {
    660   1.1.1.3  christos             /* Delta will be in 100-nanosecond units */
    661       1.1    jruoho 
    662   1.1.1.3  christos             Delta = (UINT32) (Event->EndTime - Event->StartTime);
    663       1.1    jruoho 
    664   1.1.1.7  christos             MicroSeconds = Delta / ACPI_100NSEC_PER_USEC;
    665   1.1.1.7  christos             MilliSeconds = Delta / ACPI_100NSEC_PER_MSEC;
    666       1.1    jruoho 
    667   1.1.1.3  christos             /* Round milliseconds up */
    668       1.1    jruoho 
    669   1.1.1.7  christos             if ((MicroSeconds - (MilliSeconds * ACPI_USEC_PER_MSEC)) >= 500)
    670   1.1.1.3  christos             {
    671   1.1.1.7  christos                 MilliSeconds++;
    672   1.1.1.3  christos             }
    673   1.1.1.3  christos 
    674   1.1.1.3  christos             DbgPrint (ASL_DEBUG_OUTPUT, "%8u usec %8u msec - %s\n",
    675   1.1.1.7  christos                 MicroSeconds, MilliSeconds, Event->EventName);
    676   1.1.1.3  christos 
    677   1.1.1.3  christos             if (Gbl_CompileTimesFlag)
    678   1.1.1.3  christos             {
    679   1.1.1.3  christos                 printf ("%8u usec %8u msec - %s\n",
    680   1.1.1.7  christos                     MicroSeconds, MilliSeconds, Event->EventName);
    681   1.1.1.3  christos             }
    682   1.1.1.3  christos         }
    683       1.1    jruoho 
    684   1.1.1.3  christos         Event++;
    685   1.1.1.3  christos     }
    686       1.1    jruoho }
    687       1.1    jruoho 
    688       1.1    jruoho 
    689       1.1    jruoho /*******************************************************************************
    690       1.1    jruoho  *
    691       1.1    jruoho  * FUNCTION:    CmCleanupAndExit
    692       1.1    jruoho  *
    693       1.1    jruoho  * PARAMETERS:  None
    694       1.1    jruoho  *
    695       1.1    jruoho  * RETURN:      None.
    696       1.1    jruoho  *
    697       1.1    jruoho  * DESCRIPTION: Close all open files and exit the compiler
    698       1.1    jruoho  *
    699       1.1    jruoho  ******************************************************************************/
    700       1.1    jruoho 
    701       1.1    jruoho void
    702       1.1    jruoho CmCleanupAndExit (
    703       1.1    jruoho     void)
    704       1.1    jruoho {
    705       1.1    jruoho     UINT32                  i;
    706   1.1.1.3  christos     BOOLEAN                 DeleteAmlFile = FALSE;
    707       1.1    jruoho 
    708       1.1    jruoho 
    709  1.1.1.11  christos     AslCheckExpectedExceptions ();
    710   1.1.1.3  christos     AePrintErrorLog (ASL_FILE_STDERR);
    711       1.1    jruoho     if (Gbl_DebugFlag)
    712       1.1    jruoho     {
    713   1.1.1.3  christos         /* Print error summary to stdout also */
    714       1.1    jruoho 
    715   1.1.1.3  christos         AePrintErrorLog (ASL_FILE_STDOUT);
    716       1.1    jruoho     }
    717       1.1    jruoho 
    718   1.1.1.3  christos     /* Emit compile times if enabled */
    719   1.1.1.3  christos 
    720   1.1.1.3  christos     CmDumpAllEvents ();
    721       1.1    jruoho 
    722       1.1    jruoho     if (Gbl_CompileTimesFlag)
    723       1.1    jruoho     {
    724       1.1    jruoho         printf ("\nMiscellaneous compile statistics\n\n");
    725       1.1    jruoho         printf ("%11u : %s\n", TotalParseNodes, "Parse nodes");
    726       1.1    jruoho         printf ("%11u : %s\n", Gbl_NsLookupCount, "Namespace searches");
    727       1.1    jruoho         printf ("%11u : %s\n", TotalNamedObjects, "Named objects");
    728       1.1    jruoho         printf ("%11u : %s\n", TotalMethods, "Control methods");
    729       1.1    jruoho         printf ("%11u : %s\n", TotalAllocations, "Memory Allocations");
    730       1.1    jruoho         printf ("%11u : %s\n", TotalAllocated, "Total allocated memory");
    731       1.1    jruoho         printf ("%11u : %s\n", TotalFolds, "Constant subtrees folded");
    732       1.1    jruoho         printf ("\n");
    733       1.1    jruoho     }
    734       1.1    jruoho 
    735       1.1    jruoho     if (Gbl_NsLookupCount)
    736       1.1    jruoho     {
    737       1.1    jruoho         DbgPrint (ASL_DEBUG_OUTPUT,
    738       1.1    jruoho             "\n\nMiscellaneous compile statistics\n\n");
    739       1.1    jruoho 
    740       1.1    jruoho         DbgPrint (ASL_DEBUG_OUTPUT,
    741       1.1    jruoho             "%32s : %u\n", "Total Namespace searches",
    742       1.1    jruoho             Gbl_NsLookupCount);
    743       1.1    jruoho 
    744       1.1    jruoho         DbgPrint (ASL_DEBUG_OUTPUT,
    745       1.1    jruoho             "%32s : %u usec\n", "Time per search", ((UINT32)
    746       1.1    jruoho             (AslGbl_Events[AslGbl_NamespaceEvent].EndTime -
    747       1.1    jruoho                 AslGbl_Events[AslGbl_NamespaceEvent].StartTime) / 10) /
    748       1.1    jruoho                 Gbl_NsLookupCount);
    749       1.1    jruoho     }
    750       1.1    jruoho 
    751       1.1    jruoho     if (Gbl_ExceptionCount[ASL_ERROR] > ASL_MAX_ERROR_COUNT)
    752       1.1    jruoho     {
    753       1.1    jruoho         printf ("\nMaximum error count (%u) exceeded\n",
    754       1.1    jruoho             ASL_MAX_ERROR_COUNT);
    755       1.1    jruoho     }
    756       1.1    jruoho 
    757       1.1    jruoho     UtDisplaySummary (ASL_FILE_STDOUT);
    758       1.1    jruoho 
    759   1.1.1.3  christos     /*
    760   1.1.1.3  christos      * We will delete the AML file if there are errors and the
    761   1.1.1.3  christos      * force AML output option has not been used.
    762   1.1.1.3  christos      */
    763   1.1.1.4  christos     if ((Gbl_ExceptionCount[ASL_ERROR] > 0) &&
    764   1.1.1.4  christos         (!Gbl_IgnoreErrors) &&
    765   1.1.1.3  christos         Gbl_Files[ASL_FILE_AML_OUTPUT].Handle)
    766   1.1.1.3  christos     {
    767   1.1.1.3  christos         DeleteAmlFile = TRUE;
    768   1.1.1.3  christos     }
    769   1.1.1.3  christos 
    770       1.1    jruoho     /* Close all open files */
    771       1.1    jruoho 
    772   1.1.1.3  christos     /*
    773   1.1.1.6  christos      * Take care with the preprocessor file (.pre), it might be the same
    774   1.1.1.3  christos      * as the "input" file, depending on where the compiler has terminated
    775   1.1.1.3  christos      * or aborted. Prevent attempt to close the same file twice in
    776   1.1.1.3  christos      * loop below.
    777   1.1.1.3  christos      */
    778   1.1.1.3  christos     if (Gbl_Files[ASL_FILE_PREPROCESSOR].Handle ==
    779   1.1.1.3  christos         Gbl_Files[ASL_FILE_INPUT].Handle)
    780   1.1.1.3  christos     {
    781   1.1.1.3  christos         Gbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL;
    782   1.1.1.3  christos     }
    783   1.1.1.3  christos 
    784   1.1.1.3  christos     /* Close the standard I/O files */
    785   1.1.1.3  christos 
    786   1.1.1.3  christos     for (i = ASL_FILE_INPUT; i < ASL_MAX_FILE_TYPE; i++)
    787       1.1    jruoho     {
    788       1.1    jruoho         FlCloseFile (i);
    789       1.1    jruoho     }
    790       1.1    jruoho 
    791       1.1    jruoho     /* Delete AML file if there are errors */
    792       1.1    jruoho 
    793   1.1.1.3  christos     if (DeleteAmlFile)
    794       1.1    jruoho     {
    795   1.1.1.3  christos         FlDeleteFile (ASL_FILE_AML_OUTPUT);
    796   1.1.1.3  christos     }
    797   1.1.1.3  christos 
    798   1.1.1.6  christos     /* Delete the preprocessor temp file unless full debug was specified */
    799   1.1.1.3  christos 
    800   1.1.1.6  christos     if (Gbl_PreprocessFlag && !Gbl_KeepPreprocessorTempFile)
    801   1.1.1.3  christos     {
    802   1.1.1.3  christos         FlDeleteFile (ASL_FILE_PREPROCESSOR);
    803       1.1    jruoho     }
    804       1.1    jruoho 
    805       1.1    jruoho     /*
    806       1.1    jruoho      * Delete intermediate ("combined") source file (if -ls flag not set)
    807   1.1.1.2    jruoho      * This file is created during normal ASL/AML compiles. It is not
    808   1.1.1.2    jruoho      * created by the data table compiler.
    809   1.1.1.2    jruoho      *
    810   1.1.1.2    jruoho      * If the -ls flag is set, then the .SRC file should not be deleted.
    811   1.1.1.2    jruoho      * In this case, Gbl_SourceOutputFlag is set to TRUE.
    812   1.1.1.2    jruoho      *
    813   1.1.1.2    jruoho      * Note: Handles are cleared by FlCloseFile above, so we look at the
    814   1.1.1.2    jruoho      * filename instead, to determine if the .SRC file was actually
    815   1.1.1.2    jruoho      * created.
    816       1.1    jruoho      */
    817   1.1.1.3  christos     if (!Gbl_SourceOutputFlag)
    818       1.1    jruoho     {
    819   1.1.1.3  christos         FlDeleteFile (ASL_FILE_SOURCE_OUTPUT);
    820       1.1    jruoho     }
    821   1.1.1.4  christos 
    822   1.1.1.4  christos     /* Final cleanup after compiling one file */
    823   1.1.1.4  christos 
    824  1.1.1.10  christos     if (!Gbl_DoAslConversion)
    825  1.1.1.10  christos     {
    826  1.1.1.12  christos         UtDeleteLocalCaches ();
    827  1.1.1.10  christos     }
    828  1.1.1.10  christos 
    829   1.1.1.4  christos }
    830