Go to most recent revision | Details | 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 - 2010, Intel Corp. |
||
12 | * All rights reserved. |
||
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 | |||
117 | #include |
||
118 | #include "aslcompiler.h" |
||
119 | |||
120 | |||
121 | ACPI_MODULE_NAME ("aslcompile") |
||
122 | |||
123 | |||
124 | |||
125 | |||
126 | CmFlushSourceCode ( |
||
127 | void); |
||
128 | |||
129 | |||
130 | FlConsumeAnsiComment ( |
||
131 | ASL_FILE_INFO *FileInfo, |
||
132 | ASL_FILE_STATUS *Status); |
||
133 | |||
134 | |||
135 | FlConsumeNewComment ( |
||
136 | ASL_FILE_INFO *FileInfo, |
||
137 | ASL_FILE_STATUS *Status); |
||
138 | |||
139 | |||
140 | |||
141 | * |
||
142 | * FUNCTION: AslCompilerSignon |
||
143 | * |
||
144 | * PARAMETERS: FileId - ID of the output file |
||
145 | * |
||
146 | * RETURN: None |
||
147 | * |
||
148 | * DESCRIPTION: Display compiler signon |
||
149 | * |
||
150 | ******************************************************************************/ |
||
151 | |||
152 | |||
153 | AslCompilerSignon ( |
||
154 | UINT32 FileId) |
||
155 | { |
||
156 | char *Prefix = ""; |
||
157 | |||
158 | |||
159 | |||
160 | |||
161 | |||
162 | { |
||
163 | case ASL_FILE_ASM_SOURCE_OUTPUT: |
||
164 | case ASL_FILE_ASM_INCLUDE_OUTPUT: |
||
165 | |||
166 | |||
167 | break; |
||
168 | |||
169 | |||
170 | |||
171 | |||
172 | { |
||
173 | Prefix = "; "; |
||
174 | } |
||
175 | else if ((Gbl_HexOutputFlag == HEX_OUTPUT_C) || |
||
176 | (Gbl_HexOutputFlag == HEX_OUTPUT_ASL)) |
||
177 | { |
||
178 | FlPrintFile (ASL_FILE_HEX_OUTPUT, "/*\n"); |
||
179 | Prefix = " * "; |
||
180 | } |
||
181 | break; |
||
182 | |||
183 | |||
184 | case ASL_FILE_C_INCLUDE_OUTPUT: |
||
185 | |||
186 | |||
187 | break; |
||
188 | |||
189 | |||
190 | /* No other output types supported */ |
||
191 | break; |
||
192 | } |
||
193 | |||
194 | |||
195 | * Compiler signon with copyright |
||
196 | */ |
||
197 | FlPrintFile (FileId, |
||
198 | "%s\n%s%s\n%s", |
||
199 | Prefix, |
||
200 | Prefix, IntelAcpiCA, |
||
201 | Prefix); |
||
202 | |||
203 | |||
204 | |||
205 | |||
206 | { |
||
207 | FlPrintFile (FileId, |
||
208 | "%s", DisassemblerId); |
||
209 | } |
||
210 | else |
||
211 | { |
||
212 | FlPrintFile (FileId, |
||
213 | "%s", CompilerId); |
||
214 | } |
||
215 | |||
216 | |||
217 | |||
218 | |||
219 | " version %X [%s]\n%s%s\n%s%s\n%s\n", |
||
220 | (UINT32) ACPI_CA_VERSION, __DATE__, |
||
221 | Prefix, CompilerCopyright, |
||
222 | Prefix, CompilerCompliance, |
||
223 | Prefix); |
||
224 | } |
||
225 | |||
226 | |||
227 | |||
228 | * |
||
229 | * FUNCTION: AslCompilerFileHeader |
||
230 | * |
||
231 | * PARAMETERS: FileId - ID of the output file |
||
232 | * |
||
233 | * RETURN: None |
||
234 | * |
||
235 | * DESCRIPTION: Header used at the beginning of output files |
||
236 | * |
||
237 | ******************************************************************************/ |
||
238 | |||
239 | |||
240 | AslCompilerFileHeader ( |
||
241 | UINT32 FileId) |
||
242 | { |
||
243 | struct tm *NewTime; |
||
244 | time_t Aclock; |
||
245 | char *Prefix = ""; |
||
246 | |||
247 | |||
248 | |||
249 | |||
250 | |||
251 | { |
||
252 | case ASL_FILE_ASM_SOURCE_OUTPUT: |
||
253 | case ASL_FILE_ASM_INCLUDE_OUTPUT: |
||
254 | |||
255 | |||
256 | break; |
||
257 | |||
258 | |||
259 | |||
260 | |||
261 | { |
||
262 | Prefix = "; "; |
||
263 | } |
||
264 | else if ((Gbl_HexOutputFlag == HEX_OUTPUT_C) || |
||
265 | (Gbl_HexOutputFlag == HEX_OUTPUT_ASL)) |
||
266 | { |
||
267 | Prefix = " * "; |
||
268 | } |
||
269 | break; |
||
270 | |||
271 | |||
272 | case ASL_FILE_C_INCLUDE_OUTPUT: |
||
273 | |||
274 | |||
275 | break; |
||
276 | |||
277 | |||
278 | /* No other output types supported */ |
||
279 | break; |
||
280 | } |
||
281 | |||
282 | |||
283 | |||
284 | |||
285 | NewTime = localtime (&Aclock); |
||
286 | |||
287 | |||
288 | "%sCompilation of \"%s\" - %s%s\n", |
||
289 | Prefix, Gbl_Files[ASL_FILE_INPUT].Filename, asctime (NewTime), |
||
290 | Prefix); |
||
291 | |||
292 | |||
293 | { |
||
294 | case ASL_FILE_C_SOURCE_OUTPUT: |
||
295 | case ASL_FILE_C_INCLUDE_OUTPUT: |
||
296 | FlPrintFile (FileId, " */\n"); |
||
297 | break; |
||
298 | |||
299 | |||
300 | /* Nothing to do for other output types */ |
||
301 | break; |
||
302 | } |
||
303 | } |
||
304 | |||
305 | |||
306 | |||
307 | * |
||
308 | * FUNCTION: CmFlushSourceCode |
||
309 | * |
||
310 | * PARAMETERS: None |
||
311 | * |
||
312 | * RETURN: None |
||
313 | * |
||
314 | * DESCRIPTION: Read in any remaining source code after the parse tree |
||
315 | * has been constructed. |
||
316 | * |
||
317 | ******************************************************************************/ |
||
318 | |||
319 | |||
320 | CmFlushSourceCode ( |
||
321 | void) |
||
322 | { |
||
323 | char Buffer; |
||
324 | |||
325 | |||
326 | |||
327 | { |
||
328 | InsertLineBuffer ((int) Buffer); |
||
329 | } |
||
330 | |||
331 | |||
332 | } |
||
333 | |||
334 | |||
335 | |||
336 | * |
||
337 | * FUNCTION: FlConsume* |
||
338 | * |
||
339 | * PARAMETERS: FileInfo - Points to an open input file |
||
340 | * |
||
341 | * RETURN: Number of lines consumed |
||
342 | * |
||
343 | * DESCRIPTION: Step over both types of comment during check for ascii chars |
||
344 | * |
||
345 | ******************************************************************************/ |
||
346 | |||
347 | |||
348 | FlConsumeAnsiComment ( |
||
349 | ASL_FILE_INFO *FileInfo, |
||
350 | ASL_FILE_STATUS *Status) |
||
351 | { |
||
352 | UINT8 Byte; |
||
353 | BOOLEAN ClosingComment = FALSE; |
||
354 | |||
355 | |||
356 | |||
357 | { |
||
358 | /* Scan until comment close is found */ |
||
359 | |||
360 | |||
361 | { |
||
362 | if (Byte == '/') |
||
363 | { |
||
364 | return; |
||
365 | } |
||
366 | |||
367 | |||
368 | { |
||
369 | /* Reset */ |
||
370 | |||
371 | |||
372 | } |
||
373 | } |
||
374 | else if (Byte == '*') |
||
375 | { |
||
376 | ClosingComment = TRUE; |
||
377 | } |
||
378 | |||
379 | |||
380 | |||
381 | |||
382 | { |
||
383 | Status->Line++; |
||
384 | } |
||
385 | |||
386 | |||
387 | } |
||
388 | } |
||
389 | |||
390 | |||
391 | |||
392 | FlConsumeNewComment ( |
||
393 | ASL_FILE_INFO *FileInfo, |
||
394 | ASL_FILE_STATUS *Status) |
||
395 | { |
||
396 | UINT8 Byte; |
||
397 | |||
398 | |||
399 | |||
400 | { |
||
401 | Status->Offset++; |
||
402 | |||
403 | |||
404 | |||
405 | |||
406 | { |
||
407 | Status->Line++; |
||
408 | return; |
||
409 | } |
||
410 | } |
||
411 | } |
||
412 | |||
413 | |||
414 | |||
415 | * |
||
416 | * FUNCTION: FlCheckForAscii |
||
417 | * |
||
418 | * PARAMETERS: FileInfo - Points to an open input file |
||
419 | * |
||
420 | * RETURN: Status |
||
421 | * |
||
422 | * DESCRIPTION: Verify that the input file is entirely ASCII. Ignores characters |
||
423 | * within comments. Note: does not handle nested comments and does |
||
424 | * not handle comment delimiters within string literals. However, |
||
425 | * on the rare chance this happens and an invalid character is |
||
426 | * missed, the parser will catch the error by failing in some |
||
427 | * spectactular manner. |
||
428 | * |
||
429 | ******************************************************************************/ |
||
430 | |||
431 | |||
432 | FlCheckForAscii ( |
||
433 | ASL_FILE_INFO *FileInfo) |
||
434 | { |
||
435 | UINT8 Byte; |
||
436 | ACPI_SIZE BadBytes = 0; |
||
437 | BOOLEAN OpeningComment = FALSE; |
||
438 | ASL_FILE_STATUS Status; |
||
439 | |||
440 | |||
441 | |||
442 | Status.Offset = 0; |
||
443 | |||
444 | |||
445 | |||
446 | |||
447 | { |
||
448 | /* Ignore comment fields (allow non-ascii within) */ |
||
449 | |||
450 | |||
451 | { |
||
452 | /* Check for second comment open delimiter */ |
||
453 | |||
454 | |||
455 | { |
||
456 | FlConsumeAnsiComment (FileInfo, &Status); |
||
457 | } |
||
458 | |||
459 | |||
460 | { |
||
461 | FlConsumeNewComment (FileInfo, &Status); |
||
462 | } |
||
463 | |||
464 | |||
465 | |||
466 | |||
467 | } |
||
468 | else if (Byte == '/') |
||
469 | { |
||
470 | OpeningComment = TRUE; |
||
471 | } |
||
472 | |||
473 | |||
474 | |||
475 | |||
476 | { |
||
477 | if (BadBytes < 10) |
||
478 | { |
||
479 | AcpiOsPrintf ( |
||
480 | "Non-ASCII character [0x%2.2X] found in line %u, file offset 0x%.2X\n", |
||
481 | Byte, Status.Line, Status.Offset); |
||
482 | } |
||
483 | |||
484 | |||
485 | } |
||
486 | |||
487 | |||
488 | |||
489 | |||
490 | { |
||
491 | Status.Line++; |
||
492 | } |
||
493 | |||
494 | |||
495 | } |
||
496 | |||
497 | |||
498 | |||
499 | |||
500 | |||
501 | |||
502 | |||
503 | |||
504 | { |
||
505 | AcpiOsPrintf ( |
||
506 | "%u non-ASCII characters found in input source text, could be a binary file\n", |
||
507 | BadBytes); |
||
508 | AslError (ASL_ERROR, ASL_MSG_NON_ASCII, NULL, FileInfo->Filename); |
||
509 | return (AE_BAD_CHARACTER); |
||
510 | } |
||
511 | |||
512 | |||
513 | |||
514 | |||
515 | } |
||
516 | |||
517 | |||
518 | |||
519 | * |
||
520 | * FUNCTION: CmDoCompile |
||
521 | * |
||
522 | * PARAMETERS: None |
||
523 | * |
||
524 | * RETURN: Status (0 = OK) |
||
525 | * |
||
526 | * DESCRIPTION: This procedure performs the entire compile |
||
527 | * |
||
528 | ******************************************************************************/ |
||
529 | |||
530 | |||
531 | CmDoCompile ( |
||
532 | void) |
||
533 | { |
||
534 | ACPI_STATUS Status; |
||
535 | UINT8 FullCompile; |
||
536 | UINT8 Event; |
||
537 | |||
538 | |||
539 | |||
540 | Event = UtBeginEvent ("Open input and output files"); |
||
541 | UtEndEvent (Event); |
||
542 | |||
543 | |||
544 | |||
545 | |||
546 | AslCompilerparse(); |
||
547 | UtEndEvent (Event); |
||
548 | |||
549 | |||
550 | |||
551 | |||
552 | CmFlushSourceCode (); |
||
553 | |||
554 | |||
555 | |||
556 | |||
557 | { |
||
558 | CmCleanupAndExit (); |
||
559 | return -1; |
||
560 | } |
||
561 | |||
562 | |||
563 | |||
564 | |||
565 | |||
566 | |||
567 | UtEndEvent (Event); |
||
568 | |||
569 | |||
570 | |||
571 | |||
572 | DbgPrint (ASL_DEBUG_OUTPUT, "\nParse tree transforms\n\n"); |
||
573 | TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, |
||
574 | TrAmlTransformWalk, NULL, NULL); |
||
575 | UtEndEvent (Event); |
||
576 | |||
577 | |||
578 | |||
579 | |||
580 | DbgPrint (ASL_DEBUG_OUTPUT, "\nGenerating AML opcodes\n\n"); |
||
581 | TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL, |
||
582 | OpcAmlOpcodeWalk, NULL); |
||
583 | UtEndEvent (Event); |
||
584 | |||
585 | |||
586 | * Now that the input is parsed, we can open the AML output file. |
||
587 | * Note: by default, the name of this file comes from the table descriptor |
||
588 | * within the input file. |
||
589 | */ |
||
590 | Event = UtBeginEvent ("Open AML output file"); |
||
591 | Status = FlOpenAmlOutputFile (Gbl_OutputFilenamePrefix); |
||
592 | if (ACPI_FAILURE (Status)) |
||
593 | { |
||
594 | AePrintErrorLog (ASL_FILE_STDERR); |
||
595 | return -1; |
||
596 | } |
||
597 | UtEndEvent (Event); |
||
598 | |||
599 | |||
600 | |||
601 | |||
602 | DbgPrint (ASL_DEBUG_OUTPUT, |
||
603 | "\nInterpreting compile-time constant expressions\n\n"); |
||
604 | TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, |
||
605 | OpcAmlConstantWalk, NULL, NULL); |
||
606 | UtEndEvent (Event); |
||
607 | |||
608 | |||
609 | |||
610 | |||
611 | DbgPrint (ASL_DEBUG_OUTPUT, |
||
612 | "\nUpdating AML opcodes after constant folding\n\n"); |
||
613 | TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, |
||
614 | NULL, OpcAmlOpcodeUpdateWalk, NULL); |
||
615 | UtEndEvent (Event); |
||
616 | |||
617 | |||
618 | |||
619 | |||
620 | DbgPrint (ASL_DEBUG_OUTPUT, "\nGenerating Package lengths\n\n"); |
||
621 | TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL, |
||
622 | LnPackageLengthWalk, NULL); |
||
623 | UtEndEvent (Event); |
||
624 | |||
625 | |||
626 | { |
||
627 | AePrintErrorLog (ASL_FILE_STDOUT); |
||
628 | UtDisplaySummary (ASL_FILE_STDOUT); |
||
629 | if (Gbl_DebugFlag) |
||
630 | { |
||
631 | /* Print error summary to the debug file */ |
||
632 | |||
633 | |||
634 | UtDisplaySummary (ASL_FILE_STDERR); |
||
635 | } |
||
636 | return 0; |
||
637 | } |
||
638 | |||
639 | |||
640 | * Create an internal namespace and use it as a symbol table |
||
641 | */ |
||
642 | |||
643 | |||
644 | |||
645 | |||
646 | Status = LdLoadNamespace (RootNode); |
||
647 | UtEndEvent (Event); |
||
648 | if (ACPI_FAILURE (Status)) |
||
649 | { |
||
650 | return -1; |
||
651 | } |
||
652 | |||
653 | |||
654 | |||
655 | |||
656 | Status = LkCrossReferenceNamespace (); |
||
657 | if (ACPI_FAILURE (Status)) |
||
658 | { |
||
659 | return -1; |
||
660 | } |
||
661 | |||
662 | |||
663 | |||
664 | |||
665 | UtEndEvent (AslGbl_NamespaceEvent); |
||
666 | |||
667 | |||
668 | * Semantic analysis. This can happen only after the |
||
669 | * namespace has been loaded and cross-referenced. |
||
670 | * |
||
671 | * part one - check control methods |
||
672 | */ |
||
673 | Event = UtBeginEvent ("Analyze control method return types"); |
||
674 | AnalysisWalkInfo.MethodStack = NULL; |
||
675 | |||
676 | |||
677 | TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE, |
||
678 | AnMethodAnalysisWalkBegin, |
||
679 | AnMethodAnalysisWalkEnd, &AnalysisWalkInfo); |
||
680 | UtEndEvent (Event); |
||
681 | |||
682 | |||
683 | |||
684 | |||
685 | DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - Method typing\n\n"); |
||
686 | TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE, |
||
687 | AnMethodTypingWalkBegin, |
||
688 | AnMethodTypingWalkEnd, NULL); |
||
689 | UtEndEvent (Event); |
||
690 | |||
691 | |||
692 | |||
693 | |||
694 | DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - Operand type checking\n\n"); |
||
695 | TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE, |
||
696 | AnOperandTypecheckWalkBegin, |
||
697 | AnOperandTypecheckWalkEnd, &AnalysisWalkInfo); |
||
698 | UtEndEvent (Event); |
||
699 | |||
700 | |||
701 | |||
702 | |||
703 | DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - miscellaneous\n\n"); |
||
704 | TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE, |
||
705 | AnOtherSemanticAnalysisWalkBegin, |
||
706 | AnOtherSemanticAnalysisWalkEnd, &AnalysisWalkInfo); |
||
707 | UtEndEvent (Event); |
||
708 | |||
709 | |||
710 | |||
711 | |||
712 | DbgPrint (ASL_DEBUG_OUTPUT, "\nGenerating Package lengths\n\n"); |
||
713 | TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL, |
||
714 | LnInitLengthsWalk, NULL); |
||
715 | TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL, |
||
716 | LnPackageLengthWalk, NULL); |
||
717 | UtEndEvent (Event); |
||
718 | |||
719 | |||
720 | |||
721 | |||
722 | CgGenerateAmlOutput (); |
||
723 | UtEndEvent (Event); |
||
724 | |||
725 | |||
726 | CmDoOutputFiles (); |
||
727 | UtEndEvent (Event); |
||
728 | |||
729 | |||
730 | CmCleanupAndExit (); |
||
731 | return 0; |
||
732 | } |
||
733 | |||
734 | |||
735 | |||
736 | * |
||
737 | * FUNCTION: CmDoOutputFiles |
||
738 | * |
||
739 | * PARAMETERS: None |
||
740 | * |
||
741 | * RETURN: None. |
||
742 | * |
||
743 | * DESCRIPTION: Create all "listing" type files |
||
744 | * |
||
745 | ******************************************************************************/ |
||
746 | |||
747 | |||
748 | CmDoOutputFiles ( |
||
749 | void) |
||
750 | { |
||
751 | |||
752 | |||
753 | |||
754 | |||
755 | LsDoHexOutput (); |
||
756 | |||
757 | |||
758 | |||
759 | |||
760 | } |
||
761 | |||
762 | |||
763 | |||
764 | * |
||
765 | * FUNCTION: CmDumpEvent |
||
766 | * |
||
767 | * PARAMETERS: Event - A compiler event struct |
||
768 | * |
||
769 | * RETURN: None. |
||
770 | * |
||
771 | * DESCRIPTION: Dump a compiler event struct |
||
772 | * |
||
773 | ******************************************************************************/ |
||
774 | |||
775 | |||
776 | CmDumpEvent ( |
||
777 | ASL_EVENT_INFO *Event) |
||
778 | { |
||
779 | UINT32 Delta; |
||
780 | UINT32 USec; |
||
781 | UINT32 MSec; |
||
782 | |||
783 | |||
784 | { |
||
785 | return; |
||
786 | } |
||
787 | |||
788 | |||
789 | |||
790 | |||
791 | |||
792 | |||
793 | MSec = Delta / 10000; |
||
794 | |||
795 | |||
796 | |||
797 | |||
798 | { |
||
799 | MSec++; |
||
800 | } |
||
801 | |||
802 | |||
803 | USec, MSec, Event->EventName); |
||
804 | } |
||
805 | |||
806 | |||
807 | |||
808 | * |
||
809 | * FUNCTION: CmCleanupAndExit |
||
810 | * |
||
811 | * PARAMETERS: None |
||
812 | * |
||
813 | * RETURN: None. |
||
814 | * |
||
815 | * DESCRIPTION: Close all open files and exit the compiler |
||
816 | * |
||
817 | ******************************************************************************/ |
||
818 | |||
819 | |||
820 | CmCleanupAndExit ( |
||
821 | void) |
||
822 | { |
||
823 | UINT32 i; |
||
824 | |||
825 | |||
826 | |||
827 | if (Gbl_DebugFlag) |
||
828 | { |
||
829 | /* Print error summary to the debug file */ |
||
830 | |||
831 | |||
832 | } |
||
833 | |||
834 | |||
835 | for (i = 0; i < AslGbl_NextEvent; i++) |
||
836 | { |
||
837 | CmDumpEvent (&AslGbl_Events[i]); |
||
838 | } |
||
839 | |||
840 | |||
841 | { |
||
842 | printf ("\nElapsed time for major events\n\n"); |
||
843 | for (i = 0; i < AslGbl_NextEvent; i++) |
||
844 | { |
||
845 | CmDumpEvent (&AslGbl_Events[i]); |
||
846 | } |
||
847 | |||
848 | |||
849 | printf ("%11u : %s\n", TotalParseNodes, "Parse nodes"); |
||
850 | printf ("%11u : %s\n", Gbl_NsLookupCount, "Namespace searches"); |
||
851 | printf ("%11u : %s\n", TotalNamedObjects, "Named objects"); |
||
852 | printf ("%11u : %s\n", TotalMethods, "Control methods"); |
||
853 | printf ("%11u : %s\n", TotalAllocations, "Memory Allocations"); |
||
854 | printf ("%11u : %s\n", TotalAllocated, "Total allocated memory"); |
||
855 | printf ("%11u : %s\n", TotalFolds, "Constant subtrees folded"); |
||
856 | printf ("\n"); |
||
857 | } |
||
858 | |||
859 | |||
860 | { |
||
861 | DbgPrint (ASL_DEBUG_OUTPUT, |
||
862 | "\n\nMiscellaneous compile statistics\n\n"); |
||
863 | |||
864 | |||
865 | "%32s : %u\n", "Total Namespace searches", |
||
866 | Gbl_NsLookupCount); |
||
867 | |||
868 | |||
869 | "%32s : %u usec\n", "Time per search", ((UINT32) |
||
870 | (AslGbl_Events[AslGbl_NamespaceEvent].EndTime - |
||
871 | AslGbl_Events[AslGbl_NamespaceEvent].StartTime) / 10) / |
||
872 | Gbl_NsLookupCount); |
||
873 | } |
||
874 | |||
875 | |||
876 | { |
||
877 | printf ("\nMaximum error count (%u) exceeded\n", |
||
878 | ASL_MAX_ERROR_COUNT); |
||
879 | } |
||
880 | |||
881 | |||
882 | |||
883 | |||
884 | |||
885 | |||
886 | { |
||
887 | FlCloseFile (i); |
||
888 | } |
||
889 | |||
890 | |||
891 | |||
892 | |||
893 | Gbl_Files[ASL_FILE_AML_OUTPUT].Handle) |
||
894 | { |
||
895 | if (remove (Gbl_Files[ASL_FILE_AML_OUTPUT].Filename)) |
||
896 | { |
||
897 | printf ("%s: ", |
||
898 | Gbl_Files[ASL_FILE_AML_OUTPUT].Filename); |
||
899 | perror ("Could not delete AML file"); |
||
900 | } |
||
901 | } |
||
902 | |||
903 | |||
904 | * Delete intermediate ("combined") source file (if -ls flag not set) |
||
905 | * |
||
906 | * TBD: SourceOutput should be .TMP, then rename if we want to keep it? |
||
907 | */ |
||
908 | if (!Gbl_SourceOutputFlag) |
||
909 | { |
||
910 | if (remove (Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename)) |
||
911 | { |
||
912 | printf ("%s: ", |
||
913 | Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename); |
||
914 | perror ("Could not delete SRC file"); |
||
915 | } |
||
916 | } |
||
917 | }>>>> |
||
918 |