public override void Visit(AmlParser.DefIfElse defIfElse) { LoadTimeEvaluateVisitor visitor = new LoadTimeEvaluateVisitor(acpiNamespace, currentPath); defIfElse.predicate.integer.Accept(visitor); if (visitor.Result.GetAsInt().Value != 0) { foreach (TermObj termObj in defIfElse.termList) { termObj.Accept(this); } } else if (defIfElse.defElse.termList != null) { foreach (TermObj termObj in defIfElse.defElse.termList) { termObj.Accept(this); } } }
public override void Visit(AmlParser.DefIfElse defIfElse) { // We create a sequence like this: // (push predicate) // jump if nonzero to thenBranch // (else branch instructions) // jump to end // elseBranch: // (then branch instructions) // end: defIfElse.predicate.Accept(this); JumpIfNonZero thenJump = new JumpIfNonZero(); result.Add(thenJump); defIfElse.defElse.Accept(this); Jump jumpOverThenBrach = new Jump(); result.Add(jumpOverThenBrach); thenJump.ThenTarget = result.Count; VisitSequence(defIfElse.termList); jumpOverThenBrach.Target = result.Count; }
public override void Visit(AmlParser.DefIfElse defIfElse) { // // Load-time Ifs are both rare and tricky, because it makes the // two-phase model here unworkable: we can't let the NamesVisitor // visit the if body before the truth value of its predicate is // known, but this may depend on values filled in by the ValuesVisitor. // Being an exceptional case, we just have the NamesVisitor always // visit both branches, which works for the examples I've come across // like the AMD with Infineon TPM. // foreach (TermObj termObj in defIfElse.termList) { termObj.Accept(this); } if (defIfElse.defElse.termList != null) { foreach (TermObj termObj in defIfElse.defElse.termList) { termObj.Accept(this); } } }
public virtual void Visit(AmlParser.DefIfElse defIfElse) { UnhandledNodeType("DefIfElse"); }