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