Operation.xcc

Benoit Dupont de Dinechin (Benoit.Dupont-de-Dinechinst.com). Christophe Guillon (Christophe.Guillonst.com).

Copyright 2002 - 2007 STMicroelectronics.

Copyright 1995 - 1998 Commissariat a l'Energie Atomique. This program is free software; you can redistribute it and/or modify it under the terms of either (at your option): the GNU General Public License (GPL) version 2; the GNU Lesser General Public License (LGPL) version 2.1; any later version of these licences as published by the Free Software Foundation.

Operation_Factory— IndexedFactory for Operation(s).
extern IndexedFactory_ Operation_Factory[1];
OperationFlag— Enumerates the Operation flags.
typedef enum {
  OperationFlag_PartialDef = 0x1,       // Operation is partial definition.
  OperationFlag_SpillCode = 0x2,        // Operation is spill code.
  OperationFlag_Volatile = 0x4,         // Operation has volatile effects.
  OperationFlag_SPUpdate = 0x8,         // Operation is a SP update.
  OperationFlag_Prefetch = 0x10,        // Operation is a memory prefetch.
  OperationFlag_Preload = 0x20,         // Operation is a memory preload.
  OperationFlag_Barrier = 0x40,         // Operation is a memory barrier.
  OperationFlag_Clobber = 0x80,         // Operation has a clobber RegisterSet.
  OperationFlag_Hoisted = 0x100,        // Operation has been hoisted from loop.
  OperationFlag_DeadCode = 0x200,       // Operation is dead code.
  OperationFlag_Processed = 0x400,      // Operation is has been processed (PHI).
  OperationFlag_SafeAccess = 0x800,     // Operation is safe for side-effects.
  OperationFlag_SafePerfs = 0x1000,     // Operation is safe for performances.
  OperationFlag_EntryCode = 0x4000,     // Operation is part of Procedure entry.
  OperationFlag_ExitCode = 0x8000,      // Operation is part of Procedure exit.
} enum_OperationFlag;
typedef uint16_t OperationFlags;
OperationUnion— Union for the variant part of Operation.
union OperationUnion_ {
  int32_t MAXCOUNT;                     // Maximum count of parallel copy arguments and results.
  struct VariableClass_ *COLOR;         // Color of a PHI-Operation.
  struct Effect_ *MAINEFFECTS;          // This Operation main Effect(s).
};
typedef union OperationUnion_ OperationUnion_, *OperationUnion;
Operation— Represent an instruction in the compiler intermediate representation.
struct Operation_ {
  //@args       Operator operator, int32_t resCount, int32_t arcCount,
  //@args       const_RegisterSet clobberSet, struct BasicBlock_ *basicBlock
  Indexed_ __;                  // An Operation_ ISA Indexed_.
  //@access IDENTITY    Indexed_IDENTITY(Operation____(this))
  //@access INDEX       Indexed_INDEX(Operation____(this))
  //@mutate INDEX       Indexed__INDEX(Operation____(this))
  const struct Operation_ *REPLICATED;  // Operation this Operation was replicated from.
  struct BasicBlock_ *BASICBLOCK;       // BasicBlock this Operation belongs to.
  InstructionTask TASK;                 // InstructionTask for scheduling.
  //@access INSTRUCTION (Instruction)Operation_TASK(this)
  //@mutate INSTRUCTION (Instruction*)Operation__TASK(this)
  //@access ISSUEITEM   (struct IssueItem_ *)Operation_TASK(this)
  //@mutate ISSUEITEM   (struct IssueItem_ **)Operation__TASK(this)
  //@access isInductive         InstructionTask_isInductive(Operation_TASK(this))
  //@access isSpeculable        InstructionTask_isSpeculable(Operation_TASK(this))
  //@access isCompensable       InstructionTask_isCompensable(Operation_TASK(this))
  Operator OPERATOR;            // Operator of this Operation.
  OperationFlags FLAGS;         // Operation flags.
  //@access isPartialDef        ((Operation_flags(this) & OperationFlag_PartialDef) != 0)
  //@access isSpillCode         ((Operation_flags(this) & OperationFlag_SpillCode) != 0)
  //@access isVolatile          ((Operation_flags(this) & OperationFlag_Volatile) != 0)
  //@access isSPUpdate          ((Operation_flags(this) & OperationFlag_SPUpdate) != 0)
  //@access isPrefetch          ((Operation_flags(this) & OperationFlag_Prefetch) != 0)
  //@access isPreload           ((Operation_flags(this) & OperationFlag_Preload) != 0)
  //@access isBarrier           ((Operation_flags(this) & OperationFlag_Barrier) != 0)
  //@access hasClobber          ((Operation_flags(this) & OperationFlag_Clobber) != 0)
  //@access isHoisted           ((Operation_flags(this) & OperationFlag_Hoisted) != 0)
  //@access isDeadCode          ((Operation_flags(this) & OperationFlag_DeadCode) != 0)
  //@access isProcessed         ((Operation_flags(this) & OperationFlag_Processed) != 0)
  //@access isSafeAccess        ((Operation_flags(this) & OperationFlag_SafeAccess) != 0)
  //@access isSafePerfs ((Operation_flags(this) & OperationFlag_SafePerfs) != 0)
  //@access isEntryCode ((Operation_flags(this) & OperationFlag_EntryCode) != 0)
  //@access isExitCode  ((Operation_flags(this) & OperationFlag_ExitCode) != 0)
  int32_t ORDERING;                     // Operation ordering in BasicBlock.
  int8_t BOOSTING;                      // boosting (number of control speculations).
  uint8_t ITERATION;                    // This Operation iteration after loop unrolling.
  int16_t STARTDATE;                    // Start date relative to BasicBlock start.
  int32_t RESCOUNT;                     // Count of the Temporary results.
  int32_t ARGCOUNT;                     // Count of the Temporary arguments.
  Temporary *OPERANDS;                 // This Operation results and arguments.
  //@access RESULTS     (Operation_OPERANDS(this) + 0)
  //@access ARGUMENTS   (Operation_OPERANDS(this) + Operation_RESCOUNT(this))
  Register *REGISTERS;          // This Operation Register(s).
  //@access DEFREGISTERS        (Operation_REGISTERS(this) + 0)
  //@access USEREGISTERS        (Operation_REGISTERS(this) + Operation_RESCOUNT(this))
  OperationUnion_ UNION_;
  //@access MAXCOUNT    (Operation_UNION_(this).MAXCOUNT)
  //@mutate MAXCOUNT    (&Operation_UNION_(this).MAXCOUNT)
  //@access COLOR       (Operation_UNION_(this).COLOR)
  //@mutate COLOR       (&Operation_UNION_(this).COLOR)
  //@access MAINEFFECTS (Operation_UNION_(this).MAINEFFECTS)
  //@mutate MAINEFFECTS (&Operation_UNION_(this).MAINEFFECTS)
  //@access RESEFFECTS  (Operation_MAINEFFECTS(this) + 0)
  //@access ARGEFFECTS  (Operation_MAINEFFECTS(this) + Operation_RESCOUNT(this))
  //@access CLOBBERSET  (RegisterSet)((Operation)(this) + 1)
};
Operation_next— Next Operation in Selector or BasicBlock.
static inline Operation
Operation_next(const_Operation this)
{
  return (Operation)IDListItem_NEXT(this);
}
Operation_prev— Previous Operation in Selector or BasicBlock.
static inline Operation
Operation_prev(const_Operation this)
{
  return (Operation)IDListItem_PREV(this);
}
Operation_identity— This Operation identity.
static inline uint32_t
Operation_identity(const_Operation this)
{
  return Operation_IDENTITY(this);
}
Operation_index— This Operation index.
static inline int32_t
Operation_index(const_Operation this)
{
  return Operation_INDEX(this);
}
Operation_setIndex— Set this Operation index.
static inline void
Operation_setIndex(Operation this, int32_t index)
{
  *Operation__INDEX(this) = index;
}
Operation_operator— This Operation Operator.
static inline Operator
Operation_operator(const_Operation this)
{
  return Operation_OPERATOR(this);
}
Operation_setOperator— Set the operator of this Operation.
static inline void
Operation_setOperator(Operation this, Operator operator)
{
  *Operation__OPERATOR(this) = operator;
}
Operation_replicated— The Operation this Operation was replicated from.
static inline const_Operation
Operation_replicated(const_Operation this)
{
  return Operation_REPLICATED(this);
}
Operation_basicBlock— This Operation BasicBlock.
static inline struct BasicBlock_ *
Operation_basicBlock(const_Operation this)
{
  return Operation_BASICBLOCK(this);
}
Operation_setBasicBlock— Set this Operation basicBlock.
static inline void
Operation_setBasicBlock(Operation this, struct BasicBlock_ *basicBlock)
{
  *Operation__BASICBLOCK(this) = basicBlock;
}
Operation_task— This Operation InstructionTask.
static inline InstructionTask
Operation_task(const_Operation this)
{
  return Operation_TASK(this);
}
#define Operation_instruction(this)     (Instruction)Operation_task(this)
#define Operation_issueItem(this)       (IssueItem)Operation_task(this)
Operation_setTask— Set this Operation InstructionTask.
static inline void
Operation_setTask(Operation this, InstructionTask task)
{
  *Operation__TASK(this) = task;
}
Operation_flags— This Operation flags.
static inline unsigned
Operation_flags(const_Operation this)
{
  return Operation_FLAGS(this);
}
Operation_setFlags— Set this Operation flags.
static inline void
Operation_setFlags(Operation this, OperationFlags flags)
{
  *Operation__FLAGS(this) |= flags;
}
Operation_clearFlags— Reset this Operation flags.
static inline void
Operation_clearFlags(Operation this, OperationFlags flags)
{
  *Operation__FLAGS(this) &= ~flags;
}
Operation_ordering— This Operation ordering.
static inline int32_t
Operation_ordering(const_Operation this)
{
  return Operation_ORDERING(this);
}
Operation_setOrdering— Set this Operation ordering.
static inline void
Operation_setOrdering(Operation this, int32_t ordering)
{
  *Operation__ORDERING(this) = ordering;
}
Operation_boosting— This Operation boosting.
static inline int
Operation_boosting(const_Operation this)
{
  return Operation_BOOSTING(this);
}
Operation_setBoosting— Set this Operation boosting.
static inline void
Operation_setBoosting(Operation this, int boosting)
{
  *Operation__BOOSTING(this) = boosting;
  Except_CHECK(Operation_BOOSTING(this) == boosting);
}
Operation_iteration— This Operation iteration.
static inline int
Operation_iteration(const_Operation this)
{
  return Operation_ITERATION(this);
}
Operation_setIteration— Set this Operation iteration.
static inline void
Operation_setIteration(Operation this, int iteration)
{
  *Operation__ITERATION(this) = iteration;
  Except_CHECK(Operation_ITERATION(this) == iteration);
}
Operation_startDate— This Operation start date.
static inline int
Operation_startDate(const_Operation this)
{
  return Operation_STARTDATE(this);
}
Operation_setStartDate— Set this Operation start date.
static inline void
Operation_setStartDate(Operation this, int startDate)
{
  *Operation__STARTDATE(this) = startDate;
  Except_CHECK(Operation_STARTDATE(this) == startDate);
}
Operation_operandCount— Count this Operation operands.
static inline int32_t
Operation_operandCount(const_Operation this)
{
  return Operation_ARGCOUNT(this) + Operation_RESCOUNT(this);
}
Operation_operands— Access this Operation operands.
static inline Temporary *
Operation_operands(const_Operation this)
{
  return Operation_OPERANDS(this);
}
Operation_OPERANDS_FOREACH_Temporary— Iterate this Operation OPERANDS.
#define Operation_OPERANDS_FOREACH_Temporary(this, temporary) { \
  Temporary *Operation_OPERANDS = Operation_operands(this); \
  int32_t Operation_OPERANDCOUNT = Operation_operandCount(this); \
  int32_t Operation_OPERANDS_INDEX = 0; \
  for (; Operation_OPERANDS_INDEX < Operation_OPERANDCOUNT; \
         Operation_OPERANDS_INDEX++) { \
    Temporary temporary = Operation_OPERANDS[Operation_OPERANDS_INDEX];
#define Operation_OPERANDS_ENDEACH_Temporary \
  } \
}
Operation_resCount— Count this Operation arguments.
static inline int32_t
Operation_resCount(const_Operation this)
{
  return Operation_RESCOUNT(this);
}
Operation_results— This Operation results.
static inline Temporary*
Operation_results(const_Operation this)
{
  return Operation_RESULTS(this);
}
Operation_RESULTS_FOREACH_Temporary— Iterate over this Operation RESULTS.
#define Operation_RESULTS_FOREACH_Temporary(this, temporary) { \
  Temporary *Operation_RESULTS = Operation_results(this); \
  int32_t Operation_RESCOUNT = Operation_resCount(this), Operation_RESULTS_INDEX = 0; \
  for (; Operation_RESULTS_INDEX < Operation_RESCOUNT; Operation_RESULTS_INDEX++) { \
    Temporary temporary = Operation_RESULTS[Operation_RESULTS_INDEX];
#define Operation_RESULTS_ENDEACH_Temporary \
  } \
}
Operation_argCount— Count this Operation arguments.
static inline int32_t
Operation_argCount(const_Operation this)
{
  return Operation_ARGCOUNT(this);
}
Operation_arguments— Access this Operation arguments.
static inline Temporary*
Operation_arguments(const_Operation this)
{
  return Operation_ARGUMENTS(this);
}
Operation_ARGUMENTS_FOREACH_Temporary— Iterate over this Operation ARGUMENTS.
#define Operation_ARGUMENTS_FOREACH_Temporary(this, temporary) { \
  Temporary *Operation_ARGUMENTS = Operation_arguments(this); \
  int32_t Operation_ARGCOUNT = Operation_argCount(this), Operation_ARGUMENTS_INDEX = 0; \
  for (; Operation_ARGUMENTS_INDEX < Operation_ARGCOUNT; Operation_ARGUMENTS_INDEX++) { \
    Temporary temporary = Operation_ARGUMENTS[Operation_ARGUMENTS_INDEX];
#define Operation_ARGUMENTS_ENDEACH_Temporary \
  } \
}
Operation_registers— Access this Operation Register(s). Returns NULL is this operation does not have register constraints.
static inline Register *
Operation_registers(const_Operation this)
{
  return Operation_REGISTERS(this);
}
Operation_hasRegisters— Returns true if this operation has register constraints.
static inline bool
Operation_hasRegisters(const_Operation this)
{
  return Operation_registers(this) != NULL;
}
Operation_makeRegisters— Make this Operation REGISTERS reflect the OPERANDS.
void
Operation_makeRegisters(Operation this);
Operation_defRegisters— Access this Operation def Register(s).
static inline Register *
Operation_defRegisters(const_Operation this)
{
  if (!Operation_hasRegisters(this)) return NULL;
  return Operation_DEFREGISTERS(this);
}
Operation_setDefRegister— Set the def Register at resIndex in this Operation.
static inline void
Operation_setDefRegister(Operation this, int32_t resIndex, Register reg)
{
  Except_REQUIRE(resIndex >= 0 && resIndex < Operation_RESCOUNT(this));
  //Except_REQUIRE(Operation_MAINEFFECTS(this) == NULL);
  Operation_DEFREGISTERS(this)[resIndex] = reg;
}
Operation_getDefRegister— Get the register constraint on the given result. Register__UNDEF is returned when there is no constraint, .
static inline Register
Operation_getDefRegister(const_Operation this, int32_t resIndex)
{
  if (!Operation_hasRegisters(this)) return Register__UNDEF;
  return Operation_DEFREGISTERS(this)[resIndex];
}
Operation_useRegisters— Access this Operation use Register(s).
static inline Register *
Operation_useRegisters(const_Operation this)
{
  if (!Operation_hasRegisters(this)) return NULL;
  return Operation_USEREGISTERS(this);
}
Operation_setUseRegister— Set the use Register at argIndex in this Operation.
static inline void
Operation_setUseRegister(Operation this, int32_t argIndex, Register reg)
{
  Except_REQUIRE(argIndex >= 0 && argIndex < Operation_ARGCOUNT(this));
  //Except_REQUIRE(Operation_MAINEFFECTS(this) == NULL);
  Operation_USEREGISTERS(this)[argIndex] = reg;
}
Operation_getUseRegister— Get the register constraint on the given argument. Register__UNDEF is returned when there is no constraint, .
static inline Register
Operation_getUseRegister(const_Operation this, int32_t argIndex)
{
  if (!Operation_hasRegisters(this)) return Register__UNDEF;
  return  Operation_USEREGISTERS(this)[argIndex];
}
Operation_mainEffects— Access this Operation main Effect(s).
static inline struct Effect_ *
Operation_mainEffects(const_Operation this)
{
  return Operation_MAINEFFECTS(this);
}
Operation_setMainEffects— Set this Operation main Effect(s).
static inline void
Operation_setMainEffects(Operation this, struct Effect_ *mainEffects)
{
  *Operation__MAINEFFECTS(this) = mainEffects;
}
Operation_resEffects— Access this Operation result Effect(s).
#define Operation_resEffects(this) \
  (Operation_mainEffects(this) + 0)
Operation_argEffects— Access this Operation argument Effect(s).
#define Operation_argEffects(this) \
  (Operation_mainEffects(this) + Operation_resCount(this))
Operation_RESULTS_FOREACH_Effect— Iterate over this Operation RESEFFECTS.
#define Operation_RESULTS_FOREACH_Effect(this, effect) { \
  struct Effect_ *Operation_RESEFFECTS = Operation_resEffects(this); \
  int32_t Operation_RESCOUNT = Operation_resCount(this), Operation_RESULTS_INDEX = 0; \
  for (; Operation_RESULTS_INDEX < Operation_RESCOUNT; Operation_RESULTS_INDEX++) { \
    Effect effect = Operation_RESEFFECTS + Operation_RESULTS_INDEX;
#define Operation_RESULTS_ENDEACH_Effect \
  } \
}
Operation_ARGUMENTS_FOREACH_Effect— Iterate over this Operation ARGEFFECTS.
#define Operation_ARGUMENTS_FOREACH_Effect(this, effect) { \
  struct Effect_ *Operation_ARGEFFECTS = Operation_argEffects(this); \
  int32_t Operation_ARGCOUNT = Operation_argCount(this), Operation_ARGUMENTS_INDEX = 0; \
  for (; Operation_ARGUMENTS_INDEX < Operation_ARGCOUNT; Operation_ARGUMENTS_INDEX++) { \
    Effect effect = Operation_ARGEFFECTS + Operation_ARGUMENTS_INDEX;
#define Operation_ARGUMENTS_ENDEACH_Effect \
  } \
}
Operation_getResEffect— Access an Operation result by index.

struct Effect_ * Operation_getResEffect(const_Operation this, int32_t resIndex);

#define Operation_getResEffect(this, resIndex) \
  (Operation_resEffects(this) + resIndex)
Operation_getArgEffect— Access an Operation argument by index.

struct Effect_ * Operation_getArgEffect(const_Operation this, int32_t argIndex);

#define Operation_getArgEffect(this, argIndex) \
(Operation_argEffects(this) + argIndex)
Operation_clobberSet— This Operation clobber RegisterSet if any.
static inline RegisterSet
Operation_clobberSet(const_Operation this)
{
  if (Operation_hasClobber(this)) {
    return Operation_CLOBBERSET(this);
  }
  return NULL;
}
Operation_refreshFlags— Refresh this Operation flags that depend on operands.

Must call before Operation_isCritical, Operation_maySpeculate, Operation_mayCompensate.

void
Operation_refreshFlags(Operation this, Register stackRegister);
Operation_isCritical— Check if this Operation is critical for dead code elimination.
bool
Operation_isCritical(const_Operation this);
Operation_hasDedicatedResult— Test if this Operation has a Dedicated result.

Do not consider results on constant registers unless alsoConstant is true.

bool
Operation_hasDedicatedResult(const_Operation this, bool alsoConstant);
Operation_hasDedicatedArgument— Test if this Operation has a Dedicated argument.

Do not consider arguments on constant registers unless alsoConstant is true.

bool
Operation_hasDedicatedArgument(const_Operation this, bool alsoConstant);
Operation_getDedicatedResults— Get the Dedicated results in a RegisterSet.
void
Operation_getDedicatedResults(const_Operation this, RegisterSet dedicatedSet);
Operation_getDedicatedArguments— Get the Dedicated arguments in a RegisterSet.
void
Operation_getDedicatedArguments(const_Operation this, RegisterSet dedicatedSet);
Operation_appendResult— Add a result Temporary to an Operation.
int32_t
Operation_appendResult(Operation this, Temporary temporary);
Operation_appendArgument— Add an argument Temporary to an Operation.
int32_t
Operation_appendArgument(Operation this, Temporary temporary);
Operation_getResult— Get the result Temporary at resIndex in this Operation.
static inline Temporary
Operation_getResult(Operation this, int32_t resIndex)
{
  Except_REQUIRE(resIndex >= 0 && resIndex < Operation_RESCOUNT(this));
  return Operation_RESULTS(this)[resIndex];
}
Operation_setResult— Set the result Temporary at resIndex in this Operation.
static inline void
Operation_setResult(Operation this, int32_t resIndex, Temporary temporary)
{
  Except_REQUIRE(resIndex >= 0 && resIndex < Operation_RESCOUNT(this));
  //Except_REQUIRE(Operation_MAINEFFECTS(this) == NULL);
  Operation_RESULTS(this)[resIndex] = temporary;
}
Operation_getArgument— Get the argument Temporary at argIndex in this Operation.
static inline Temporary
Operation_getArgument(Operation this, int32_t argIndex)
{
  Except_REQUIRE(argIndex >= 0 && argIndex < Operation_ARGCOUNT(this));
  return Operation_ARGUMENTS(this)[argIndex];
}
Operation_setArgument— Set the argument Temporary at argIndex in this Operation.
static inline void
Operation_setArgument(Operation this, int32_t argIndex, Temporary temporary)
{
  Except_REQUIRE(argIndex >= 0 && argIndex < Operation_ARGCOUNT(this));
  //Except_REQUIRE(Operation_MAINEFFECTS(this) == NULL);
  Operation_ARGUMENTS(this)[argIndex] = temporary;
}
Operation_resizeOperands— Resize this Operation arguments or results.
Invariant
The operands array has results followed by arguments.
void
Operation_resizeOperands(Operation this, int32_t resCount, int32_t argCount);
Operation_isGoTo— Check if this Operation is GoTo.
static inline bool
Operation_isGoTo(const_Operation this)
{
  return Operator_isGoTo(Operation_OPERATOR(this));
}
Operation_isRoutine— Check if this Operation is Routine.
static inline bool
Operation_isRoutine(const_Operation this)
{
  return Operator_isRoutine(Operation_OPERATOR(this));
}
Operation_isReturn— Check if this Operation is Return.
static inline bool
Operation_isReturn(const_Operation this)
{
  return Operator_isReturn(Operation_OPERATOR(this));
}
Operation_isConditional— Check if this Operation is Conditional.
static inline bool
Operation_isConditional(const_Operation this)
{
  return Operator_isConditional(Operation_OPERATOR(this));
}
Operation_maySpeculate— Check if this Operation may be speculated.
bool
Operation_maySpeculate(const_Operation this, Processor processor, int speculation);
Operation_speculate— Speculate this Operation.
Require
Operation_maySpeculate is true.
void
Operation_speculate(Operation this, Processor processor);
Operation_mayCompensate— Check if this Operation may be compensated.
bool
Operation_mayCompensate(const_Operation this, Processor processor, int compensation);
Operation_mayPredicatePositive— Check if this Operation may be predicated positive.
bool
Operation_mayPredicatePositive(const_Operation this, Processor processor);
Operation_mayPredicateNegative— Check if this Operation may be predicated negative.
bool
Operation_mayPredicateNegative(const_Operation this, Processor processor);
Operation_predicate— Predication this Operation.
bool
Operation_predicate(Operation this, Processor processor,
                    Temporary predicate, int polarity);
Operation_mayUnpredicate— Check if this Operation may be predicated negative.
bool
Operation_mayUnpredicate(const_Operation this, Processor processor);
Operation_unpredicate— Un-predicate this Operation.
void
Operation_unpredicate(Operation this, Processor processor);
Operation_getPredicate— Get the predicate of this Operation.
Temporary
Operation_getPredicate(Operation this);
Operation_mayComplementResult— Check this Operation may be complemented on result.
bool
Operation_mayComplementResult(const_Operation this,
                              Processor processor,
                              int32_t resIndex);
Operation_complementResult— Complement this operation on the designated result.
void
Operation_complementResult(Operation this,
                           Processor processor,
                           int32_t resIndex);
Operation_mayComplementArgument— Check this Operation may be complemented on argument.
bool
Operation_mayComplementArgument(const_Operation this,
                                Processor processor,
                                int32_t argIndex);
Operation_complementArgument— Complement this operation on the designated argument.
void
Operation_complementArgument(Operation this,
                             Processor processor,
                             int32_t argIndex);
Operation_invertGoTo— Invert a GoTo Operation.
static inline void
Operation_invertGoTo(Operation this, Processor processor)
{
  int32_t conditionIndex = 0;   // FIXME! Should come from MDS.
  Except_CHECK(Operator_isGoTo(Operation_OPERATOR(this)));
  Operation_complementArgument(this, processor, conditionIndex);
}
Operation_mayPreload— Check this Operation may become a pre-load.
bool
Operation_mayPreload(const_Operation this, int32_t regIndex);
Operation_unitCost— The unit cost estimate of this Operation.
int
Operation_unitCost(const_Operation this, Processor processor);
Operation_getTargetLabel— Get the target label of an operation.
static inline Label
Operation_getTargetLabel(const_Operation this)
{
  int32_t targetIndex = Operation_ARGCOUNT(this) - 1;   // FIXME! Should come from MDS.
  //TODO int32_t targetIndex = Operator_targetIndex(Operation_operator(this));
  const Temporary *arguments = Operation_ARGUMENTS(this);
  Temporary target_temporary = arguments[targetIndex];
  if (Temporary_isLabel(target_temporary)) {
    TemporaryInvariant invariant = Temporary_INVARIANT(target_temporary);
    return TemporaryInvariant_LABEL(invariant);
  }
  return NULL;
}
Operation_getStepIndex— Get the step argIndex if this Operation adds a constant.
static inline int32_t
Operation_getStepIndex(const_Operation this)
{
  Operator operator = Operation_OPERATOR(this);
  if (Operator_isAdd(operator)) {
    int32_t immediateIndex = Operator_immediateIndex(operator);
    if (immediateIndex >= 0) {
      Temporary *arguments = Operation_ARGUMENTS(this);
      Temporary temporary = arguments[immediateIndex];
      if (Temporary_isAbsolute(temporary)) {
        return immediateIndex;
      }
    }
  }
  return -1;
}
Operation_getRelaxable— Get this Operation relaxable value for inductive relaxation.
overlap
The maximum overlap possible in the schedule.
step
The simple induction step value.
Return
The amount of inductive relaxation applicable.

Inductive relaxation enables the definition of a simple induction to be scheduled after the use of that induction, provided the use is an additive / substractive operator with an immediate value. This function computes the relaxable value, that is, the coefficient of LAMBDA in the RAW dependence from the definition to the use.

TODO: support for relaxing the WAR between Operation use and induction def.

int
Operation_getRelaxable(const_Operation this, int32_t regIndex, int overlap, int64_t step);
Operation_isPaddedLoad— Check if this Operation is a padded memory load.
bool
Operation_isPaddedLoad(const_Operation this,
                       int prePadding,
                       int postPadding,
                       int64_t distance);
Operation_getMemoryDistance— The minimum omega for two memory accesses to overlap, assuming a same base address, and a simple induction step.
adjust
+1 if the induction update is between this and that, -1 if the induction update is between that and this, else 0.
overlap
The maximum overlap of the loop iterations.
step
The simple induction step
Return
The omega value, or overlap + 1 if no overlap detected.
int
Operation_getMemoryDistance(const_Operation this, const_Operation that,
                            int adjust, int overlap, int64_t step);
Operation_makeInstruction— Make this Operation Instruction and push on NativeBlock.
Instruction
Operation_makeInstruction(Operation this, Processor processor, NativeBlock block);
Operation_compareIndices— Compare for sorting Operations by INDEX.
int
Operation_compareIndices(const void *this_pointer, const void *that_pointer);
Operation_pretty— Pretty-print this Operation.
bool
Operation_pretty(const_Operation this, FILE *file);
OperationENTRY_appendResult— Augment an ENTRY Operation with a new argument. Note that no check is done whether the argument count overflows the allocated number of arguments. We cannot use the MAXCOUNT entry as a ENTRY operation can have dedicated constraints which is stored as an union with MAXCOUNT.
int32_t
OperationENTRY_appendResult(Operation this, Temporary result);
Operation_addtoParCopy— Augment a parallel copy Operation with a new pair to copy.
int32_t
Operation_addtoParCopy(Operation this, Temporary destination, Temporary origin);
OperationPCOPY_putCopy— Augment a PCOPY Operation with a new pair to copy in front of the operation. WARNING! This function desynchronizes the OperationArgument and OperationResult of SSA.
int32_t
OperationPCOPY_putCopy(Operation this, Temporary destination, Temporary origin);
OperationStack— Stack of Operation(s).
struct OperationStack_ {
  //@args       Memory memory, int maxCount
  PtrSeq_ __;           // Underlying PtrSeq.
};
OperationStack_FOREACH_Operation— Iterate over this OperationStack Operation(s).
#define OperationStack_FOREACH_Operation(this, operation) { \
  const_PtrSeq OperationStack____ = OperationStack__const(this); \
  PtrSeq_FOREACH(OperationStack____, Operation, operation) {
#define OperationStack_ENDEACH_Operation \
  } PtrSeq_ENDEACH \
}
OperationStack_FORBACK_Operation— Iterate over this OperationStack Operation(s).
#define OperationStack_FORBACK_Operation(this, operation) { \
  const_PtrSeq OperationStack____ = OperationStack__const(this); \
  PtrSeq_FORBACK(OperationStack____, Operation, operation) {
#define OperationStack_ENDBACK_Operation \
  } PtrSeq_ENDBACK \
}
OperationList— List of Operation(s).
struct OperationList_ {
  //@args       Memory memory
  IDList_ __;           // Underlying IDList.
  //@access MEMORY      IDList_memory(OperationList____(this))
  //@access COUNT       IDList_count(OperationList____(this))
  //@access FIRSTITEM   (Operation*)(IDList_firstItem(OperationList____(this)))
  //@access LASTITEM    (Operation*)(IDList_lastItem(OperationList____(this)))
};
OperationList_memory— This OperationList memory.
static inline Memory
OperationList_memory(const_OperationList this)
{
  return OperationList_MEMORY(this);
}

OperationList_isEmpty -- True iff this OperationList is empty. OperationList_isSingle -- True iff this OperationList has a single entry.

#define OperationList_isEmpty(this)     IDList_isEmpty(OperationList____(this))
#define OperationList_isSingle(this)    IDList_isSingle(OperationList____(this))
OperationList_count— Count items in the OperationList.
Return
The count of items in the OperationList.
static inline int32_t
OperationList_count(const_OperationList this) {
  return OperationList_COUNT(this);
}
OperationList_firstItem— First item of the OperationList.
Return
Pointer to the firstItem.
static inline Operation
OperationList_firstItem(const_OperationList this) {
  return *(Operation*)OperationList_FIRSTITEM(this);
}
OperationList_BOT— Dereference bottom (firstItem) item of this OperationList.
#define OperationList_BOT(this) IDList_BOT(OperationList____(this), Operation)
OperationList_lastItem— Last item of the OperationList.
Return
Pointer to the lastItem.
static inline Operation
OperationList_lastItem(const_OperationList this) {
  return *(Operation*)OperationList_LASTITEM(this);
}
OperationList_TOP— Dereference top (lastItem) item of this OperationList.
#define OperationList_TOP(this) IDList_TOP(OperationList____(this), Operation)
OperationList_FOREACH_Operation— Iterate from firstItem to lastItem Operation.

Exiting OperationList_FOREACH_Operation with +break+ or +return+ is allowed.

+iter+
Operation set to each item.
#define OperationList_FOREACH_Operation(this, operation) { \
  const Operation* OperationList_ITER; \
  IDList_FOREACH(OperationList____(this), Operation, OperationList_ITER) { \
    Operation operation = *OperationList_ITER;
#define OperationList_ENDEACH_Operation \
  } IDList_ENDEACH; \
}
OperationList_FORBACK_Operation— Iterate from lastItem to firstItem Operation.

Exiting OperationList_FORBACK with +break+ or +return+ is allowed.

+iter+
Operation set to each item.
#define OperationList_FORBACK_Operation(this, operation) { \
  const Operation* OperationList_ITER; \
  IDList_FORBACK(OperationList____(this), Operation, OperationList_ITER) { \
    Operation operation = *OperationList_ITER;
#define OperationList_ENDBACK_Operation \
  } IDList_ENDBACK; \
}
OperationList_push— Make and push an item as lastItem on the OperationList.
Return
The pushed Operation.
static inline Operation
OperationList_push(OperationList this) {
  return *(Operation*)IDList_push(OperationList____(this), sizeof(Operation));
}
OperationList_put— Make and put an item as firstItem on the OperationList.
Return
The put Operation.
static inline Operation
OperationList_put(OperationList this) {
  return *(Operation*)IDList_put(OperationList____(this), sizeof(Operation));
}
OperationList_insert— Make and insert an item before a given item on the OperationList.
+before+
The item to insert before.
Return
The inserted Operation.
static inline Operation
OperationList_insert(OperationList this, Operation before) {
  return *(Operation*)IDList_insert(OperationList____(this), before, sizeof(Operation));
}
OperationList_append— Make and append an item after a given item on the OperationList.
+after+
The item to append after.
Return
The inserted Operation.
static inline Operation
OperationList_append(OperationList this, Operation after) {
  return *(Operation*)IDList_append(OperationList____(this), after, sizeof(Operation));
}
OperationList_pop— Pop and release the lastItem OperationList item.
static inline void
OperationList_pop(OperationList this, IDListItemRelease release) {
  IDList_pop(OperationList____(this), release);
}
OperationList_drop— Drop and release the firstItem OperationList item.
static inline void
OperationList_drop(OperationList this, IDListItemRelease release) {
  IDList_drop(OperationList____(this), release);
}
OperationList_remove— Remove and release an item from this OperationList.
static inline void
OperationList_remove(OperationList this, Operation item, IDListItemRelease release) {
  IDList_remove(OperationList____(this), item, release);
}
OperationList_rotate— Rotate the list so that item at +index+ becomes firstItem (index 0).
static inline void
OperationList_rotate(OperationList this, int32_t index) {
  IDList_rotate(OperationList____(this), index);
}
OperationList_contains— Test if this OperationList contains the given Operation.
static inline bool
OperationList_contains(const_OperationList this, Operation item) {
  return IDList_contains(OperationList____(this), item);
}
OperationList_transfer— Transfer all items from this OperationList at the end of that OperationList.
static inline void
OperationList_transfer(OperationList this, OperationList that) {
  IDList_transfer(OperationList____(this), OperationList____(that));
}
OperationList_sort— Sort this OperationList according to the +compare+ compare function.
Return
False iff this IDList was already sorted.
static inline bool
OperationList_sort(OperationList this, IDListItemCompare compare) {
   return IDList_sort(OperationList____(this), compare);
}
OperationArgument— Pair of Operation and argument index.
union OperationArgument_ {
  uint64_t UINT64;
  struct {
    Operation OPERATION;
    int32_t ARGINDEX;
  } PAIR;
};
typedef union OperationArgument_ OperationArgument_, *OperationArgument;
typedef const union OperationArgument_ *restrict const_OperationArgument;
#define OperationArgument_UINT64(this) ((this)->UINT64)
#define OperationArgument__UINT64(this) (&(this)->UINT64)
#define OperationArgument_OPERATION(this) ((this)->PAIR.OPERATION)
#define OperationArgument__OPERATION(this) (&(this)->PAIR.OPERATION)
#define OperationArgument_ARGINDEX(this) ((this)->PAIR.ARGINDEX)
#define OperationArgument__ARGINDEX(this) (&(this)->PAIR.ARGINDEX)
static inline OperationArgument
OperationArgument_Ctor(OperationArgument this, Operation operation, int32_t argIndex)
{
  *OperationArgument__OPERATION(this) = operation;
  *OperationArgument__ARGINDEX(this) = argIndex;
  return this;
}
#define OperationArgument_Clear(this) ((this)->UINT64 = 0L)
#define OperationArgument_Dtor(this) { }
#define OperationArgument_equal(this, that) \
  (OperationArgument_UINT64(this) == OperationArgument_UINT64(that))
OperationResult— Pair of Operation and result index.
union OperationResult_ {
  uint64_t UINT64;
  struct {
    Operation OPERATION;
    int32_t RESINDEX;
  } PAIR;
};
typedef union OperationResult_ OperationResult_, *OperationResult;
typedef const union OperationResult_ *restrict const_OperationResult;
#define OperationResult_UINT64(this) ((this)->UINT64)
#define OperationResult__UINT64(this) (&(this)->UINT64)
#define OperationResult_OPERATION(this) ((this)->PAIR.OPERATION)
#define OperationResult__OPERATION(this) (&(this)->PAIR.OPERATION)
#define OperationResult_RESINDEX(this) ((this)->PAIR.RESINDEX)
#define OperationResult__RESINDEX(this) (&(this)->PAIR.RESINDEX)
static inline OperationResult
OperationResult_Ctor(OperationResult this, Operation operation, int32_t resIndex)
{
  *OperationResult__OPERATION(this) = operation;
  *OperationResult__RESINDEX(this) = resIndex;
  return this;
}
#define OperationResult_Clear(this) ((this)->UINT64 = 0L)
#define OperationResult_Dtor(this) { }
#define OperationResult_equal(this, that) \
  (OperationResult_UINT64(this) == OperationResult_UINT64(that))

st200-Operation.xcc

Christophe Guillon (Christophe.Guillonst.com). Benoit Dupont de Dinechin (Benoit.Dupont-de-Dinechinst.com).

Copyright 2002 - 2007 STMicroelectronics. Copyright 1995 - 1998 Commissariat a l'Energie Atomique.

This program is free software; you can redistribute it and/or modify it under the terms of either (at your option): the GNU General Public License (GPL) version 2; the GNU Lesser General Public License (LGPL) version 2.1; any later version of these licences as published by the Free Software Foundation.