Rev 1498 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1498 | serge | 1 | |
2 | * |
||
3 | * Module Name: aslcompile - top level compile module |
||
4 | * |
||
5 | *****************************************************************************/ |
||
6 | |||
7 | |||
8 | * |
||
9 | * 1. Copyright Notice |
||
10 | * |
||
11 | * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. |
||
2216 | Serge | 12 | * All rights reserved. |
1498 | serge | 13 | * |
14 | * 2. License |
||
15 | * |
||
16 | * 2.1. This is your license from Intel Corp. under its intellectual property |
||
17 | * rights. You may have additional license terms from the party that provided |
||
18 | * you this software, covering your right to use that party's intellectual |
||
19 | * property rights. |
||
20 | * |
||
21 | * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a |
||
22 | * copy of the source code appearing in this file ("Covered Code") an |
||
23 | * irrevocable, perpetual, worldwide license under Intel's copyrights in the |
||
24 | * base code distributed originally by Intel ("Original Intel Code") to copy, |
||
25 | * make derivatives, distribute, use and display any portion of the Covered |
||
26 | * Code in any form, with the right to sublicense such rights; and |
||
27 | * |
||
28 | * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent |
||
29 | * license (with the right to sublicense), under only those claims of Intel |
||
30 | * patents that are infringed by the Original Intel Code, to make, use, sell, |
||
31 | * offer to sell, and import the Covered Code and derivative works thereof |
||
32 | * solely to the minimum extent necessary to exercise the above copyright |
||
33 | * license, and in no event shall the patent license extend to any additions |
||
34 | * to or modifications of the Original Intel Code. No other license or right |
||
35 | * is granted directly or by implication, estoppel or otherwise; |
||
36 | * |
||
37 | * The above copyright and patent license is granted only if the following |
||
38 | * conditions are met: |
||
39 | * |
||
40 | * 3. Conditions |
||
41 | * |
||
42 | * 3.1. Redistribution of Source with Rights to Further Distribute Source. |
||
43 | * Redistribution of source code of any substantial portion of the Covered |
||
44 | * Code or modification with rights to further distribute source must include |
||
45 | * the above Copyright Notice, the above License, this list of Conditions, |
||
46 | * and the following Disclaimer and Export Compliance provision. In addition, |
||
47 | * Licensee must cause all Covered Code to which Licensee contributes to |
||
48 | * contain a file documenting the changes Licensee made to create that Covered |
||
49 | * Code and the date of any change. Licensee must include in that file the |
||
50 | * documentation of any changes made by any predecessor Licensee. Licensee |
||
51 | * must include a prominent statement that the modification is derived, |
||
52 | * directly or indirectly, from Original Intel Code. |
||
53 | * |
||
54 | * 3.2. Redistribution of Source with no Rights to Further Distribute Source. |
||
55 | * Redistribution of source code of any substantial portion of the Covered |
||
56 | * Code or modification without rights to further distribute source must |
||
57 | * include the following Disclaimer and Export Compliance provision in the |
||
58 | * documentation and/or other materials provided with distribution. In |
||
59 | * addition, Licensee may not authorize further sublicense of source of any |
||
60 | * portion of the Covered Code, and must include terms to the effect that the |
||
61 | * license from Licensee to its licensee is limited to the intellectual |
||
62 | * property embodied in the software Licensee provides to its licensee, and |
||
63 | * not to intellectual property embodied in modifications its licensee may |
||
64 | * make. |
||
65 | * |
||
66 | * 3.3. Redistribution of Executable. Redistribution in executable form of any |
||
67 | * substantial portion of the Covered Code or modification must reproduce the |
||
68 | * above Copyright Notice, and the following Disclaimer and Export Compliance |
||
69 | * provision in the documentation and/or other materials provided with the |
||
70 | * distribution. |
||
71 | * |
||
72 | * 3.4. Intel retains all right, title, and interest in and to the Original |
||
73 | * Intel Code. |
||
74 | * |
||
75 | * 3.5. Neither the name Intel nor any other trademark owned or controlled by |
||
76 | * Intel shall be used in advertising or otherwise to promote the sale, use or |
||
77 | * other dealings in products derived from or relating to the Covered Code |
||
78 | * without prior written authorization from Intel. |
||
79 | * |
||
80 | * 4. Disclaimer and Export Compliance |
||
81 | * |
||
82 | * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED |
||
83 | * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE |
||
84 | * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, |
||
85 | * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY |
||
86 | * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY |
||
87 | * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A |
||
88 | * PARTICULAR PURPOSE. |
||
89 | * |
||
90 | * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES |
||
91 | * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR |
||
92 | * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, |
||
93 | * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY |
||
94 | * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL |
||
95 | * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS |
||
96 | * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY |
||
97 | * LIMITED REMEDY. |
||
98 | * |
||
99 | * 4.3. Licensee shall not export, either directly or indirectly, any of this |
||
100 | * software or system incorporating such software without first obtaining any |
||
101 | * required license or other approval from the U. S. Department of Commerce or |
||
102 | * any other agency or department of the United States Government. In the |
||
103 | * event Licensee exports any such software from the United States or |
||
104 | * re-exports any such software from a foreign destination, Licensee shall |
||
105 | * ensure that the distribution and export/re-export of the software is in |
||
106 | * compliance with all laws, regulations, orders, or other restrictions of the |
||
107 | * U.S. Export Administration Regulations. Licensee agrees that neither it nor |
||
108 | * any of its subsidiaries will export/re-export any technical data, process, |
||
109 | * software, or service, directly or indirectly, to any country for which the |
||
110 | * United States government or any agency thereof requires an export license, |
||
111 | * other governmental approval, or letter of assurance, without first obtaining |
||
112 | * such license, approval or letter. |
||
113 | * |
||
114 | *****************************************************************************/ |
||
115 | |||
116 | |||
2216 | Serge | 117 | |
118 | |||
1498 | serge | 119 | #include |
120 | #include |
||
2216 | Serge | 121 | |
1498 | serge | 122 | |
123 | ACPI_MODULE_NAME ("aslcompile") |
||
124 | |||
125 | |||
126 | |||
127 | |||
128 | CmFlushSourceCode ( |
||
129 | void); |
||
130 | |||
131 | |||
2216 | Serge | 132 | FlConsumeAnsiComment ( |
1498 | serge | 133 | ASL_FILE_INFO *FileInfo, |
134 | ASL_FILE_STATUS *Status); |
||
135 | |||
136 | |||
2216 | Serge | 137 | FlConsumeNewComment ( |
1498 | serge | 138 | ASL_FILE_INFO *FileInfo, |
139 | ASL_FILE_STATUS *Status); |
||
140 | |||
141 | |||
142 | |||
143 | * |
||
144 | * FUNCTION: AslCompilerSignon |
||
145 | * |
||
146 | * PARAMETERS: FileId - ID of the output file |
||
147 | * |
||
148 | * RETURN: None |
||
149 | * |
||
150 | * DESCRIPTION: Display compiler signon |
||
151 | * |
||
152 | ******************************************************************************/ |
||
153 | |||
154 | |||
155 | AslCompilerSignon ( |
||
156 | UINT32 FileId) |
||
157 | { |
||
158 | char *Prefix = ""; |
||
159 | char *UtilityName; |
||
2216 | Serge | 160 | |
1498 | serge | 161 | |
162 | |||
163 | |||
164 | |||
165 | { |
||
166 | case ASL_FILE_ASM_SOURCE_OUTPUT: |
||
167 | case ASL_FILE_ASM_INCLUDE_OUTPUT: |
||
168 | |||
169 | |||
170 | break; |
||
171 | |||
172 | |||
173 | |||
174 | |||
175 | { |
||
176 | Prefix = "; "; |
||
177 | } |
||
178 | else if ((Gbl_HexOutputFlag == HEX_OUTPUT_C) || |
||
179 | (Gbl_HexOutputFlag == HEX_OUTPUT_ASL)) |
||
180 | { |
||
181 | FlPrintFile (ASL_FILE_HEX_OUTPUT, "/*\n"); |
||
182 | Prefix = " * "; |
||
183 | } |
||
184 | break; |
||
185 | |||
186 | |||
187 | case ASL_FILE_C_INCLUDE_OUTPUT: |
||
188 | |||
189 | |||
190 | break; |
||
191 | |||
192 | |||
193 | /* No other output types supported */ |
||
194 | break; |
||
195 | } |
||
196 | |||
197 | |||
198 | |||
199 | |||
200 | { |
||
201 | UtilityName = AML_DISASSEMBLER_NAME; |
||
2216 | Serge | 202 | } |
1498 | serge | 203 | else |
204 | { |
||
205 | UtilityName = ASL_COMPILER_NAME; |
||
2216 | Serge | 206 | } |
1498 | serge | 207 | |
208 | |||
2216 | Serge | 209 | |
1498 | serge | 210 | |
2216 | Serge | 211 | FlPrintFile (FileId, ACPI_COMMON_HEADER (UtilityName, Prefix)); |
212 | } |
||
1498 | serge | 213 | |
214 | |||
215 | |||
216 | * |
||
217 | * FUNCTION: AslCompilerFileHeader |
||
218 | * |
||
219 | * PARAMETERS: FileId - ID of the output file |
||
220 | * |
||
221 | * RETURN: None |
||
222 | * |
||
223 | * DESCRIPTION: Header used at the beginning of output files |
||
224 | * |
||
225 | ******************************************************************************/ |
||
226 | |||
227 | |||
228 | AslCompilerFileHeader ( |
||
229 | UINT32 FileId) |
||
230 | { |
||
231 | struct tm *NewTime; |
||
232 | time_t Aclock; |
||
233 | char *Prefix = ""; |
||
234 | |||
235 | |||
236 | |||
237 | |||
238 | |||
239 | { |
||
240 | case ASL_FILE_ASM_SOURCE_OUTPUT: |
||
241 | case ASL_FILE_ASM_INCLUDE_OUTPUT: |
||
242 | |||
243 | |||
244 | break; |
||
245 | |||
246 | |||
247 | |||
248 | |||
249 | { |
||
250 | Prefix = "; "; |
||
251 | } |
||
252 | else if ((Gbl_HexOutputFlag == HEX_OUTPUT_C) || |
||
253 | (Gbl_HexOutputFlag == HEX_OUTPUT_ASL)) |
||
254 | { |
||
255 | Prefix = " * "; |
||
256 | } |
||
257 | break; |
||
258 | |||
259 | |||
260 | case ASL_FILE_C_INCLUDE_OUTPUT: |
||
261 | |||
262 | |||
263 | break; |
||
264 | |||
265 | |||
266 | /* No other output types supported */ |
||
267 | break; |
||
268 | } |
||
269 | |||
270 | |||
271 | |||
272 | |||
273 | NewTime = localtime (&Aclock); |
||
274 | |||
275 | |||
276 | "%sCompilation of \"%s\" - %s%s\n", |
||
277 | Prefix, Gbl_Files[ASL_FILE_INPUT].Filename, asctime (NewTime), |
||
278 | Prefix); |
||
279 | |||
280 | |||
281 | { |
||
282 | case ASL_FILE_C_SOURCE_OUTPUT: |
||
283 | case ASL_FILE_C_INCLUDE_OUTPUT: |
||
284 | FlPrintFile (FileId, " */\n"); |
||
285 | break; |
||
286 | |||
287 | |||
288 | /* Nothing to do for other output types */ |
||
289 | break; |
||
290 | } |
||
291 | } |
||
292 | |||
293 | |||
294 | |||
295 | * |
||
296 | * FUNCTION: CmFlushSourceCode |
||
297 | * |
||
298 | * PARAMETERS: None |
||
299 | * |
||
300 | * RETURN: None |
||
301 | * |
||
302 | * DESCRIPTION: Read in any remaining source code after the parse tree |
||
303 | * has been constructed. |
||
304 | * |
||
305 | ******************************************************************************/ |
||
306 | |||
307 | |||
308 | CmFlushSourceCode ( |
||
309 | void) |
||
310 | { |
||
311 | char Buffer; |
||
312 | |||
313 | |||
314 | |||
315 | { |
||
316 | InsertLineBuffer ((int) Buffer); |
||
317 | } |
||
318 | |||
319 | |||
320 | } |
||
321 | |||
322 | |||
323 | |||
324 | * |
||
325 | * FUNCTION: FlConsume* |
||
326 | * |
||
327 | * PARAMETERS: FileInfo - Points to an open input file |
||
328 | * |
||
329 | * RETURN: Number of lines consumed |
||
330 | * |
||
331 | * DESCRIPTION: Step over both types of comment during check for ascii chars |
||
332 | * |
||
333 | ******************************************************************************/ |
||
334 | |||
335 | |||
2216 | Serge | 336 | FlConsumeAnsiComment ( |
1498 | serge | 337 | ASL_FILE_INFO *FileInfo, |
338 | ASL_FILE_STATUS *Status) |
||
339 | { |
||
340 | UINT8 Byte; |
||
341 | BOOLEAN ClosingComment = FALSE; |
||
342 | |||
343 | |||
344 | |||
345 | { |
||
346 | /* Scan until comment close is found */ |
||
347 | |||
348 | |||
349 | { |
||
350 | if (Byte == '/') |
||
351 | { |
||
352 | return; |
||
353 | } |
||
354 | |||
355 | |||
356 | { |
||
357 | /* Reset */ |
||
358 | |||
359 | |||
360 | } |
||
361 | } |
||
362 | else if (Byte == '*') |
||
363 | { |
||
364 | ClosingComment = TRUE; |
||
365 | } |
||
366 | |||
367 | |||
368 | |||
369 | |||
370 | { |
||
371 | Status->Line++; |
||
372 | } |
||
373 | |||
374 | |||
375 | } |
||
376 | } |
||
377 | |||
378 | |||
379 | |||
2216 | Serge | 380 | FlConsumeNewComment ( |
1498 | serge | 381 | ASL_FILE_INFO *FileInfo, |
382 | ASL_FILE_STATUS *Status) |
||
383 | { |
||
384 | UINT8 Byte; |
||
385 | |||
386 | |||
387 | |||
388 | { |
||
389 | Status->Offset++; |
||
390 | |||
391 | |||
392 | |||
393 | |||
394 | { |
||
395 | Status->Line++; |
||
396 | return; |
||
397 | } |
||
398 | } |
||
399 | } |
||
400 | |||
401 | |||
402 | |||
403 | * |
||
404 | * FUNCTION: FlCheckForAscii |
||
405 | * |
||
406 | * PARAMETERS: FileInfo - Points to an open input file |
||
407 | * |
||
408 | * RETURN: Status |
||
409 | * |
||
410 | * DESCRIPTION: Verify that the input file is entirely ASCII. Ignores characters |
||
411 | * within comments. Note: does not handle nested comments and does |
||
412 | * not handle comment delimiters within string literals. However, |
||
413 | * on the rare chance this happens and an invalid character is |
||
414 | * missed, the parser will catch the error by failing in some |
||
415 | * spectactular manner. |
||
416 | * |
||
417 | ******************************************************************************/ |
||
418 | |||
419 | |||
420 | FlCheckForAscii ( |
||
421 | ASL_FILE_INFO *FileInfo) |
||
422 | { |
||
423 | UINT8 Byte; |
||
424 | ACPI_SIZE BadBytes = 0; |
||
425 | BOOLEAN OpeningComment = FALSE; |
||
426 | ASL_FILE_STATUS Status; |
||
427 | |||
428 | |||
429 | |||
430 | Status.Offset = 0; |
||
431 | |||
432 | |||
433 | |||
434 | |||
435 | { |
||
436 | /* Ignore comment fields (allow non-ascii within) */ |
||
437 | |||
438 | |||
439 | { |
||
440 | /* Check for second comment open delimiter */ |
||
441 | |||
442 | |||
443 | { |
||
444 | FlConsumeAnsiComment (FileInfo, &Status); |
||
445 | } |
||
446 | |||
447 | |||
448 | { |
||
449 | FlConsumeNewComment (FileInfo, &Status); |
||
450 | } |
||
451 | |||
452 | |||
453 | |||
454 | |||
455 | } |
||
456 | else if (Byte == '/') |
||
457 | { |
||
458 | OpeningComment = TRUE; |
||
459 | } |
||
460 | |||
461 | |||
462 | |||
463 | |||
464 | { |
||
465 | if (BadBytes < 10) |
||
466 | { |
||
467 | AcpiOsPrintf ( |
||
468 | "Non-ASCII character [0x%2.2X] found in line %u, file offset 0x%.2X\n", |
||
469 | Byte, Status.Line, Status.Offset); |
||
470 | } |
||
471 | |||
472 | |||
473 | } |
||
474 | |||
475 | |||
476 | |||
477 | |||
478 | { |
||
479 | Status.Line++; |
||
480 | } |
||
481 | |||
482 | |||
483 | } |
||
484 | |||
485 | |||
486 | |||
487 | |||
488 | |||
489 | |||
490 | |||
491 | |||
492 | { |
||
493 | AcpiOsPrintf ( |
||
494 | "%u non-ASCII characters found in input source text, could be a binary file\n", |
||
495 | BadBytes); |
||
496 | AslError (ASL_ERROR, ASL_MSG_NON_ASCII, NULL, FileInfo->Filename); |
||
497 | return (AE_BAD_CHARACTER); |
||
498 | } |
||
499 | |||
500 | |||
501 | |||
502 | |||
503 | } |
||
504 | |||
505 | |||
506 | |||
507 | * |
||
508 | * FUNCTION: CmDoCompile |
||
509 | * |
||
510 | * PARAMETERS: None |
||
511 | * |
||
512 | * RETURN: Status (0 = OK) |
||
513 | * |
||
514 | * DESCRIPTION: This procedure performs the entire compile |
||
515 | * |
||
516 | ******************************************************************************/ |
||
517 | |||
518 | |||
519 | CmDoCompile ( |
||
520 | void) |
||
521 | { |
||
522 | ACPI_STATUS Status; |
||
523 | UINT8 FullCompile; |
||
524 | UINT8 Event; |
||
525 | |||
526 | |||
527 | |||
528 | Event = UtBeginEvent ("Open input and output files"); |
||
529 | UtEndEvent (Event); |
||
530 | |||
531 | |||
532 | |||
533 | |||
534 | AslCompilerparse(); |
||
535 | UtEndEvent (Event); |
||
536 | |||
537 | |||
538 | |||
539 | |||
540 | CmFlushSourceCode (); |
||
541 | |||
542 | |||
543 | |||
544 | |||
545 | { |
||
546 | CmCleanupAndExit (); |
||
547 | return -1; |
||
548 | } |
||
549 | |||
550 | |||
551 | |||
552 | |||
553 | |||
554 | |||
555 | UtEndEvent (Event); |
||
556 | |||
557 | |||
558 | |||
559 | |||
560 | DbgPrint (ASL_DEBUG_OUTPUT, "\nParse tree transforms\n\n"); |
||
561 | TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, |
||
562 | TrAmlTransformWalk, NULL, NULL); |
||
563 | UtEndEvent (Event); |
||
564 | |||
565 | |||
566 | |||
567 | |||
568 | DbgPrint (ASL_DEBUG_OUTPUT, "\nGenerating AML opcodes\n\n"); |
||
569 | TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL, |
||
570 | OpcAmlOpcodeWalk, NULL); |
||
571 | UtEndEvent (Event); |
||
572 | |||
573 | |||
574 | * Now that the input is parsed, we can open the AML output file. |
||
575 | * Note: by default, the name of this file comes from the table descriptor |
||
576 | * within the input file. |
||
577 | */ |
||
578 | Event = UtBeginEvent ("Open AML output file"); |
||
579 | Status = FlOpenAmlOutputFile (Gbl_OutputFilenamePrefix); |
||
580 | if (ACPI_FAILURE (Status)) |
||
581 | { |
||
582 | AePrintErrorLog (ASL_FILE_STDERR); |
||
583 | return -1; |
||
584 | } |
||
585 | UtEndEvent (Event); |
||
586 | |||
587 | |||
588 | |||
589 | |||
590 | DbgPrint (ASL_DEBUG_OUTPUT, |
||
591 | "\nInterpreting compile-time constant expressions\n\n"); |
||
592 | TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, |
||
593 | OpcAmlConstantWalk, NULL, NULL); |
||
594 | UtEndEvent (Event); |
||
595 | |||
596 | |||
597 | |||
598 | |||
599 | DbgPrint (ASL_DEBUG_OUTPUT, |
||
600 | "\nUpdating AML opcodes after constant folding\n\n"); |
||
601 | TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, |
||
602 | NULL, OpcAmlOpcodeUpdateWalk, NULL); |
||
603 | UtEndEvent (Event); |
||
604 | |||
605 | |||
606 | |||
607 | |||
608 | DbgPrint (ASL_DEBUG_OUTPUT, "\nGenerating Package lengths\n\n"); |
||
609 | TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL, |
||
610 | LnPackageLengthWalk, NULL); |
||
611 | UtEndEvent (Event); |
||
612 | |||
613 | |||
614 | { |
||
615 | AePrintErrorLog (ASL_FILE_STDOUT); |
||
616 | UtDisplaySummary (ASL_FILE_STDOUT); |
||
617 | if (Gbl_DebugFlag) |
||
618 | { |
||
619 | /* Print error summary to the debug file */ |
||
620 | |||
621 | |||
622 | UtDisplaySummary (ASL_FILE_STDERR); |
||
623 | } |
||
624 | return 0; |
||
625 | } |
||
626 | |||
627 | |||
628 | * Create an internal namespace and use it as a symbol table |
||
629 | */ |
||
630 | |||
631 | |||
632 | |||
633 | |||
634 | Status = LdLoadNamespace (RootNode); |
||
635 | UtEndEvent (Event); |
||
636 | if (ACPI_FAILURE (Status)) |
||
637 | { |
||
638 | return -1; |
||
639 | } |
||
640 | |||
641 | |||
642 | |||
643 | |||
644 | Status = LkCrossReferenceNamespace (); |
||
645 | if (ACPI_FAILURE (Status)) |
||
646 | { |
||
647 | return -1; |
||
648 | } |
||
649 | |||
650 | |||
651 | |||
652 | |||
653 | UtEndEvent (AslGbl_NamespaceEvent); |
||
654 | |||
655 | |||
656 | * Semantic analysis. This can happen only after the |
||
657 | * namespace has been loaded and cross-referenced. |
||
658 | * |
||
659 | * part one - check control methods |
||
660 | */ |
||
661 | Event = UtBeginEvent ("Analyze control method return types"); |
||
662 | AnalysisWalkInfo.MethodStack = NULL; |
||
663 | |||
664 | |||
665 | TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE, |
||
666 | AnMethodAnalysisWalkBegin, |
||
667 | AnMethodAnalysisWalkEnd, &AnalysisWalkInfo); |
||
668 | UtEndEvent (Event); |
||
669 | |||
670 | |||
671 | |||
672 | |||
673 | DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - Method typing\n\n"); |
||
674 | TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, |
||
2216 | Serge | 675 | NULL, AnMethodTypingWalkEnd, NULL); |
676 | UtEndEvent (Event); |
||
1498 | serge | 677 | |
678 | |||
679 | |||
680 | |||
681 | DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - Operand type checking\n\n"); |
||
682 | TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, |
||
2216 | Serge | 683 | NULL, AnOperandTypecheckWalkEnd, &AnalysisWalkInfo); |
684 | UtEndEvent (Event); |
||
1498 | serge | 685 | |
686 | |||
687 | |||
688 | |||
689 | DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - miscellaneous\n\n"); |
||
690 | TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, |
||
2216 | Serge | 691 | AnOtherSemanticAnalysisWalkBegin, |
1498 | serge | 692 | NULL, &AnalysisWalkInfo); |
2216 | Serge | 693 | UtEndEvent (Event); |
1498 | serge | 694 | |
695 | |||
696 | |||
697 | |||
698 | DbgPrint (ASL_DEBUG_OUTPUT, "\nGenerating Package lengths\n\n"); |
||
699 | TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL, |
||
700 | LnInitLengthsWalk, NULL); |
||
701 | TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL, |
||
702 | LnPackageLengthWalk, NULL); |
||
703 | UtEndEvent (Event); |
||
704 | |||
705 | |||
706 | |||
707 | |||
708 | CgGenerateAmlOutput (); |
||
709 | UtEndEvent (Event); |
||
710 | |||
711 | |||
712 | CmDoOutputFiles (); |
||
713 | UtEndEvent (Event); |
||
714 | |||
715 | |||
716 | CmCleanupAndExit (); |
||
717 | return 0; |
||
718 | } |
||
719 | |||
720 | |||
721 | |||
722 | * |
||
723 | * FUNCTION: CmDoOutputFiles |
||
724 | * |
||
725 | * PARAMETERS: None |
||
726 | * |
||
727 | * RETURN: None. |
||
728 | * |
||
729 | * DESCRIPTION: Create all "listing" type files |
||
730 | * |
||
731 | ******************************************************************************/ |
||
732 | |||
733 | |||
734 | CmDoOutputFiles ( |
||
735 | void) |
||
736 | { |
||
737 | |||
738 | |||
739 | |||
740 | |||
741 | LsDoHexOutput (); |
||
742 | |||
743 | |||
744 | |||
745 | |||
746 | } |
||
747 | |||
748 | |||
749 | |||
750 | * |
||
751 | * FUNCTION: CmDumpEvent |
||
752 | * |
||
753 | * PARAMETERS: Event - A compiler event struct |
||
754 | * |
||
755 | * RETURN: None. |
||
756 | * |
||
757 | * DESCRIPTION: Dump a compiler event struct |
||
758 | * |
||
759 | ******************************************************************************/ |
||
760 | |||
761 | |||
762 | CmDumpEvent ( |
||
763 | ASL_EVENT_INFO *Event) |
||
764 | { |
||
765 | UINT32 Delta; |
||
766 | UINT32 USec; |
||
767 | UINT32 MSec; |
||
768 | |||
769 | |||
770 | { |
||
771 | return; |
||
772 | } |
||
773 | |||
774 | |||
775 | |||
776 | |||
777 | |||
778 | |||
779 | MSec = Delta / 10000; |
||
780 | |||
781 | |||
782 | |||
783 | |||
784 | { |
||
785 | MSec++; |
||
786 | } |
||
787 | |||
788 | |||
789 | USec, MSec, Event->EventName); |
||
790 | } |
||
791 | |||
792 | |||
793 | |||
794 | * |
||
795 | * FUNCTION: CmCleanupAndExit |
||
796 | * |
||
797 | * PARAMETERS: None |
||
798 | * |
||
799 | * RETURN: None. |
||
800 | * |
||
801 | * DESCRIPTION: Close all open files and exit the compiler |
||
802 | * |
||
803 | ******************************************************************************/ |
||
804 | |||
805 | |||
806 | CmCleanupAndExit ( |
||
807 | void) |
||
808 | { |
||
809 | UINT32 i; |
||
810 | |||
811 | |||
812 | |||
813 | if (Gbl_DebugFlag) |
||
814 | { |
||
815 | /* Print error summary to the debug file */ |
||
816 | |||
817 | |||
818 | } |
||
819 | |||
820 | |||
821 | for (i = 0; i < AslGbl_NextEvent; i++) |
||
822 | { |
||
823 | CmDumpEvent (&AslGbl_Events[i]); |
||
824 | } |
||
825 | |||
826 | |||
827 | { |
||
828 | printf ("\nElapsed time for major events\n\n"); |
||
829 | for (i = 0; i < AslGbl_NextEvent; i++) |
||
830 | { |
||
831 | CmDumpEvent (&AslGbl_Events[i]); |
||
832 | } |
||
833 | |||
834 | |||
835 | printf ("%11u : %s\n", TotalParseNodes, "Parse nodes"); |
||
836 | printf ("%11u : %s\n", Gbl_NsLookupCount, "Namespace searches"); |
||
837 | printf ("%11u : %s\n", TotalNamedObjects, "Named objects"); |
||
838 | printf ("%11u : %s\n", TotalMethods, "Control methods"); |
||
839 | printf ("%11u : %s\n", TotalAllocations, "Memory Allocations"); |
||
840 | printf ("%11u : %s\n", TotalAllocated, "Total allocated memory"); |
||
841 | printf ("%11u : %s\n", TotalFolds, "Constant subtrees folded"); |
||
842 | printf ("\n"); |
||
843 | } |
||
844 | |||
845 | |||
846 | { |
||
847 | DbgPrint (ASL_DEBUG_OUTPUT, |
||
848 | "\n\nMiscellaneous compile statistics\n\n"); |
||
849 | |||
850 | |||
851 | "%32s : %u\n", "Total Namespace searches", |
||
852 | Gbl_NsLookupCount); |
||
853 | |||
854 | |||
855 | "%32s : %u usec\n", "Time per search", ((UINT32) |
||
856 | (AslGbl_Events[AslGbl_NamespaceEvent].EndTime - |
||
857 | AslGbl_Events[AslGbl_NamespaceEvent].StartTime) / 10) / |
||
858 | Gbl_NsLookupCount); |
||
859 | } |
||
860 | |||
861 | |||
862 | { |
||
863 | printf ("\nMaximum error count (%u) exceeded\n", |
||
864 | ASL_MAX_ERROR_COUNT); |
||
865 | } |
||
866 | |||
867 | |||
868 | |||
869 | |||
870 | |||
871 | |||
872 | { |
||
873 | FlCloseFile (i); |
||
874 | } |
||
875 | |||
876 | |||
877 | |||
878 | |||
879 | Gbl_Files[ASL_FILE_AML_OUTPUT].Handle) |
||
880 | { |
||
881 | if (remove (Gbl_Files[ASL_FILE_AML_OUTPUT].Filename)) |
||
882 | { |
||
883 | printf ("%s: ", |
||
884 | Gbl_Files[ASL_FILE_AML_OUTPUT].Filename); |
||
885 | perror ("Could not delete AML file"); |
||
886 | } |
||
887 | } |
||
888 | |||
889 | |||
890 | * Delete intermediate ("combined") source file (if -ls flag not set) |
||
891 | * This file is created during normal ASL/AML compiles. It is not |
||
2216 | Serge | 892 | * created by the data table compiler. |
893 | * |
||
1498 | serge | 894 | * If the -ls flag is set, then the .SRC file should not be deleted. |
2216 | Serge | 895 | * In this case, Gbl_SourceOutputFlag is set to TRUE. |
896 | * |
||
897 | * Note: Handles are cleared by FlCloseFile above, so we look at the |
||
898 | * filename instead, to determine if the .SRC file was actually |
||
899 | * created. |
||
900 | * |
||
901 | * TBD: SourceOutput should be .TMP, then rename if we want to keep it? |
||
1498 | serge | 902 | */ |
903 | if (!Gbl_SourceOutputFlag && Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename) |
||
2216 | Serge | 904 | { |
1498 | serge | 905 | if (remove (Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename)) |
906 | { |
||
907 | printf ("%s: ", |
||
908 | Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename); |
||
909 | perror ("Could not delete SRC file"); |
||
910 | } |
||
911 | } |
||
912 | }>>>> |
||
913 |