Deleted Added
full compact
asltransform.c (151937) asltransform.c (167802)
1
2/******************************************************************************
3 *
4 * Module Name: asltransform - Parse tree transforms
1
2/******************************************************************************
3 *
4 * Module Name: asltransform - Parse tree transforms
5 * $Revision: 1.35 $
5 * $Revision: 1.42 $
6 *
7 *****************************************************************************/
8
9/******************************************************************************
10 *
11 * 1. Copyright Notice
12 *
6 *
7 *****************************************************************************/
8
9/******************************************************************************
10 *
11 * 1. Copyright Notice
12 *
13 * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
13 * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
14 * All rights reserved.
15 *
16 * 2. License
17 *
18 * 2.1. This is your license from Intel Corp. under its intellectual property
19 * rights. You may have additional license terms from the party that provided
20 * you this software, covering your right to use that party's intellectual
21 * property rights.

--- 402 unchanged lines hidden (view full) ---

424 Next = Next->Asl.Next;
425 if (i == 0)
426 {
427 /*
428 * This is the table signature. Only the DSDT can be assumed
429 * to be at the root of the namespace; Therefore, namepath
430 * optimization can only be performed on the DSDT.
431 */
14 * All rights reserved.
15 *
16 * 2. License
17 *
18 * 2.1. This is your license from Intel Corp. under its intellectual property
19 * rights. You may have additional license terms from the party that provided
20 * you this software, covering your right to use that party's intellectual
21 * property rights.

--- 402 unchanged lines hidden (view full) ---

424 Next = Next->Asl.Next;
425 if (i == 0)
426 {
427 /*
428 * This is the table signature. Only the DSDT can be assumed
429 * to be at the root of the namespace; Therefore, namepath
430 * optimization can only be performed on the DSDT.
431 */
432 if (ACPI_STRNCMP (Next->Asl.Value.String, "DSDT", 4))
432 if (!ACPI_COMPARE_NAME (Next->Asl.Value.String, ACPI_SIG_DSDT))
433 {
434 Gbl_ReferenceOptimizationFlag = FALSE;
435 }
436 }
437 }
438
439 Gbl_FirstLevelInsertionNode = Next;
440}

--- 215 unchanged lines hidden (view full) ---

656 }
657 }
658 else if (Next->Asl.ParseOpcode == PARSEOP_DEFAULT)
659 {
660 if (DefaultOp)
661 {
662 /*
663 * More than one Default
433 {
434 Gbl_ReferenceOptimizationFlag = FALSE;
435 }
436 }
437 }
438
439 Gbl_FirstLevelInsertionNode = Next;
440}

--- 215 unchanged lines hidden (view full) ---

656 }
657 }
658 else if (Next->Asl.ParseOpcode == PARSEOP_DEFAULT)
659 {
660 if (DefaultOp)
661 {
662 /*
663 * More than one Default
664 * (Parser should catch this, should not get here)
664 * (Parser does not catch this, must check here)
665 */
665 */
666 AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, Next,
667 "Found more than one Default()");
666 AslError (ASL_ERROR, ASL_MSG_MULTIPLE_DEFAULT, Next, NULL);
668 }
667 }
668 else
669 {
670 /* Save the DEFAULT node for later, after CASEs */
669
671
670 /* Save the DEFAULT node for later, after CASEs */
671
672 DefaultOp = Next;
672 DefaultOp = Next;
673 }
673 }
674 else
675 {
676 /* Unknown peer opcode */
677
678 AcpiOsPrintf ("Unknown parse opcode for switch statement: %s (%d)\n",
679 Next->Asl.ParseOpName, Next->Asl.ParseOpcode);
680 }

--- 22 unchanged lines hidden (view full) ---

703 }
704 }
705
706 if (!CaseOp)
707 {
708 AslError (ASL_ERROR, ASL_MSG_NO_CASES, StartNode, NULL);
709 }
710
674 }
675 else
676 {
677 /* Unknown peer opcode */
678
679 AcpiOsPrintf ("Unknown parse opcode for switch statement: %s (%d)\n",
680 Next->Asl.ParseOpName, Next->Asl.ParseOpcode);
681 }

--- 22 unchanged lines hidden (view full) ---

704 }
705 }
706
707 if (!CaseOp)
708 {
709 AslError (ASL_ERROR, ASL_MSG_NO_CASES, StartNode, NULL);
710 }
711
712
711 /*
713 /*
712 * Add a NAME node for the temp integer:
713 * Change the SWITCH node to a Name (_T_x, Type)
714 * Create a Name(_T_x, ...) statement. This statement must appear at the
715 * method level, in case a loop surrounds the switch statement and could
716 * cause the name to be created twice (error).
714 */
717 */
718
719 /* Create the Name node */
720
715 Predicate = StartNode->Asl.Child;
721 Predicate = StartNode->Asl.Child;
716 TrAmlInitNode (StartNode, PARSEOP_NAME);
722 NewOp = TrCreateLeafNode (PARSEOP_NAME);
717
723
718 NewOp = StartNode;
724 /* Find the parent method */
719
725
726 Next = StartNode;
727 while ((Next->Asl.ParseOpcode != PARSEOP_METHOD) &&
728 (Next->Asl.ParseOpcode != PARSEOP_DEFINITIONBLOCK))
729 {
730 Next = Next->Asl.Parent;
731 }
732
720 NewOp->Asl.CompileFlags |= NODE_COMPILER_EMITTED;
733 NewOp->Asl.CompileFlags |= NODE_COMPILER_EMITTED;
734 NewOp->Asl.Parent = Next;
721
735
736 /* Insert name after the method name and arguments */
737
738 Next = Next->Asl.Child;
739 Next = Next->Asl.Next;
740 Next = Next->Asl.Next;
741 Next = Next->Asl.Next;
742 Next = Next->Asl.Next;
743 Next = Next->Asl.Next;
744
745 TrAmlInsertPeer (Next, NewOp);
746 TrAmlInitLineNumbers (NewOp, Next);
747
748 /* Create the NameSeg child for the Name node */
749
722 NewOp2 = TrCreateValuedLeafNode (PARSEOP_NAMESEG,
723 (ACPI_INTEGER) ACPI_TO_INTEGER (PredicateValueName));
724 NewOp2->Asl.CompileFlags |= NODE_IS_NAME_DECLARATION;
725 NewOp->Asl.Child = NewOp2;
726
750 NewOp2 = TrCreateValuedLeafNode (PARSEOP_NAMESEG,
751 (ACPI_INTEGER) ACPI_TO_INTEGER (PredicateValueName));
752 NewOp2->Asl.CompileFlags |= NODE_IS_NAME_DECLARATION;
753 NewOp->Asl.Child = NewOp2;
754
727 /* Btype was already validated above */
755 /* Create the initial value for the Name. Btype was already validated above */
728
729 switch (Btype)
730 {
731 case ACPI_BTYPE_INTEGER:
756
757 switch (Btype)
758 {
759 case ACPI_BTYPE_INTEGER:
732 NewOp2->Asl.Next = TrCreateValuedLeafNode (PARSEOP_ZERO,
760 NewOp2->Asl.Next = TrCreateValuedLeafNode (PARSEOP_ZERO,
733 (ACPI_INTEGER) 0);
734 break;
735
736 case ACPI_BTYPE_STRING:
737 NewOp2->Asl.Next = TrCreateValuedLeafNode (PARSEOP_STRING_LITERAL,
738 (ACPI_INTEGER) "");
739 break;
740

--- 11 unchanged lines hidden (view full) ---

752
753 default:
754 break;
755 }
756
757 TrAmlSetSubtreeParent (NewOp2, NewOp);
758
759 /*
761 (ACPI_INTEGER) 0);
762 break;
763
764 case ACPI_BTYPE_STRING:
765 NewOp2->Asl.Next = TrCreateValuedLeafNode (PARSEOP_STRING_LITERAL,
766 (ACPI_INTEGER) "");
767 break;
768

--- 11 unchanged lines hidden (view full) ---

780
781 default:
782 break;
783 }
784
785 TrAmlSetSubtreeParent (NewOp2, NewOp);
786
787 /*
760 * Create and insert a new Store() node which will be used to save the
788 * Transform the Switch() into a Store() node which will be used to save the
761 * Switch() value. The store is of the form: Store (Value, _T_x)
762 * where _T_x is the temp variable.
763 */
789 * Switch() value. The store is of the form: Store (Value, _T_x)
790 * where _T_x is the temp variable.
791 */
764 Next = TrCreateLeafNode (PARSEOP_STORE);
765 TrAmlInsertPeer (StartNode, Next);
766 TrAmlSetSubtreeParent (Next, StartNode->Asl.Parent);
792 TrAmlInitNode (StartNode, PARSEOP_STORE);
793 StartNode->Asl.Child = NULL;
767
794
768 TrAmlInitLineNumbers (Next, StartNode);
769 TrAmlInitLineNumbers (NewOp2, StartNode);
770 TrAmlInitLineNumbers (NewOp2->Asl.Next, StartNode);
771
772 /* Complete the Store subtree */
773
795 /* Complete the Store subtree */
796
774 Next->Asl.Child = Predicate;
775 Predicate->Asl.Parent = Next;
797 StartNode->Asl.Child = Predicate;
798 Predicate->Asl.Parent = StartNode;
776
777 NewOp = TrCreateValuedLeafNode (PARSEOP_NAMESEG,
778 (ACPI_INTEGER) ACPI_TO_INTEGER (PredicateValueName));
799
800 NewOp = TrCreateValuedLeafNode (PARSEOP_NAMESEG,
801 (ACPI_INTEGER) ACPI_TO_INTEGER (PredicateValueName));
779 NewOp->Asl.Parent = Next;
802 NewOp->Asl.Parent = StartNode;
780 Predicate->Asl.Next = NewOp;
781}
782
783
803 Predicate->Asl.Next = NewOp;
804}
805
806