Skip to content

Commit

Permalink
iASL: Enhancement for constant folding.
Browse files Browse the repository at this point in the history
Add support to fold expressions with a target operand -- these are
folded and converted to a Store operator:

Add (4, 3, INT1) --> Store (7, INT1)

Also supports ASL+ constructs:

INT1 = 4 + 3 --> Store (7, INT1)
  • Loading branch information
acpibob committed Mar 12, 2015
1 parent f5d2ff3 commit 4f9e950
Show file tree
Hide file tree
Showing 8 changed files with 650 additions and 334 deletions.
12 changes: 10 additions & 2 deletions source/compiler/aslcompile.c
Expand Up @@ -267,8 +267,16 @@ CmDoCompile (
Event = UtBeginEvent ("Constant folding via AML interpreter");
DbgPrint (ASL_DEBUG_OUTPUT,
"\nInterpreting compile-time constant expressions\n\n");
TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD,
OpcAmlConstantWalk, NULL, NULL);

if (Gbl_FoldConstants)
{
TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD,
OpcAmlConstantWalk, NULL, NULL);
}
else
{
DbgPrint (ASL_PARSE_OUTPUT, " Optional folding disabled\n");
}
UtEndEvent (Event);

/* Update AML opcodes if necessary, after constant folding */
Expand Down
8 changes: 8 additions & 0 deletions source/compiler/aslcompiler.h
Expand Up @@ -757,6 +757,10 @@ ACPI_PARSE_OBJECT *
TrAllocateNode (
UINT32 ParseOpcode);

void
TrPrintNodeCompileFlags (
UINT32 Flags);

void
TrReleaseNode (
ACPI_PARSE_OBJECT *Op);
Expand All @@ -776,6 +780,10 @@ ACPI_PARSE_OBJECT *
TrCreateLeafNode (
UINT32 ParseOpcode);

ACPI_PARSE_OBJECT *
TrCreateNullTarget (
void);

ACPI_PARSE_OBJECT *
TrCreateAssignmentNode (
ACPI_PARSE_OBJECT *Target,
Expand Down

0 comments on commit 4f9e950

Please sign in to comment.