NativeStream.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.
NativeStream— Container for native code.
struct NativeStream_ { //@args Memory memory, int32_t aboutBlocks ConstantList_ LABELS[1]; // The ConstantList for Label(s). ConstantList_ SYMBOLS[1]; // The ConstantList for Symbol(s). IDList_ NATIVEBLOCKS[1]; // List of NativeBlock(s) of this NativeStream. //@access ENTRYBLOCK IDList_firstItem(NativeStream_NATIVEBLOCKS(this)) //@access MEMORY IDList_memory(NativeStream_NATIVEBLOCKS(this)) PlatformUInt NATIVEPC; // The native PC at which this NativeStream is encoded. PlatformUInt CODESIZE; // The size required to encode this NativeStream. void *CODEBUFFER; // Buffer where this NativeStream is encoded. const char *(*MAKELABELNAME)(const void *Label); const char *(*MAKESYMBOLNAME)(const void *Symbol); };
NativeStream_new— Create a new NativeStream.
- parent
- The parent memory allocator for this NativeStream.
- aboutBlocks
- About the number of NativeBlocks(s) in this NativeStream.
NativeStream NativeStream_new(Memory parent, int32_t aboutBlocks);
NativeStream_delete— Delete a NativeStream.
NativeStream NativeStream_delete(NativeStream this);
NativeStream_labels— For use by NativeStream_LABELS_FOREACH_Constant.
static inline const_ConstantList NativeStream_labels(const_NativeStream this) { return NativeStream_LABELS(this); }
NativeStream_LABELS_FOREACH_Constant— Iterate this NativeStream label Constant(s).
#define NativeStream_LABELS_FOREACH_Constant(this, constant) { \ const_ConstantList NativeStream_LABELS = NativeStream_labels(this); \ ConstantList_FOREACH_Constant(NativeStream_LABELS, constant) #define NativeStream_LABELS_ENDEACH_Constant \ ConstantList_ENDEACH_Constant \ }
NativeStream_makeLabelConstant— Make a Constant in this NativeStream labels.
Always return a valid Constant (not NULL and constructed).
static inline Constant NativeStream_makeLabelConstant(NativeStream this, Label label, ImmediateValue offset) { ConstantList labels = NativeStream_LABELS(this); return ConstantList_push(labels, ConstantType_Label, label, 0, offset); }
NativeStream_symbols— For use by NativeStream_SYMBOLS_FOREACH_Constant.
static inline const_ConstantList NativeStream_symbols(const_NativeStream this) { return NativeStream_SYMBOLS(this); }
NativeStream_SYMBOLS_FOREACH_Constant— Iterate this NativeStream symbol Constant(s).
#define NativeStream_SYMBOLS_FOREACH_Constant(this, constant) { \ const_ConstantList NativeStream_SYMBOLS = NativeStream_symbols(this); \ ConstantList_FOREACH_Constant(NativeStream_SYMBOLS, constant) #define NativeStream_SYMBOLS_ENDEACH_Constant \ ConstantList_ENDEACH_Constant \ }
NativeStream_makeSymbolConstant— Make a Constant in this NativeStream symbols.
Always return a valid Constant (not NULL and constructed).
static inline Constant NativeStream_makeSymbolConstant(NativeStream this, Symbol symbol, ImmediateValue offset) { ConstantList symbols = NativeStream_SYMBOLS(this); return ConstantList_push(symbols, ConstantType_Symbol, symbol, 0, offset); }
NativeStream_nativeBlocks— For use by NativeStream_FOREACH_NativeBlock.
static inline const_IDList NativeStream_nativeBlocks(const_NativeStream this) { return NativeStream_NATIVEBLOCKS(this); }
NativeStream_FOREACH_NativeBlock— Iterate first to last NativeBlock.
#define NativeStream_FOREACH_NativeBlock(this, nativeBlock) \ IDList_FOREACH(NativeStream_nativeBlocks(this), NativeBlock_, nativeBlock) #define NativeStream_ENDEACH_NativeBlock \ IDList_ENDEACH;
NativeStream_pushNativeBlock— Push a new NativeBlock last on this NativeStream.
- processor
- The Processor for the new NativeBlock.
- flags
- The NativeBlockFlags for the new NativeBlock.
- label
- label (Label Constant key) for the new NativeBlock.
struct NativeBlock_ * NativeStream_pushNativeBlock(NativeStream this, Processor processor, NativeBlockFlags flags, Label label);
NativeStream_nativePC— The native PC of this NativeStream.
static inline PlatformUInt NativeStream_nativePC(const_NativeStream this) { return NativeStream_NATIVEPC(this); }
NativeStream_codeSize— The code size of this NativeStream.
static inline PlatformUInt NativeStream_codeSize(const_NativeStream this) { return NativeStream_CODESIZE(this); }
NativeStream_setMakeLabelName— Set the NativeStream_MakeLabelName call-back.
void NativeStream_setMakeLabelName(NativeStream this, const char *(*makeLabelName)(const void *Label));
NativeStream_setMakeSymbolName— Set the NativeStream_MakeSymbolName call-back.
void NativeStream_setMakeSymbolName(NativeStream this, const char *(*makeSymbolName)(const void *Symbol));
NativeStream_scoreboardInstructions— Scoreboard this NativeStream Instruction(s).
Simple Instruction scheduling using a Scoreboard on the linear order of Instruction(s) in the NativeStream. Only useful for non-optimizing JIT since it is flow-insensitive.
void NativeStream_scoreboardInstructions(NativeStream this, int windowSize);
NativeStream_assumeScheduled— Assume this NativeStream Instruction(s) are scheduled.
Should be called before NativeStream_encode
when the Instruction(s) already have
valid issue dates in their NativeBlock. Else call NativeStream_assumeUnscheduled
.
void NativeStream_assumeScheduled(NativeStream this);
NativeStream_assumeUnscheduled— Assume this NativeStream Instruction(s) are not scheduled.
Must be called if NativeStream_assumeScheduled
is not called before
NativeStream_encode
.
void NativeStream_assumeUnscheduled(NativeStream this);
NativeStream_getCodeSize— Get the size required to encode this NativeStream.
nativePC
- A nativePC with same alignment as that will be used for encoding.
- Return
- The size needed to encode this NativeStream.
PlatformUInt NativeStream_getCodeSize(NativeStream this, PlatformUInt nativePC);
NativeStream_encode— Encode this NativeStream in the given code buffer.
- Require
- NativeStream_getCodeSize has been called before.
void NativeStream_encode(NativeStream this, PlatformUInt nativePC, void *codeBuffer, InstructionRelocationFixup instruction_fixup_function, LiteralRelocationFixup literal_fixup_function, void* user_data);
NativeStream_pretty— Pretty-print this NativeStream.
bool NativeStream_pretty(const_NativeStream this, FILE *file);