mirror of https://github.com/acidanthera/audk.git
BaseTools: refactor Depex optomization
No need to make a list from the set. just pop the item off. Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
This commit is contained in:
parent
c5c7e68a91
commit
cf3062901d
|
@ -271,10 +271,14 @@ class DependencyExpression:
|
||||||
|
|
||||||
## Simply optimize the dependency expression by removing duplicated operands
|
## Simply optimize the dependency expression by removing duplicated operands
|
||||||
def Optimize(self):
|
def Optimize(self):
|
||||||
ValidOpcode = list(set(self.OpcodeList))
|
OpcodeSet = set(self.OpcodeList)
|
||||||
if len(ValidOpcode) != 1 or ValidOpcode[0] not in [DEPEX_OPCODE_AND, DEPEX_OPCODE_OR]:
|
# if there are isn't one in the set, return
|
||||||
|
if len(OpcodeSet) != 1:
|
||||||
|
return
|
||||||
|
Op = OpcodeSet.pop()
|
||||||
|
#if Op isn't either OR or AND, return
|
||||||
|
if Op not in [DEPEX_OPCODE_AND, DEPEX_OPCODE_OR]:
|
||||||
return
|
return
|
||||||
Op = ValidOpcode[0]
|
|
||||||
NewOperand = []
|
NewOperand = []
|
||||||
AllOperand = set()
|
AllOperand = set()
|
||||||
for Token in self.PostfixNotation:
|
for Token in self.PostfixNotation:
|
||||||
|
|
Loading…
Reference in New Issue