NativeBlock.xcc

Author: Benoit Dupont de Dinechin (Benoit.Dupont-de-Dinechin@st.com)

Copyright 2001 - 2007 STMicroelectronics

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.

NativeBlock— Implements a block of native code or data.
struct NativeBlock_ {
  //@args       Memory memory, Processor processor, NativeBlockFlags flags
  InstructionStack_ INSTRUCTIONS[1];    // This NativeBlock Instruction(s).
  //@access MEMORY      InstructionStack_memory(NativeBlock_INSTRUCTIONS(this))
  IDList_ LITERALS[1];                  // Either INSTRUCTIONS or LITERALS.
  struct NativeStream_ *NATIVESTREAM;   // The NativeStream where this NativeBlock lives.
  Processor PROCESSOR;          // The Processor this NativeBlock is for.
  bool FILLEMPTY;                       // True if must skip empty InstructionGroup(s).
  NativeBlockFlags FLAGS;               // This NativeBlock NativeBlockFlags.
  //@access isLiterals  ((NativeBlock_flags(this) & NativeBlockFlag_Literals) != 0)
  //@access isEntry     ((NativeBlock_flags(this) & NativeBlockFlag_Entry) != 0)
  //@access isExit      ((NativeBlock_flags(this) & NativeBlockFlag_Exit) != 0)
  //@access isProtected ((NativeBlock_flags(this) & NativeBlockFlag_Protected) != 0)
  //@access isCatch     ((NativeBlock_flags(this) & NativeBlockFlag_Catch) != 0)
  //@access isFinally   ((NativeBlock_flags(this) & NativeBlockFlag_Finally) != 0)
  //@access isFilter    ((NativeBlock_flags(this) & NativeBlockFlag_Filter) != 0)
  //@access isFault     ((NativeBlock_flags(this) & NativeBlockFlag_Fault) != 0)
  //@access isBundled   ((NativeBlock_flags(this) & NativeBlockFlag_Bundled) != 0)
  Label LABEL;                          // This NativeBlock Label.
  int32_t LASTDATE;                     // Last start date after scheduling.
  //@access isScheduled (NativeBlock_lastDate(this) >= 0)
  int32_t GROUPCOUNT;                   // Count of InstructionGroup(s).
  struct InstructionGroup_ *GROUPS;     // Array of InstructionGroup(s).
  PlatformUInt CODESIZE;                // The size required to encode this NativeBlock.
};
NativeBlock_new— Create a new NativeBlock.

parent: The parent memory allocator for this NativeBlock. aboutBlocks: About the number of NativeBlocks(s) in this NativeBlock.

NativeBlock
NativeBlock_new(Memory parent, Processor processor, NativeBlockFlags flags);
NativeBlock_delete— Delete a NativeBlock.
NativeBlock
NativeBlock_delete(NativeBlock this);
NativeBlock_flags— This NativeBlock flags.
static inline NativeBlockFlags
NativeBlock_flags(const_NativeBlock this)
{
  return NativeBlock_FLAGS(this);
}
NativeBlock_setFlags— Set this NativeBlock flags.
static inline void
NativeBlock_setFlags(NativeBlock this, NativeBlockFlags flags)
{
  *NativeBlock__FLAGS(this) |= flags;
}
NativeBlock_clearFlags— Clear this NativeBlock flags.
static inline void
NativeBlock_clearFlags(NativeBlock this, NativeBlockFlags flags)
{
  *NativeBlock__FLAGS(this) &= ~flags;
}
NativeBlock_label— This NativeBlock Label.
static inline Label
NativeBlock_label(const_NativeBlock this)
{
  return NativeBlock_LABEL(this);
}
NativeBlock_nativeStream— This NativeBlock NativeStream.
static inline struct NativeStream_ *
NativeBlock_nativeStream(const_NativeBlock this)
{
  return NativeBlock_NATIVESTREAM(this);
}
NativeBlock_instructions— For use by NativeBlock_FOREACH_Instruction.
static inline const_InstructionStack
NativeBlock_instructions(const_NativeBlock this)
{
  return NativeBlock_INSTRUCTIONS(this);
}
NativeBlock_FOREACH_Instruction— Iterate this NativeBlock Instruction(s).
#define NativeBlock_FOREACH_Instruction(this, instruction) { \
  const_InstructionStack NativeBlock_INSTRUCTIONS = NativeBlock_instructions(this); \
  InstructionStack_FOREACH_Instruction(NativeBlock_INSTRUCTIONS, instruction)
#define NativeBlock_ENDEACH_Instruction \
  InstructionStack_ENDEACH_Instruction \
}
NativeBlock_lastDate— This NativeBlock last start date.
static inline int
NativeBlock_lastDate(const_NativeBlock this)
{
  return NativeBlock_LASTDATE(this);
}
NativeBlock_scoreboardInstructions— Scoreboard this NativeBlock Instruction(s).
bool
NativeBlock_scoreboardInstructions(NativeBlock this, Scoreboard scoreboard);
NativeBlock_reorderInstructions— Sort NativeBlock INSTRUCTIONS in execution order.

FIXME! Slow code that should be replaced by reordering in the scheduler itself.

void
NativeBlock_reorderInstructions(NativeBlock this);
NativeBlock_groupCount— For use by NativeBlock_FOREACH_InstructionGroup.
static inline int32_t
NativeBlock_groupCount(const_NativeBlock this)
{
  return NativeBlock_GROUPCOUNT(this);
}
NativeBlock_groups— For use by NativeBlock_FOREACH_InstructionGroup.
static inline struct InstructionGroup_ *
NativeBlock_groups(const_NativeBlock this)
{
  return NativeBlock_GROUPS(this);
}
NativeBlock_FOREACH_InstructionGroup— Iterate this NativeBlock InstructionGroup(s).
#define NativeBlock_FOREACH_InstructionGroup(this, group) { \
  InstructionGroup_ *NativeBlock_GROUPS = NativeBlock_groups(this); \
  int32_t NativeBlock_GROUPCOUNT = NativeBlock_groupCount(this); \
  int32_t NativeBlock_BUNDLEINDEX = 0; \
  for (; NativeBlock_BUNDLEINDEX < NativeBlock_GROUPCOUNT; NativeBlock_BUNDLEINDEX++) { \
    InstructionGroup group = NativeBlock_GROUPS + NativeBlock_BUNDLEINDEX;
#define NativeBlock_ENDEACH_InstructionGroup \
  } \
}
NativeBlock_isEmpty— True iff this NativeBlock is empty.
static inline bool
NativeBlock_isEmpty(const_NativeBlock this)
{
  return InstructionStack_isEmpty(NativeBlock_INSTRUCTIONS(this));
}
NativeBlock_firstInstruction— This NativeBlock first Instruction.
static inline Instruction
NativeBlock_firstInstruction(const_NativeBlock this)
{
  return InstructionStack_bottom(NativeBlock_INSTRUCTIONS(this));
}
NativeBlock_lastInstruction— This NativeBlock last Instruction.
static inline Instruction
NativeBlock_lastInstruction(const_NativeBlock this)
{
  return InstructionStack_top(NativeBlock_INSTRUCTIONS(this));
}
NativeBlock_makeInstruction— Make a new Instruction last on this NativeBlock.
Instruction
NativeBlock_makeInstruction(NativeBlock this, Instance instance,
                            const_OperandsBuffer buffer, Relocation relocation);
NativeBlock_literals— For use by NativeBlock_FOREACH_Literal.
static inline const_IDList
NativeBlock_literals(const_NativeBlock this)
{
  Except_REQUIRE(NativeBlock_isLiterals(this));
  return NativeBlock_LITERALS(this);
}
NativeBlock_FOREACH_Literal— Iterate this NativeBlock Literal Constant(s).
#define NativeBlock_FOREACH_Literal(this, literal) { \
  const_IDList NativeBlock_LITERALS = NativeBlock_literals(this); \
  IDList_FOREACH(NativeBlock_LITERALS, Literal_, literal) {
#define NativeBlock_ENDEACH_Literal \
  } IDList_ENDEACH; \
}
NativeBlock_pushLiteral— Push a new Literal on NativeBlock.
static inline Literal
NativeBlock_pushLiteral(NativeBlock this, LiteralType type,
                        void *handle, ImmediateValue value, ImmediateValue offset,
                        Relocation relocation, NativeType nativeType)
{
  size_t size = Literal_Size(type, handle, value, offset,
                              relocation, nativeType);
  void *literal = IDList_push(NativeBlock_LITERALS(this), size);
  return Literal_Ctor(literal, type, handle, value, offset,
                       relocation, nativeType);
}
NativeBlock_pushAbsoluteLiteral— Push a new absolute Literal on NativeBlock.
static inline Literal
NativeBlock_pushAbsoluteLiteral(NativeBlock this, ImmediateValue value,
                                Relocation relocation, NativeType nativeType)
{
  return NativeBlock_pushLiteral(this, LiteralType_Absolute,
                                 NULL, value, 0, relocation, nativeType);
}
NativeBlock_pushSymbolLiteral— Push a new Symbol Literal on NativeBlock.
static inline Literal
NativeBlock_pushSymbolLiteral(NativeBlock this,
                              Symbol symbol, ImmediateValue offset,
                              Relocation relocation, NativeType nativeType)
{
  return NativeBlock_pushLiteral(this, LiteralType_Symbol,
                                 symbol, 0, offset, relocation, nativeType);
}
NativeBlock_pushLabelLiteral— Push a new Label Literal on NativeBlock.
static inline Literal
NativeBlock_pushLabelLiteral(NativeBlock this,
                             Label label, ImmediateValue offset,
                             Relocation relocation, NativeType nativeType)
{
  return NativeBlock_pushLiteral(this, LiteralType_Label,
                                 label, 0, offset, relocation, nativeType);
}
NativeBlock_pretty— Pretty-print this NativeBlock.
bool
NativeBlock_pretty(const_NativeBlock this, FILE *file, int offset);