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 |
Datei anzeigen Open project: phisiart/C-Compiler

Public Methods

Method Description
CGenValue ( CGenState state ) : System.Reg
LogicalOr ( Expr left, Expr right ) : System

Method Details

CGenValue() public method

public CGenValue ( CGenState state ) : System.Reg
state CodeGeneration.CGenState
return System.Reg

LogicalOr() public method

public LogicalOr ( Expr left, Expr right ) : System
left Expr
right Expr
return System