summaryrefslogtreecommitdiff
path: root/source/compiler/asloperands.c
diff options
context:
space:
mode:
authorRobert Moore <Robert.Moore@intel.com>2018-08-14 08:53:51 -0700
committerRobert Moore <Robert.Moore@intel.com>2018-08-14 08:53:51 -0700
commit201ec890363b280f98b5cb9c8ed741a6167645c3 (patch)
tree2721be6be29b116d848f561b886bf673b0e4ca80 /source/compiler/asloperands.c
parenta012a821bf636c79d3797ddac1d38144fee60abe (diff)
downloadacpica-201ec890363b280f98b5cb9c8ed741a6167645c3.tar.gz
iASL: Add remark for unnecessary Offset() operators
If the Offset() value is the same as the current offset within the field, the operator is redundant and unnecessary. The iASL optimizer will eliminate the operator, but a remark will inform the user that something is wrong or at best, a waste.
Diffstat (limited to 'source/compiler/asloperands.c')
-rw-r--r--source/compiler/asloperands.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/source/compiler/asloperands.c b/source/compiler/asloperands.c
index 1d1a1a94b..5bfba4e82 100644
--- a/source/compiler/asloperands.c
+++ b/source/compiler/asloperands.c
@@ -429,14 +429,27 @@ OpnDoFieldCommon (
Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
PkgLengthNode->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
}
- else if ((NewBitOffset == CurrentBitOffset) && Gbl_OptimizeTrivialParseNodes)
+ else if (NewBitOffset == CurrentBitOffset)
{
/*
- * Offset is redundant; we don't need to output an
- * offset opcode. Just set these nodes to default
+ * This Offset() operator is redundant and not needed,
+ * because the offset value is the same as the current
+ * offset within the field.
*/
- Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
- PkgLengthNode->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
+ AslError (ASL_REMARK, ASL_MSG_OFFSET, PkgLengthNode, NULL);
+
+ if (Gbl_OptimizeTrivialParseNodes)
+ {
+ /*
+ * Optimize this Offset() operator by removing/ignoring
+ * it. Set the related nodes to default.
+ */
+ Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
+ PkgLengthNode->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
+
+ AslError (ASL_OPTIMIZATION, ASL_MSG_OFFSET, PkgLengthNode,
+ "Optimizer has removed statement");
+ }
}
else
{