asCByteCode Class Reference

#include <as_bytecode.h>

List of all members.

Public Member Functions

 asCByteCode (asCScriptEngine *engine)
 ~asCByteCode ()
void ClearAll ()
int GetSize ()
void Finalize ()
int Optimize ()
void ExtractLineNumbers ()
int ResolveJumpAddresses ()
int FindLabel (int label, cByteInstruction *from, cByteInstruction **dest, int *positionDelta)
void AddPath (asCArray< cByteInstruction * > &paths, cByteInstruction *instr, int stackSize)
void Output (asDWORD *array)
void AddCode (asCByteCode *bc)
void PostProcess ()
void DebugOutput (const char *name, asCModule *module, asCScriptEngine *engine)
int GetLastInstr ()
int RemoveLastInstr ()
asDWORD GetLastInstrValueDW ()
void InsertIfNotExists (asCArray< int > &vars, int var)
void GetVarsUsed (asCArray< int > &vars)
bool IsVarUsed (int offset)
void ExchangeVar (int oldOffset, int newOffset)
void Label (short label)
void Line (int line, int column)
void Call (asEBCInstr bc, int funcID, int pop)
void Alloc (asEBCInstr bc, void *objID, int funcID, int pop)
void Ret (int pop)
void JmpP (int var, asDWORD max)
int InsertFirstInstrDWORD (asEBCInstr bc, asDWORD param)
int InsertFirstInstrQWORD (asEBCInstr bc, asQWORD param)
int Instr (asEBCInstr bc)
int InstrQWORD (asEBCInstr bc, asQWORD param)
int InstrDOUBLE (asEBCInstr bc, double param)
int InstrPTR (asEBCInstr bc, void *param)
int InstrDWORD (asEBCInstr bc, asDWORD param)
int InstrWORD (asEBCInstr bc, asWORD param)
int InstrSHORT (asEBCInstr bc, short param)
int InstrFLOAT (asEBCInstr bc, float param)
int InstrINT (asEBCInstr bc, int param)
int InstrW_W_W (asEBCInstr bc, int a, int b, int c)
int InstrSHORT_B (asEBCInstr bc, short a, asBYTE b)
int InstrSHORT_W (asEBCInstr bc, short a, asWORD b)
int InstrSHORT_DW (asEBCInstr bc, short a, asDWORD b)
int InstrSHORT_QW (asEBCInstr bc, short a, asQWORD b)
int InstrW_DW (asEBCInstr bc, asWORD a, asDWORD b)
int InstrW_QW (asEBCInstr bc, asWORD a, asQWORD b)
int InstrW_FLOAT (asEBCInstr bc, asWORD a, float b)
int InstrW_W (asEBCInstr bc, int w, int b)
int Pop (int numDwords)
int Push (int numDwords)
void DefineTemporaryVariable (int varOffset)

Public Attributes

asCArray< intlineNumbers
int largestStackUsed

Protected Member Functions

bool CanBeSwapped (cByteInstruction *curr)
bool IsCombination (cByteInstruction *curr, asEBCInstr bc1, asEBCInstr bc2)
bool IsCombination (cByteInstruction *curr, asEBCInstr bc1, asEBCInstr bc2, asEBCInstr bc3)
cByteInstructionChangeFirstDeleteNext (cByteInstruction *curr, asEBCInstr bc)
cByteInstructionDeleteFirstChangeNext (cByteInstruction *curr, asEBCInstr bc)
cByteInstructionDeleteInstruction (cByteInstruction *instr)
void RemoveInstruction (cByteInstruction *instr)
cByteInstructionGoBack (cByteInstruction *curr)
void InsertBefore (cByteInstruction *before, cByteInstruction *instr)
bool RemoveUnusedValue (cByteInstruction *curr, cByteInstruction **next)
bool IsTemporary (short offset)
bool IsTempRegUsed (cByteInstruction *curr)
bool IsTempVarRead (cByteInstruction *curr, int offset)
bool PostponeInitOfTemp (cByteInstruction *curr, cByteInstruction **next)
bool IsTempVarReadByInstr (cByteInstruction *curr, int var)
bool IsTempVarOverwrittenByInstr (cByteInstruction *curr, int var)
bool IsInstrJmpOrLabel (cByteInstruction *curr)
int AddInstruction ()
int AddInstructionFirst ()

Protected Attributes

cByteInstructionfirst
cByteInstructionlast
asCArray< inttemporaryVariables
asCScriptEngineengine

Detailed Description

Definition at line 56 of file as_bytecode.h.


Constructor & Destructor Documentation

BEGIN_AS_NAMESPACE asCByteCode::asCByteCode ( asCScriptEngine engine  ) 

Definition at line 50 of file as_bytecode.cpp.

References first, largestStackUsed, and last.

asCByteCode::~asCByteCode (  ) 

Definition at line 59 of file as_bytecode.cpp.

References ClearAll().


Member Function Documentation

void asCByteCode::AddCode ( asCByteCode bc  ) 
int asCByteCode::AddInstruction (  )  [protected]
int asCByteCode::AddInstructionFirst (  )  [protected]
void asCByteCode::AddPath ( asCArray< cByteInstruction * > &  paths,
cByteInstruction instr,
int  stackSize 
)
void asCByteCode::Alloc ( asEBCInstr  bc,
void *  objID,
int  funcID,
int  pop 
)
void asCByteCode::Call ( asEBCInstr  bc,
int  funcID,
int  pop 
)
bool asCByteCode::CanBeSwapped ( cByteInstruction curr  )  [protected]

Definition at line 314 of file as_bytecode.cpp.

References cByteInstruction::next, and cByteInstruction::op.

Referenced by Optimize().

cByteInstruction * asCByteCode::ChangeFirstDeleteNext ( cByteInstruction curr,
asEBCInstr  bc 
) [protected]
void asCByteCode::ClearAll (  ) 
void asCByteCode::DebugOutput ( const char *  name,
asCModule module,
asCScriptEngine engine 
)
void asCByteCode::DefineTemporaryVariable ( int  varOffset  ) 

Definition at line 2165 of file as_bytecode.cpp.

References asCArray< T >::PushLast(), and temporaryVariables.

Referenced by asCCompiler::CompileFunction().

cByteInstruction * asCByteCode::DeleteFirstChangeNext ( cByteInstruction curr,
asEBCInstr  bc 
) [protected]
cByteInstruction * asCByteCode::DeleteInstruction ( cByteInstruction instr  )  [protected]
void asCByteCode::ExchangeVar ( int  oldOffset,
int  newOffset 
)
void asCByteCode::ExtractLineNumbers (  ) 
void asCByteCode::Finalize (  ) 
int asCByteCode::FindLabel ( int  label,
cByteInstruction from,
cByteInstruction **  dest,
int positionDelta 
)
int asCByteCode::GetLastInstr (  ) 
asDWORD asCByteCode::GetLastInstrValueDW (  ) 

Definition at line 2158 of file as_bytecode.cpp.

References cByteInstruction::arg, ARG_DW, and last.

int asCByteCode::GetSize (  ) 
void asCByteCode::GetVarsUsed ( asCArray< int > &  vars  ) 
cByteInstruction * asCByteCode::GoBack ( cByteInstruction curr  )  [protected]

Definition at line 334 of file as_bytecode.cpp.

References cByteInstruction::prev.

Referenced by Optimize(), PostponeInitOfTemp(), and RemoveUnusedValue().

void asCByteCode::InsertBefore ( cByteInstruction before,
cByteInstruction instr 
) [protected]

Definition at line 289 of file as_bytecode.cpp.

References asASSERT, first, cByteInstruction::next, and cByteInstruction::prev.

Referenced by Optimize(), and PostponeInitOfTemp().

int asCByteCode::InsertFirstInstrDWORD ( asEBCInstr  bc,
asDWORD  param 
)
int asCByteCode::InsertFirstInstrQWORD ( asEBCInstr  bc,
asQWORD  param 
)
void asCByteCode::InsertIfNotExists ( asCArray< int > &  vars,
int  var 
)

Definition at line 101 of file as_bytecode.cpp.

References asCArray< T >::Exists(), and asCArray< T >::PushLast().

Referenced by GetVarsUsed().

int asCByteCode::Instr ( asEBCInstr  bc  ) 
int asCByteCode::InstrDOUBLE ( asEBCInstr  bc,
double  param 
)
int asCByteCode::InstrDWORD ( asEBCInstr  bc,
asDWORD  param 
)
int asCByteCode::InstrFLOAT ( asEBCInstr  bc,
float  param 
)
int asCByteCode::InstrINT ( asEBCInstr  bc,
int  param 
)
int asCByteCode::InstrPTR ( asEBCInstr  bc,
void *  param 
)
int asCByteCode::InstrQWORD ( asEBCInstr  bc,
asQWORD  param 
)
int asCByteCode::InstrSHORT ( asEBCInstr  bc,
short  param 
)
int asCByteCode::InstrSHORT_B ( asEBCInstr  bc,
short  a,
asBYTE  b 
)
int asCByteCode::InstrSHORT_DW ( asEBCInstr  bc,
short  a,
asDWORD  b 
)
int asCByteCode::InstrSHORT_QW ( asEBCInstr  bc,
short  a,
asQWORD  b 
)
int asCByteCode::InstrSHORT_W ( asEBCInstr  bc,
short  a,
asWORD  b 
)
int asCByteCode::InstrW_DW ( asEBCInstr  bc,
asWORD  a,
asDWORD  b 
)
int asCByteCode::InstrW_FLOAT ( asEBCInstr  bc,
asWORD  a,
float  b 
)
int asCByteCode::InstrW_QW ( asEBCInstr  bc,
asWORD  a,
asQWORD  b 
)
int asCByteCode::InstrW_W ( asEBCInstr  bc,
int  w,
int  b 
)
int asCByteCode::InstrW_W_W ( asEBCInstr  bc,
int  a,
int  b,
int  c 
)
int asCByteCode::InstrWORD ( asEBCInstr  bc,
asWORD  param 
)
bool asCByteCode::IsCombination ( cByteInstruction curr,
asEBCInstr  bc1,
asEBCInstr  bc2,
asEBCInstr  bc3 
) [protected]

Definition at line 250 of file as_bytecode.cpp.

References cByteInstruction::next, and cByteInstruction::op.

bool asCByteCode::IsCombination ( cByteInstruction curr,
asEBCInstr  bc1,
asEBCInstr  bc2 
) [protected]

Definition at line 242 of file as_bytecode.cpp.

References cByteInstruction::next, and cByteInstruction::op.

Referenced by Optimize().

bool asCByteCode::IsInstrJmpOrLabel ( cByteInstruction curr  )  [protected]

Definition at line 841 of file as_bytecode.cpp.

References cByteInstruction::op.

Referenced by PostponeInitOfTemp().

bool asCByteCode::IsTemporary ( short  offset  )  [protected]

Definition at line 566 of file as_bytecode.cpp.

References asCArray< T >::GetLength(), n, and temporaryVariables.

Referenced by PostponeInitOfTemp(), and RemoveUnusedValue().

bool asCByteCode::IsTempRegUsed ( cByteInstruction curr  )  [protected]

Definition at line 931 of file as_bytecode.cpp.

References cByteInstruction::next, and cByteInstruction::op.

Referenced by Optimize(), and RemoveUnusedValue().

bool asCByteCode::IsTempVarOverwrittenByInstr ( cByteInstruction curr,
int  var 
) [protected]

Definition at line 857 of file as_bytecode.cpp.

References cByteInstruction::op, and cByteInstruction::wArg.

Referenced by IsTempVarRead(), and PostponeInitOfTemp().

bool asCByteCode::IsTempVarRead ( cByteInstruction curr,
int  offset 
) [protected]
bool asCByteCode::IsTempVarReadByInstr ( cByteInstruction curr,
int  var 
) [protected]

Definition at line 819 of file as_bytecode.cpp.

References cByteInstruction::op, and cByteInstruction::wArg.

Referenced by IsTempVarRead(), and PostponeInitOfTemp().

bool asCByteCode::IsVarUsed ( int  offset  ) 
void asCByteCode::JmpP ( int  var,
asDWORD  max 
)
void asCByteCode::Label ( short  label  ) 
void asCByteCode::Line ( int  line,
int  column 
)
int asCByteCode::Optimize (  ) 
void asCByteCode::Output ( asDWORD *  array  ) 
int asCByteCode::Pop ( int  numDwords  ) 
bool asCByteCode::PostponeInitOfTemp ( cByteInstruction curr,
cByteInstruction **  next 
) [protected]
void asCByteCode::PostProcess (  ) 
int asCByteCode::Push ( int  numDwords  ) 
void asCByteCode::RemoveInstruction ( cByteInstruction instr  )  [protected]
int asCByteCode::RemoveLastInstr (  ) 
bool asCByteCode::RemoveUnusedValue ( cByteInstruction curr,
cByteInstruction **  next 
) [protected]
int asCByteCode::ResolveJumpAddresses (  ) 
void asCByteCode::Ret ( int  pop  ) 

Member Data Documentation

Definition at line 152 of file as_bytecode.h.

Referenced by ClearAll(), DefineTemporaryVariable(), and IsTemporary().


The documentation for this class was generated from the following files:

Generated on Mon Jan 11 12:04:38 2010 for Werewolf by  doxygen 1.6.1