]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: Remove the redundant __FLEXIBLE_SIZE from PcdValueInit.c
authorBob Feng <bob.c.feng@intel.com>
Tue, 15 Mar 2022 12:16:54 +0000 (20:16 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Sat, 26 Mar 2022 02:32:06 +0000 (02:32 +0000)
For the multiple SKU case, basetools generates multiple redundant
__FLEXIBLE_SIZE statement that is from the same line in dsc file.

This behavior causes the generated PcdValueInit.c file to have huge size,
and the compilation time is very long.

This patch is going to fix this issue.

Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Reviewed-by: Yuwei Chen <yuwei.chen@intel.com>
BaseTools/Source/Python/Workspace/DscBuildData.py

index d29b9bf13dbaa862a208f4518c680e5452238be4..fc1e773417de26039e7840da58f1fa93312dd5cc 100644 (file)
@@ -1876,6 +1876,7 @@ class DscBuildData(PlatformBuildClassObject):
                     while '[' in FieldName and not Pcd.IsArray():\r
                         FieldName = FieldName.rsplit('[', 1)[0]\r
                         CApp = CApp + '  __FLEXIBLE_SIZE(*Size, %s, %s, %d); // From %s Line %d Value %s\n' % (Pcd.DatumType, FieldName.strip("."), Array_Index + 1, FieldList[FieldName_ori][1], FieldList[FieldName_ori][2], FieldList[FieldName_ori][0])\r
+        flexisbale_size_statement_cache = set()\r
         for skuname in Pcd.SkuOverrideValues:\r
             if skuname == TAB_COMMON:\r
                 continue\r
@@ -1888,6 +1889,10 @@ class DscBuildData(PlatformBuildClassObject):
                         if not FieldList:\r
                             continue\r
                         for FieldName in FieldList:\r
+                            fieldinfo = tuple(FieldList[FieldName])\r
+                            if fieldinfo in flexisbale_size_statement_cache:\r
+                                continue\r
+                            flexisbale_size_statement_cache.add(fieldinfo)\r
                             FieldName = "." + FieldName\r
                             IsArray = _IsFieldValueAnArray(FieldList[FieldName.strip(".")][0])\r
                             if IsArray and not (FieldList[FieldName.strip(".")][0].startswith('{GUID') and FieldList[FieldName.strip(".")][0].endswith('}')):\r