GCC Middle and Back End API Reference
algorithm Struct Reference

#include <expmed.h>

Collaboration diagram for algorithm:

Data Fields

struct mult_cost cost
short ops
enum alg_code op [MAX_BITS_PER_WORD]
char log [MAX_BITS_PER_WORD]

Detailed Description

This structure records a sequence of operations. `ops' is the number of operations recorded. `cost' is their total cost. The operations are stored in `op' and the corresponding logarithms of the integer coefficients in `log'.

These are the operations: alg_zero total := 0; alg_m total := multiplicand; alg_shift total := total * coeff alg_add_t_m2 total := total + multiplicand * coeff; alg_sub_t_m2 total := total - multiplicand * coeff; alg_add_factor total := total * coeff + total; alg_sub_factor total := total * coeff - total; alg_add_t2_m total := total * coeff + multiplicand; alg_sub_t2_m total := total * coeff - multiplicand;

The first operand must be either alg_zero or alg_m.


Field Documentation

struct mult_cost algorithm::cost
char algorithm::log[MAX_BITS_PER_WORD]
enum alg_code algorithm::op[MAX_BITS_PER_WORD]

The size of the OP and LOG fields are not directly related to the word size, but the worst-case algorithms will be if we have few consecutive ones or zeros, i.e., a multiplicand like 10101010101... In that case we will generate shift-by-2, add, shift-by-2, add,..., in total wordsize operations.

short algorithm::ops

The documentation for this struct was generated from the following file: