Lifetime.xcc

Benoit Dupont de Dinechin (Benoit.Dupont-de-Dinechin@st.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.

LifetimeFlag— Enumerates the Lifetime flags.
typedef enum {
  LifetimeFlag_OnlyUses = 0x1,          // Lifetime contains only uses.
  LifetimeFlag_Wrapping = 0x2,          // Lifetime has a wrapping effect.
  LifetimeFlag_Relaxable = 0x4,         // Lifetime has a relaxing def.
  LifetimeFlag_Complement = 0x8,        // Lifetime may be complemented.
  LifetimeFlag_Induction = 0x10,        // Lifetime has an induction def.
  LifetimeFlag_WriteOnce = 0x20,        // Lifetime has a single write.
  LifetimeFlag_ReadAfter = 0x40,        // Lifetime has all reads after write.
  LifetimeFlag_Renaming = 0x80,         // Lifetime has renaming registers.
  LifetimeFlag_InnerLoop = 0x100,       // Lifetime is for inner loop.
  LifetimeFlag_PrePass = 0x200,         // Lifetime is for prepass scheduling.
} enum_LifetimeFlag;
typedef uint16_t LifetimeFlags;
Lifetime— Lifetime of a Temporary inside a BlockTrace.
struct Lifetime_ {
  //@access NEXT        (Lifetime)IDListItem_NEXT(this)
  //@access PREV        (Lifetime)IDListItem_PREV(this)
  //@args       Memory memory, Temporary temporary, EffectSeq effectSeq,
  //@args       int firstIndex, unsigned lifetimeFlags
  Temporary TEMPORARY;          // Temporary for this Lifetime.
  //@access hasRegFile  Temporary_hasRegFile(Lifetime_TEMPORARY(this))
  EffectSeq EFFECTSEQ;          // The EffectSeq used by this Lifetime.
  int16_t FIRSTINDEX;           //
  int16_t LASTINDEX;            //
  LifetimeFlags FLAGS;
  //@access isOnlyUses  ((Lifetime_FLAGS(this) & LifetimeFlag_OnlyUses) != 0)
  //@access isWrapping  ((Lifetime_FLAGS(this) & LifetimeFlag_Wrapping) != 0)
  //@access hasRelaxable        ((Lifetime_FLAGS(this) & LifetimeFlag_Relaxable) != 0)
  //@access hasComplement       ((Lifetime_FLAGS(this) & LifetimeFlag_Complement) != 0)
  //@access isInduction ((Lifetime_FLAGS(this) & LifetimeFlag_Induction) != 0)
  //@access isWriteOnce ((Lifetime_FLAGS(this) & LifetimeFlag_WriteOnce) != 0)
  //@access isReadAfter ((Lifetime_FLAGS(this) & LifetimeFlag_ReadAfter) != 0)
  //@access hasRenaming ((Lifetime_FLAGS(this) & LifetimeFlag_Renaming) != 0)
  //@access isInnerLoop ((Lifetime_FLAGS(this) & LifetimeFlag_InnerLoop) != 0)
  //@access isPrePass   ((Lifetime_FLAGS(this) & LifetimeFlag_PrePass) != 0)
  int16_t LIFESPAN;             //
  TemporaryStack_ RENAMESTACK_;
  //@access RENAMESTACK Lifetime__RENAMESTACK_(this)
  int16_t RENAMECOUNT;          // Count of temporaries in this RENAMESTACK.
  int16_t DEFITERATION;         // Last def iteration number when renaming this Lifetime.
  Temporary DEFINITION;         // Last Temporary def seen when renaming this Lifetime.
  Effect STEPEFFECT;            // Step Effect in case of simple inductions.
};
Lifetime_FOREACH_Effect— Iterate over this Lifetime Effects.
#define Lifetime_FOREACH_Effect(this, effect) { \
  int32_t Lifetime_INDEX = Lifetime_FIRSTINDEX(this); \
  int32_t Lifetime_LASTINDEX = Lifetime_LASTINDEX(this); \
  EffectSeq Lifetime_EFFECTSEQ = Lifetime_EFFECTSEQ(this); \
  Effect *Lifetime_BASE = EffectSeq_base(Lifetime_EFFECTSEQ); \
  for (; Lifetime_INDEX <= Lifetime_LASTINDEX; Lifetime_INDEX++) { \
    Effect effect = Lifetime_BASE[Lifetime_INDEX];
#define Lifetime_ENDEACH_Effect \
  } \
}
Lifetime_FORSAFE_Effect— Iterate over this Lifetime Effects.

This iterator works even if Lifetime_EFFECTSEQ is modified.

#define Lifetime_FORSAFE_Effect(this, effect) { \
  int32_t Lifetime_INDEX = Lifetime_FIRSTINDEX(this); \
  int32_t Lifetime_LASTINDEX = Lifetime_LASTINDEX(this); \
  EffectSeq Lifetime_EFFECTSEQ = Lifetime_EFFECTSEQ(this); \
  for (; Lifetime_INDEX <= Lifetime_LASTINDEX; Lifetime_INDEX++) { \
    Effect effect = EffectSeq_base(Lifetime_EFFECTSEQ)[Lifetime_INDEX];
#define Lifetime_ENDSAFE_Effect \
  } \
}
Lifetime_pretty— Pretty print of this Lifetime.
bool
Lifetime_pretty(Lifetime this, FILE *file);
Lifetime_getRename— Get the renaming Temporary for a given iteration.
Temporary
Lifetime_getRename(Lifetime this, int iteration);
Lifetime_setTemporaryIndex— Set the Temporary INDEX of this Lifetime.

Set the INDEX of this Lifetime_TEMPORARY for use in TemporaryMap. In case of an assigned or a dedicated temporary, all the Effect_TEMPORARY must have their INDEX set to the same value as well.

void
Lifetime_setTemporaryIndex(Lifetime this, int32_t index);
Lifetime_fixResult— Fix a result effect for modulo expansion and induction relaxation.
void
Lifetime_fixResult(Lifetime this, Procedure procedure, Effect effect, int iteration);
Lifetime_fixArgument— Fix an argument effect for modulo expansion and induction relaxation.
void
Lifetime_fixArgument(Lifetime this, Procedure procedure, Effect effect, int iteration);
LifetimeTable— Table of Lifetime(s).
struct LifetimeTable_;
  //@args       Memory memory, Optimize optimize, Configure configure
LifetimeTable_lifetimes— For use by LifetimeTable_FOREACH_Lifetime.
IDList
LifetimeTable_lifetimes(LifetimeTable this);
LifetimeTable_FOREACH_Lifetime— Iterate over this LifetimeTable Lifetimes.
#define LifetimeTable_FOREACH_Lifetime(this, lifetime) \
  IDList_FOREACH(LifetimeTable_lifetimes(this), Lifetime_, lifetime) {
#define LifetimeTable_ENDEACH_Lifetime \
  } IDList_ENDEACH;