summaryrefslogtreecommitdiff
path: root/source/compiler/aslcompile.c
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2018-09-27 16:43:02 +0000
committerJung-uk Kim <jkim@FreeBSD.org>2018-09-27 16:43:02 +0000
commit73d55968743da26d1ff63e9939f191d217aea206 (patch)
treeffb27de4d7c207dd7aeebd04b24e04f85d23b8dc /source/compiler/aslcompile.c
parentc6014c64fcfd099d0087da3509e8a623d2c30209 (diff)
Notes
Diffstat (limited to 'source/compiler/aslcompile.c')
-rw-r--r--source/compiler/aslcompile.c137
1 files changed, 68 insertions, 69 deletions
diff --git a/source/compiler/aslcompile.c b/source/compiler/aslcompile.c
index b0a06e6beb73..e08442e06867 100644
--- a/source/compiler/aslcompile.c
+++ b/source/compiler/aslcompile.c
@@ -205,7 +205,7 @@ CmDoCompile (
UtEndEvent (Event);
Event = UtBeginEvent ("Preprocess input file");
- if (Gbl_PreprocessFlag)
+ if (AslGbl_PreprocessFlag)
{
/* Enter compiler name as a #define */
@@ -214,10 +214,10 @@ CmDoCompile (
/* Preprocessor */
PrDoPreprocess ();
- Gbl_CurrentLineNumber = 1;
- Gbl_LogicalLineNumber = 1;
+ AslGbl_CurrentLineNumber = 1;
+ AslGbl_LogicalLineNumber = 1;
- if (Gbl_PreprocessOnly)
+ if (AslGbl_PreprocessOnly)
{
UtEndEvent (Event);
CmCleanupAndExit ();
@@ -235,7 +235,7 @@ CmDoCompile (
/* Check for parser-detected syntax errors */
- if (Gbl_SyntaxError)
+ if (AslGbl_SyntaxError)
{
fprintf (stderr,
"Compiler aborting due to parser-detected syntax error(s)\n");
@@ -245,7 +245,7 @@ CmDoCompile (
/* Did the parse tree get successfully constructed? */
- if (!Gbl_ParseTreeRoot)
+ if (!AslGbl_ParseTreeRoot)
{
/*
* If there are no errors, then we have some sort of
@@ -264,23 +264,23 @@ CmDoCompile (
/* Prune the parse tree if requested (debug purposes only) */
- if (Gbl_PruneParseTree)
+ if (AslGbl_PruneParseTree)
{
- AslPruneParseTree (Gbl_PruneDepth, Gbl_PruneType);
+ AslPruneParseTree (AslGbl_PruneDepth, AslGbl_PruneType);
}
/* Optional parse tree dump, compiler debug output only */
LsDumpParseTree ();
- OpcGetIntegerWidth (Gbl_ParseTreeRoot->Asl.Child);
+ OpcGetIntegerWidth (AslGbl_ParseTreeRoot->Asl.Child);
UtEndEvent (Event);
/* Pre-process parse tree for any operator transforms */
Event = UtBeginEvent ("Parse tree transforms");
DbgPrint (ASL_DEBUG_OUTPUT, "\nParse tree transforms\n\n");
- TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_TWICE,
+ TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_TWICE,
TrAmlTransformWalkBegin, TrAmlTransformWalkEnd, NULL);
UtEndEvent (Event);
@@ -288,7 +288,7 @@ CmDoCompile (
Event = UtBeginEvent ("Generate AML opcodes");
DbgPrint (ASL_DEBUG_OUTPUT, "Generating AML opcodes\n\n");
- TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, NULL,
+ TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, NULL,
OpcAmlOpcodeWalk, NULL);
UtEndEvent (Event);
@@ -298,7 +298,7 @@ CmDoCompile (
* descriptor within the input file.
*/
Event = UtBeginEvent ("Open AML output file");
- Status = FlOpenAmlOutputFile (Gbl_OutputFilenamePrefix);
+ Status = FlOpenAmlOutputFile (AslGbl_OutputFilenamePrefix);
UtEndEvent (Event);
if (ACPI_FAILURE (Status))
{
@@ -312,9 +312,9 @@ CmDoCompile (
DbgPrint (ASL_DEBUG_OUTPUT,
"Interpreting compile-time constant expressions\n\n");
- if (Gbl_FoldConstants)
+ if (AslGbl_FoldConstants)
{
- TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD,
+ TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD,
NULL, OpcAmlConstantWalk, NULL);
}
else
@@ -328,7 +328,7 @@ CmDoCompile (
Event = UtBeginEvent ("Updating AML opcodes after constant folding");
DbgPrint (ASL_DEBUG_OUTPUT,
"Updating AML opcodes after constant folding\n\n");
- TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD,
+ TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD,
NULL, OpcAmlOpcodeUpdateWalk, NULL);
UtEndEvent (Event);
@@ -336,15 +336,15 @@ CmDoCompile (
Event = UtBeginEvent ("Generate AML package lengths");
DbgPrint (ASL_DEBUG_OUTPUT, "Generating Package lengths\n\n");
- TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, NULL,
+ TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, NULL,
LnPackageLengthWalk, NULL);
UtEndEvent (Event);
- if (Gbl_ParseOnlyFlag)
+ if (AslGbl_ParseOnlyFlag)
{
AePrintErrorLog (ASL_FILE_STDERR);
UtDisplaySummary (ASL_FILE_STDERR);
- if (Gbl_DebugFlag)
+ if (AslGbl_DebugFlag)
{
/* Print error summary to the stdout also */
@@ -363,7 +363,7 @@ CmDoCompile (
Event = UtBeginEvent ("Create ACPI Namespace");
DbgPrint (ASL_DEBUG_OUTPUT, "Creating ACPI Namespace\n\n");
- Status = LdLoadNamespace (Gbl_ParseTreeRoot);
+ Status = LdLoadNamespace (AslGbl_ParseTreeRoot);
UtEndEvent (Event);
if (ACPI_FAILURE (Status))
{
@@ -388,19 +388,19 @@ CmDoCompile (
/* Resolve External Declarations */
- if (Gbl_DoExternals)
+ if (AslGbl_DoExternals)
{
Event = UtBeginEvent ("Resolve all Externals");
DbgPrint (ASL_DEBUG_OUTPUT, "\nResolve Externals\n\n");
- if (Gbl_DoExternalsInPlace)
+ if (AslGbl_DoExternalsInPlace)
{
- TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD,
+ TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD,
ExAmlExternalWalkBegin, NULL, NULL);
}
else
{
- TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_TWICE,
+ TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_TWICE,
ExAmlExternalWalkBegin, ExAmlExternalWalkEnd, NULL);
}
UtEndEvent (Event);
@@ -413,19 +413,19 @@ CmDoCompile (
* part one - check control methods
*/
Event = UtBeginEvent ("Analyze control method return types");
- AnalysisWalkInfo.MethodStack = NULL;
+ AslGbl_AnalysisWalkInfo.MethodStack = NULL;
DbgPrint (ASL_DEBUG_OUTPUT, "Semantic analysis - Method analysis\n\n");
- if (Gbl_CrossReferenceOutput)
+ if (AslGbl_CrossReferenceOutput)
{
OtPrintHeaders ("Part 1: Object Reference Map "
"(Object references from within each control method)");
}
- TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_TWICE,
+ TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_TWICE,
MtMethodAnalysisWalkBegin,
- MtMethodAnalysisWalkEnd, &AnalysisWalkInfo);
+ MtMethodAnalysisWalkEnd, &AslGbl_AnalysisWalkInfo);
UtEndEvent (Event);
/* Generate the object cross-reference file if requested */
@@ -438,7 +438,7 @@ CmDoCompile (
Event = UtBeginEvent ("Determine object types returned by methods");
DbgPrint (ASL_DEBUG_OUTPUT, "Semantic analysis - Method typing\n\n");
- TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD,
+ TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD,
NULL, AnMethodTypingWalkEnd, NULL);
UtEndEvent (Event);
@@ -447,10 +447,10 @@ CmDoCompile (
Event = UtBeginEvent ("Analyze AML operand types");
DbgPrint (ASL_DEBUG_OUTPUT,
"Semantic analysis - Operand type checking\n\n");
- if (Gbl_DoTypechecking)
+ if (AslGbl_DoTypechecking)
{
- TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD,
- NULL, AnOperandTypecheckWalkEnd, &AnalysisWalkInfo);
+ TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD,
+ NULL, AnOperandTypecheckWalkEnd, &AslGbl_AnalysisWalkInfo);
}
UtEndEvent (Event);
@@ -458,9 +458,9 @@ CmDoCompile (
Event = UtBeginEvent ("Miscellaneous analysis");
DbgPrint (ASL_DEBUG_OUTPUT, "Semantic analysis - miscellaneous\n\n");
- TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD,
+ TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD,
AnOtherSemanticAnalysisWalkBegin,
- NULL, &AnalysisWalkInfo);
+ NULL, &AslGbl_AnalysisWalkInfo);
UtEndEvent (Event);
/*
@@ -471,17 +471,17 @@ CmDoCompile (
*/
if (AcpiGbl_CaptureComments)
{
- AcpiGbl_LastListHead = Gbl_ParseTreeRoot->Asl.CommentList;
- Gbl_ParseTreeRoot->Asl.CommentList = NULL;
+ AcpiGbl_LastListHead = AslGbl_ParseTreeRoot->Asl.CommentList;
+ AslGbl_ParseTreeRoot->Asl.CommentList = NULL;
}
/* Calculate all AML package lengths */
Event = UtBeginEvent ("Finish AML package length generation");
DbgPrint (ASL_DEBUG_OUTPUT, "Generating Package lengths\n\n");
- TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, NULL,
+ TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, NULL,
LnInitLengthsWalk, NULL);
- TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, NULL,
+ TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, NULL,
LnPackageLengthWalk, NULL);
UtEndEvent (Event);
@@ -539,12 +539,12 @@ AslCompilerSignon (
case ASL_FILE_HEX_OUTPUT:
- if (Gbl_HexOutputFlag == HEX_OUTPUT_ASM)
+ if (AslGbl_HexOutputFlag == HEX_OUTPUT_ASM)
{
Prefix = "; ";
}
- else if ((Gbl_HexOutputFlag == HEX_OUTPUT_C) ||
- (Gbl_HexOutputFlag == HEX_OUTPUT_ASL))
+ else if ((AslGbl_HexOutputFlag == HEX_OUTPUT_C) ||
+ (AslGbl_HexOutputFlag == HEX_OUTPUT_ASL))
{
FlPrintFile (ASL_FILE_HEX_OUTPUT, "/*\n");
Prefix = " * ";
@@ -616,12 +616,12 @@ AslCompilerFileHeader (
case ASL_FILE_HEX_OUTPUT:
- if (Gbl_HexOutputFlag == HEX_OUTPUT_ASM)
+ if (AslGbl_HexOutputFlag == HEX_OUTPUT_ASM)
{
Prefix = "; ";
}
- else if ((Gbl_HexOutputFlag == HEX_OUTPUT_C) ||
- (Gbl_HexOutputFlag == HEX_OUTPUT_ASL))
+ else if ((AslGbl_HexOutputFlag == HEX_OUTPUT_C) ||
+ (AslGbl_HexOutputFlag == HEX_OUTPUT_ASL))
{
Prefix = " * ";
}
@@ -648,7 +648,7 @@ AslCompilerFileHeader (
FlPrintFile (FileId,
"%sCompilation of \"%s\" - %s%s\n",
- Prefix, Gbl_Files[ASL_FILE_INPUT].Filename, asctime (NewTime),
+ Prefix, AslGbl_Files[ASL_FILE_INPUT].Filename, asctime (NewTime),
Prefix);
switch (FileId)
@@ -756,7 +756,7 @@ CmDumpAllEvents (
Event = AslGbl_Events;
DbgPrint (ASL_DEBUG_OUTPUT, "\n\nElapsed time for major events\n\n");
- if (Gbl_CompileTimesFlag)
+ if (AslGbl_CompileTimesFlag)
{
printf ("\nElapsed time for major events\n\n");
}
@@ -782,7 +782,7 @@ CmDumpAllEvents (
DbgPrint (ASL_DEBUG_OUTPUT, "%8u usec %8u msec - %s\n",
MicroSeconds, MilliSeconds, Event->EventName);
- if (Gbl_CompileTimesFlag)
+ if (AslGbl_CompileTimesFlag)
{
printf ("%8u usec %8u msec - %s\n",
MicroSeconds, MilliSeconds, Event->EventName);
@@ -816,7 +816,7 @@ CmCleanupAndExit (
AslCheckExpectedExceptions ();
AePrintErrorLog (ASL_FILE_STDERR);
- if (Gbl_DebugFlag)
+ if (AslGbl_DebugFlag)
{
/* Print error summary to stdout also */
@@ -827,36 +827,36 @@ CmCleanupAndExit (
CmDumpAllEvents ();
- if (Gbl_CompileTimesFlag)
+ if (AslGbl_CompileTimesFlag)
{
printf ("\nMiscellaneous compile statistics\n\n");
- printf ("%11u : %s\n", TotalParseNodes, "Parse nodes");
- printf ("%11u : %s\n", Gbl_NsLookupCount, "Namespace searches");
- printf ("%11u : %s\n", TotalNamedObjects, "Named objects");
- printf ("%11u : %s\n", TotalMethods, "Control methods");
- printf ("%11u : %s\n", TotalAllocations, "Memory Allocations");
- printf ("%11u : %s\n", TotalAllocated, "Total allocated memory");
- printf ("%11u : %s\n", TotalFolds, "Constant subtrees folded");
+ printf ("%11u : %s\n", AslGbl_TotalParseNodes, "Parse nodes");
+ printf ("%11u : %s\n", AslGbl_NsLookupCount, "Namespace searches");
+ printf ("%11u : %s\n", AslGbl_TotalNamedObjects, "Named objects");
+ printf ("%11u : %s\n", AslGbl_TotalMethods, "Control methods");
+ printf ("%11u : %s\n", AslGbl_TotalAllocations, "Memory Allocations");
+ printf ("%11u : %s\n", AslGbl_TotalAllocated, "Total allocated memory");
+ printf ("%11u : %s\n", AslGbl_TotalFolds, "Constant subtrees folded");
printf ("\n");
}
- if (Gbl_NsLookupCount)
+ if (AslGbl_NsLookupCount)
{
DbgPrint (ASL_DEBUG_OUTPUT,
"\n\nMiscellaneous compile statistics\n\n");
DbgPrint (ASL_DEBUG_OUTPUT,
"%32s : %u\n", "Total Namespace searches",
- Gbl_NsLookupCount);
+ AslGbl_NsLookupCount);
DbgPrint (ASL_DEBUG_OUTPUT,
"%32s : %u usec\n", "Time per search", ((UINT32)
(AslGbl_Events[AslGbl_NamespaceEvent].EndTime -
AslGbl_Events[AslGbl_NamespaceEvent].StartTime) / 10) /
- Gbl_NsLookupCount);
+ AslGbl_NsLookupCount);
}
- if (Gbl_ExceptionCount[ASL_ERROR] > ASL_MAX_ERROR_COUNT)
+ if (AslGbl_ExceptionCount[ASL_ERROR] > ASL_MAX_ERROR_COUNT)
{
printf ("\nMaximum error count (%u) exceeded\n",
ASL_MAX_ERROR_COUNT);
@@ -868,9 +868,9 @@ CmCleanupAndExit (
* We will delete the AML file if there are errors and the
* force AML output option has not been used.
*/
- if ((Gbl_ExceptionCount[ASL_ERROR] > 0) &&
- (!Gbl_IgnoreErrors) &&
- Gbl_Files[ASL_FILE_AML_OUTPUT].Handle)
+ if ((AslGbl_ExceptionCount[ASL_ERROR] > 0) &&
+ (!AslGbl_IgnoreErrors) &&
+ AslGbl_Files[ASL_FILE_AML_OUTPUT].Handle)
{
DeleteAmlFile = TRUE;
}
@@ -883,10 +883,10 @@ CmCleanupAndExit (
* or aborted. Prevent attempt to close the same file twice in
* loop below.
*/
- if (Gbl_Files[ASL_FILE_PREPROCESSOR].Handle ==
- Gbl_Files[ASL_FILE_INPUT].Handle)
+ if (AslGbl_Files[ASL_FILE_PREPROCESSOR].Handle ==
+ AslGbl_Files[ASL_FILE_INPUT].Handle)
{
- Gbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL;
+ AslGbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL;
}
/* Close the standard I/O files */
@@ -905,7 +905,7 @@ CmCleanupAndExit (
/* Delete the preprocessor temp file unless full debug was specified */
- if (Gbl_PreprocessFlag && !Gbl_KeepPreprocessorTempFile)
+ if (AslGbl_PreprocessFlag && !AslGbl_KeepPreprocessorTempFile)
{
FlDeleteFile (ASL_FILE_PREPROCESSOR);
}
@@ -922,16 +922,15 @@ CmCleanupAndExit (
* filename instead, to determine if the .SRC file was actually
* created.
*/
- if (!Gbl_SourceOutputFlag)
+ if (!AslGbl_SourceOutputFlag)
{
FlDeleteFile (ASL_FILE_SOURCE_OUTPUT);
}
/* Final cleanup after compiling one file */
- if (!Gbl_DoAslConversion)
+ if (!AslGbl_DoAslConversion)
{
UtDeleteLocalCaches ();
}
-
}