net.sf.farrago.fennel.calc
Interface CalcRexAggImplementor

All Known Implementing Classes:
CalcRexImplementorTableImpl.AbstractCalcRexAggImplementor, CalcRexImplementorTableImpl.CountCalcRexImplementor, CalcRexImplementorTableImpl.FirstValueCalcRexImplementor, CalcRexImplementorTableImpl.HistogramAggRexImplementor, CalcRexImplementorTableImpl.LastValueCalcRexImplementor, CalcRexImplementorTableImpl.MinMaxCalcRexImplementor, CalcRexImplementorTableImpl.SumCalcRexImplementor, CalcRexImplementorTableImpl.SumEmptyIsZeroCalcRexImplementor

public interface CalcRexAggImplementor

Translates a call to an aggregate function to calculator assembly language.

Implementors are held in a CalcRexImplementorTable.

Since:
June 2nd, 2004
Version:
$Id: //open/dev/farrago/src/net/sf/farrago/fennel/calc/CalcRexAggImplementor.java#1 $
Author:
jhyde

Method Summary
 boolean canImplement(RexCall call)
          Returns whether this implementor can handle the given call.
 void implementAdd(RexCall call, CalcReg accumulatorRegister, RexToCalcTranslator translator)
          Generates instructions to add a new value to an aggregation.
 void implementDrop(RexCall call, CalcReg accumulatorRegister, RexToCalcTranslator translator)
          Generates instructions to implement this call, and returns the register which holds the result.
 void implementInitAdd(RexCall call, CalcReg accumulatorRegister, RexToCalcTranslator translator)
          Generates instructions to initialize and add a new value to an aggregation.
 void implementInitialize(RexCall call, CalcReg accumulatorRegister, RexToCalcTranslator translator)
          Generates instructions to initialize an accumulator for a call to this aggregate function, and returns the register which holds the accumulator.
 

Method Detail

implementInitialize

void implementInitialize(RexCall call,
                         CalcReg accumulatorRegister,
                         RexToCalcTranslator translator)
Generates instructions to initialize an accumulator for a call to this aggregate function, and returns the register which holds the accumulator.

For example, for SUM(x), this method generates O s8; V 0; T; MOVE O0, C0; and returns the O0 register.

Parameters:
call - The call to the aggregate function to be implemented
accumulatorRegister - The accumulator register to be populated
translator - Calculator code generator

implementAdd

void implementAdd(RexCall call,
                  CalcReg accumulatorRegister,
                  RexToCalcTranslator translator)
Generates instructions to add a new value to an aggregation.

For example, for SUM(x), this method generates I s8; O s8; T; ADD O0, I0;.

Parameters:
call - The call to the aggregate function to be implemented
accumulatorRegister - The accumulator register
translator - Calculator code generator

implementInitAdd

void implementInitAdd(RexCall call,
                      CalcReg accumulatorRegister,
                      RexToCalcTranslator translator)
Generates instructions to initialize and add a new value to an aggregation. This could call implementInitialize followed by implementAdd

Parameters:
call - The call to the aggregate function to be implemented
accumulatorRegister - The accumulator register
translator - Calculator code generator

implementDrop

void implementDrop(RexCall call,
                   CalcReg accumulatorRegister,
                   RexToCalcTranslator translator)
Generates instructions to implement this call, and returns the register which holds the result.

For example, for SUM(x), this method generates I s8; O s8; T; SUB O0, I0;

Parameters:
call - The call to the aggregate function to be implemented.
accumulatorRegister - The accumulator register
translator - Calculator code generator

canImplement

boolean canImplement(RexCall call)
Returns whether this implementor can handle the given call.

Parameters:
call - The call to the aggregate function to be implemented