C# Class ABT.LogicalOr

Left || Right: can only take scalars (to compare with 0). After semantic analysis, each operand can only be long, ulong, float, double. Pointers are casted to ulongs. if Left != 0: return 1 else: return Right != 0 Generate the assembly in this fashion, then every route would only have one jump. +---------+ 1 | cmp lhs |-------+ +---------+ | | | | 0 | | | +----+----+ 1 | | cmp rhs |-------+ +---------+ | | | | 0 | | | +----+----+ | | eax = 0 | | +---------+ | | | +---------+ | | | | +------------+ label_set | | | +---------+ | | eax = 1 | | +---------+ | | +---------+ label_finish |
Afficher le fichier Open project: phisiart/C-Compiler

Méthodes publiques

Méthode Description
CGenValue ( CGenState state ) : System.Reg
LogicalOr ( Expr left, Expr right ) : System

Method Details

CGenValue() public méthode

public CGenValue ( CGenState state ) : System.Reg
state CodeGeneration.CGenState
Résultat System.Reg

LogicalOr() public méthode

public LogicalOr ( Expr left, Expr right ) : System
left Expr
right Expr
Résultat System