kernel/acpica/compiler/aslparseop.c
/*******************************************************************************
 *
 * FUNCTION:    TrCreateTargetOp
 *
 * PARAMETERS:  OriginalOp          - Op to be copied
 *
 * RETURN:      Pointer to the new op. Aborts on allocation failure
 *
 * DESCRIPTION: Copy an existing op (and subtree). Used in ASL+ (C-style)
 *              expressions where the target is the same as one of the
 *              operands. A new op and subtree must be created from the
 *              original so that the parse tree can be linked properly.
 *
 * NOTE:        This code is specific to target operands that are the last
 *              operand in an ASL/AML operator. Meaning that the top-level
 *              parse Op in a possible subtree has a NULL Next pointer.
 *              This simplifies the recursion.
 *
 *              Subtree example:
 *                  DeRefOf (Local1) += 32
 *
 *              This gets converted to:
 *                  Add (DeRefOf (Local1), 32, DeRefOf (Local1))
 *
 *              Each DeRefOf has a single child, Local1. Even more complex
 *              subtrees can be created via the Index and DeRefOf operators.
 *
 ******************************************************************************/
TrCreateTargetOp
PARAMETERS:  OriginalOp          - Op to be copied

Pointer to the new op. Aborts on allocation failure

Copy an existing op (and subtree). Used in ASL+ (C-style)
expressions where the target is the same as one of the
operands. A new op and subtree must be created from the
original so that the parse tree can be linked properly.

This code is specific to target operands that are the last
operand in an ASL/AML operator. Meaning that the top-level
parse Op in a possible subtree has a NULL Next pointer.
This simplifies the recursion.

Subtree example:
DeRefOf (Local1) += 32

This gets converted to:
Add (DeRefOf (Local1), 32, DeRefOf (Local1))

Each DeRefOf has a single child, Local1. Even more complex
subtrees can be created via the Index and DeRefOf operators.
TrCreateTargetOp PARAMETERS : OriginalOp - Op to be copied Pointer to the new op . Aborts on allocation failure Copy an existing op ( and subtree ) . Used in ASL + ( C - style ) expressions where the target is the same as one of the operands . A new op and subtree must be created from the original so that the parse tree can be linked properly . This code is specific to target operands that are the last operand in an ASL / AML operator . Meaning that the top - level parse Op in a possible subtree has a NULL Next pointer . This simplifies the recursion . Subtree example : DeRefOf ( Local1 ) + = 32 This gets converted to : Add ( DeRefOf ( Local1 ) 32 DeRefOf ( Local1 )) Each DeRefOf has a single child Local1 . Even more complex subtrees can be created via the Index and DeRefOf operators .
ACPI_PARSE_OBJECT *
TrCreateTargetOp (
    ACPI_PARSE_OBJECT       *OriginalOp,
    ACPI_PARSE_OBJECT       *ParentOp)
{
    ACPI_PARSE_OBJECT       *Op;
    if (!OriginalOp)
    {
        return (NULL);
    }
    Op = TrGetOpFromCache ();
    Op->Asl.Value               = OriginalOp->Asl.Value;
    Op->Asl.Filename            = OriginalOp->Asl.Filename;
    Op->Asl.LineNumber          = OriginalOp->Asl.LineNumber;
    Op->Asl.LogicalLineNumber   = OriginalOp->Asl.LogicalLineNumber;
    Op->Asl.LogicalByteOffset   = OriginalOp->Asl.LogicalByteOffset;
    Op->Asl.Column              = OriginalOp->Asl.Column;
    Op->Asl.Flags               = OriginalOp->Asl.Flags;
    Op->Asl.CompileFlags        = OriginalOp->Asl.CompileFlags;
    Op->Asl.AmlOpcode           = OriginalOp->Asl.AmlOpcode;
    Op->Asl.ParseOpcode         = OriginalOp->Asl.ParseOpcode;
    Op->Asl.Parent              = ParentOp;
    UtSetParseOpName (Op);
    if (OriginalOp->Asl.Child)
    {
        Op->Asl.Child = TrCreateTargetOp (OriginalOp->Asl.Child, Op);
    }
    if (OriginalOp->Asl.Next) 
    {
        Op->Asl.Next = TrCreateTargetOp (OriginalOp->Asl.Next, ParentOp);
    }
    return (Op);
}
ACPI_PARSE_OBJECT * TrCreateTargetOp ( ACPI_PARSE_OBJECT * OriginalOp , ACPI_PARSE_OBJECT * ParentOp ) { ACPI_PARSE_OBJECT * Op ; if ( ! OriginalOp ) { return ( NULL ) ; } Op = TrGetOpFromCache ( ) ; Op -> Asl . Value = OriginalOp -> Asl . Value ; Op -> Asl . Filename = OriginalOp -> Asl . Filename ; Op -> Asl . LineNumber = OriginalOp -> Asl . LineNumber ; Op -> Asl . LogicalLineNumber = OriginalOp -> Asl . LogicalLineNumber ; Op -> Asl . LogicalByteOffset = OriginalOp -> Asl . LogicalByteOffset ; Op -> Asl . Column = OriginalOp -> Asl . Column ; Op -> Asl . Flags = OriginalOp -> Asl . Flags ; Op -> Asl . CompileFlags = OriginalOp -> Asl . CompileFlags ; Op -> Asl . AmlOpcode = OriginalOp -> Asl . AmlOpcode ; Op -> Asl . ParseOpcode = OriginalOp -> Asl . ParseOpcode ; Op -> Asl . Parent = ParentOp ; UtSetParseOpName ( Op ) ; if ( OriginalOp -> Asl . Child ) { Op -> Asl . Child = TrCreateTargetOp ( OriginalOp -> Asl . Child , Op ) ; } if ( OriginalOp -> Asl . Next ) { Op -> Asl . Next = TrCreateTargetOp ( OriginalOp -> Asl . Next , ParentOp ) ; } return ( Op ) ; }
FUNCTION:    TrCreateTargetOp
 PARAMETERS:  OriginalOp          - Op to be copied
FUNCTION : TrCreateTargetOp PARAMETERS : OriginalOp - Op to be copied
/* Copy the pertinent values (omit link pointer fields) */ /* Copy a possible subtree below this op */ /* Null for top-level op */