nanojit::LIns Class Reference

#include <LIR.h>

List of all members.

Public Member Functions

LIns *FASTCALL oprnd1 () const
LIns *FASTCALL oprnd2 () const
LIns *FASTCALL oprnd3 () const
LOpcode opcode () const
uint8_t imm8 () const
uint8_t imm8b () const
int16_t imm16 () const
int32_t imm24 () const
LInsref () const
int32_t imm32 () const
uint8_t resv () const
void * payload () const
Pagepage ()
int32_t size () const
void setSize (int32_t bytes)
LInsarg (uint32_t i)
int32_t immdisp () const
int32_t constval () const
uint64_t constvalq () const
double constvalf () const
bool isCse (const CallInfo *functions) const
bool isop (LOpcode o) const
bool isQuad () const
bool isCond () const
bool isCmp () const
bool isCall () const
bool isStore () const
bool isLoad () const
bool isGuard () const
bool isconst () const
bool isconstval (int32_t val) const
bool isconstq () const
bool isTramp () const
bool isBranch () const
void setimm16 (int32_t i)
void setimm24 (int32_t i)
void setresv (uint32_t resv)
void initOpcode (LOpcode)
void setOprnd1 (LIns *)
void setOprnd2 (LIns *)
void setOprnd3 (LIns *)
void setDisp (int8_t d)
void target (LIns *t)
LIns ** targetAddr ()
LInsgetTarget ()
SideExitexit ()
uint32_t argc ()
uint8_t fid () const

Static Public Member Functions

static bool sameop (LIns *a, LIns *b)

Private Member Functions

uint32_t reference (LIns *) const
LInsderef (int32_t off) const

Friends

class LirBufWriter

Classes

struct  c_type
struct  g_type
struct  i_type
struct  sti_type
struct  t_type
struct  u_type


Detailed Description

Definition at line 235 of file LIR.h.


Member Function Documentation

LIns* nanojit::LIns::arg uint32_t  i  )  [inline]
 

Definition at line 336 of file LIR.h.

References argc(), nanojit::argwords(), c, and deref().

00336                                      {
00337             uint32_t c = argc();
00338             NanoAssert(i < c);
00339             uint8_t* offs = (uint8_t*) (this-argwords(c));
00340             return deref(offs[i]);
00341         }

uint32_t nanojit::LIns::argc  )  [inline]
 

Definition at line 426 of file LIR.h.

References c, nanojit::LIns::c_type::imm8b, and isCall().

Referenced by arg().

00426                                {
00427             NanoAssert(isCall());
00428             return c.imm8b;
00429         }

int32_t nanojit::LIns::constval  )  const [inline]
 

Definition at line 359 of file LIR.h.

References imm16(), imm32(), isconst(), isop(), and nanojit::LIR_short.

Referenced by immdisp().

00360         {
00361             NanoAssert(isconst());
00362             return isop(LIR_short) ? imm16() : imm32();
00363         }

double nanojit::LIns::constvalf  )  const [inline]
 

Definition at line 380 of file LIR.h.

References isconstq(), and u.

00381         {
00382             NanoAssert(isconstq());
00383         #ifdef AVMPLUS_UNALIGNED_ACCESS
00384             return *(const double*)(this-2);
00385         #else
00386             union { uint64_t tmp; double tmpf; } u;
00387             const int32_t* src = (const int32_t*)(this-2);
00388             int32_t* dst = (int32_t*)&u;
00389             dst[0] = src[0];
00390             dst[1] = src[1];
00391             return u.tmpf;
00392         #endif
00393         }

uint64_t nanojit::LIns::constvalq  )  const [inline]
 

Definition at line 365 of file LIR.h.

References isconstq().

00366         {
00367             NanoAssert(isconstq());
00368         #ifdef AVMPLUS_UNALIGNED_ACCESS
00369             return *(const uint64_t*)(this-2);
00370         #else
00371             uint64_t tmp;
00372             const int32_t* src = (const int32_t*)(this-2);
00373             int32_t* dst = (int32_t*)&tmp;
00374             dst[0] = src[0];
00375             dst[1] = src[1];
00376             return tmp;
00377         #endif
00378         }

LIns* nanojit::LIns::deref int32_t  off  )  const [private]
 

Referenced by arg().

SideExit* nanojit::LIns::exit  ) 
 

uint8_t nanojit::LIns::fid  )  const [inline]
 

Definition at line 430 of file LIR.h.

References c, nanojit::LIns::c_type::imm8a, and isCall().

00430                                     {
00431             NanoAssert(isCall());
00432             return c.imm8a;
00433         }

LIns* nanojit::LIns::getTarget  ) 
 

int16_t nanojit::LIns::imm16  )  const [inline]
 

Definition at line 317 of file LIR.h.

References i, and nanojit::LIns::i_type::imm16.

Referenced by constval().

00317 { return i.imm16; }

int32_t nanojit::LIns::imm24  )  const [inline]
 

Definition at line 318 of file LIR.h.

References nanojit::LIns::t_type::imm24, and t.

00318 { return t.imm24; }

int32_t nanojit::LIns::imm32  )  const [inline]
 

Definition at line 322 of file LIR.h.

Referenced by constval().

00322 { return *(int32_t*)(this-1); }

uint8_t nanojit::LIns::imm8  )  const [inline]
 

Definition at line 315 of file LIR.h.

References c, and nanojit::LIns::c_type::imm8a.

00315 { return c.imm8a; }

uint8_t nanojit::LIns::imm8b  )  const [inline]
 

Definition at line 316 of file LIR.h.

References c, and nanojit::LIns::c_type::imm8b.

00316 { return c.imm8b; }

int32_t nanojit::LIns::immdisp  )  const [inline]
 

Definition at line 343 of file LIR.h.

References nanojit::LIns::u_type::code, constval(), nanojit::LIns::sti_type::disp, nanojit::LIR64, nanojit::LIR_sti, oprnd3(), sti, and u.

00344         {
00345             return (u.code&~LIR64) == LIR_sti ? sti.disp : oprnd3()->constval();
00346         }

void nanojit::LIns::initOpcode LOpcode   ) 
 

bool nanojit::LIns::isBranch  )  const [inline]
 

Definition at line 408 of file LIR.h.

References isop(), nanojit::LIR_j, nanojit::LIR_jf, and nanojit::LIR_jt.

00408                               {
00409             return isop(LIR_jt) || isop(LIR_jf) || isop(LIR_j);
00410         }

bool nanojit::LIns::isCall  )  const [inline]
 

Definition at line 400 of file LIR.h.

References nanojit::LIns::u_type::code, nanojit::isCall(), and u.

Referenced by argc(), and fid().

00400 { return nanojit::isCall(u.code); }

bool nanojit::LIns::isCmp  )  const
 

bool nanojit::LIns::isCond  )  const
 

bool nanojit::LIns::isconst  )  const [inline]
 

Definition at line 404 of file LIR.h.

References nanojit::LIns::u_type::code, nanojit::isConst(), and u.

Referenced by constval().

00404 { return nanojit::isConst(u.code); }

bool nanojit::LIns::isconstq  )  const
 

Referenced by constvalf(), and constvalq().

bool nanojit::LIns::isconstval int32_t  val  )  const
 

bool nanojit::LIns::isCse const CallInfo functions  )  const
 

bool nanojit::LIns::isGuard  )  const [inline]
 

Definition at line 403 of file LIR.h.

References nanojit::LIns::u_type::code, nanojit::isGuard(), and u.

00403 { return nanojit::isGuard(u.code); }

bool nanojit::LIns::isLoad  )  const [inline]
 

Definition at line 402 of file LIR.h.

References nanojit::LIns::u_type::code, nanojit::isLoad(), and u.

00402 { return nanojit::isLoad(u.code); }

bool nanojit::LIns::isop LOpcode  o  )  const [inline]
 

Definition at line 396 of file LIR.h.

References nanojit::LIns::u_type::code, and u.

Referenced by constval(), isBranch(), isTramp(), setSize(), and size().

00396 { return u.code == o; }

bool nanojit::LIns::isQuad  )  const [inline]
 

Definition at line 397 of file LIR.h.

References nanojit::LIns::u_type::code, nanojit::LIR64, and u.

00397 { return (u.code & LIR64) != 0; }

bool nanojit::LIns::isStore  )  const [inline]
 

Definition at line 401 of file LIR.h.

References nanojit::LIns::u_type::code, nanojit::isStore(), and u.

00401 { return nanojit::isStore(u.code); }

bool nanojit::LIns::isTramp  )  const [inline]
 

Definition at line 407 of file LIR.h.

References isop(), nanojit::LIR_neartramp, and nanojit::LIR_tramp.

00407 {return isop(LIR_neartramp) || isop(LIR_tramp); }

LOpcode nanojit::LIns::opcode  )  const [inline]
 

Definition at line 314 of file LIR.h.

References nanojit::LIns::u_type::code, and u.

00314 { return u.code; }

LIns* FASTCALL nanojit::LIns::oprnd1  )  const
 

LIns* FASTCALL nanojit::LIns::oprnd2  )  const
 

LIns* FASTCALL nanojit::LIns::oprnd3  )  const
 

Referenced by immdisp().

Page* nanojit::LIns::page  )  [inline]
 

Definition at line 325 of file LIR.h.

References nanojit::NJ_PAGE_SIZE.

00325 { return (Page*) alignTo(this,NJ_PAGE_SIZE); }

void* nanojit::LIns::payload  )  const
 

LIns* nanojit::LIns::ref  )  const [inline]
 

Definition at line 319 of file LIR.h.

References nanojit::LIns::t_type::code, nanojit::LIns::t_type::imm24, and t.

00319                                         { 
00320             return (t.code & 1) ? (LIns*)this+t.imm24 : *(LIns**)(this-1);
00321         }

uint32_t nanojit::LIns::reference LIns  )  const [private]
 

uint8_t nanojit::LIns::resv  )  const [inline]
 

Definition at line 323 of file LIR.h.

References g, and nanojit::LIns::g_type::resv.

Referenced by nanojit::MMGC_SUBCLASS_DECL::getresv().

00323 { return g.resv; }

static bool nanojit::LIns::sameop LIns a,
LIns b
[inline, static]
 

Definition at line 348 of file LIR.h.

References nanojit::LIns::u_type::code, and u.

00349         {
00350             // hacky but more efficient than opcode() == opcode() due to bit masking of 7-bit field
00351             union { 
00352                 uint32_t x; 
00353                 u_type u;
00354             } tmp;
00355             tmp.x = *(uint32_t*)a ^ *(uint32_t*)b;
00356             return tmp.u.code == 0;
00357         }

void nanojit::LIns::setDisp int8_t  d  ) 
 

void nanojit::LIns::setimm16 int32_t  i  ) 
 

void nanojit::LIns::setimm24 int32_t  i  ) 
 

void nanojit::LIns::setOprnd1 LIns  ) 
 

void nanojit::LIns::setOprnd2 LIns  ) 
 

void nanojit::LIns::setOprnd3 LIns  ) 
 

void nanojit::LIns::setresv uint32_t  resv  ) 
 

void nanojit::LIns::setSize int32_t  bytes  )  [inline]
 

Definition at line 330 of file LIR.h.

References i, nanojit::LIns::i_type::imm16, isop(), and nanojit::LIR_alloc.

00330                                            {
00331             NanoAssert(isop(LIR_alloc) && (bytes&3)==0 && isU16(bytes>>2));
00332             i.imm16 = bytes>>2;
00333         }

int32_t nanojit::LIns::size  )  const [inline]
 

Definition at line 326 of file LIR.h.

References i, nanojit::LIns::i_type::imm16, isop(), and nanojit::LIR_alloc.

00326                                      {
00327             NanoAssert(isop(LIR_alloc));
00328             return i.imm16<<2;
00329         }

void nanojit::LIns::target LIns t  ) 
 

LIns** nanojit::LIns::targetAddr  ) 
 


Friends And Related Function Documentation

friend class LirBufWriter [friend]
 

Definition at line 237 of file LIR.h.


Member Data Documentation

c_type nanojit::LIns::c [private]
 

Definition at line 299 of file LIR.h.

Referenced by arg(), argc(), fid(), imm8(), and imm8b().

g_type nanojit::LIns::g [private]
 

Definition at line 302 of file LIR.h.

Referenced by resv().

i_type nanojit::LIns::i [private]
 

Definition at line 300 of file LIR.h.

Referenced by imm16(), setSize(), and size().

sti_type nanojit::LIns::sti [private]
 

Definition at line 303 of file LIR.h.

Referenced by immdisp().

t_type nanojit::LIns::t [private]
 

Definition at line 301 of file LIR.h.

Referenced by imm24(), and ref().

u_type nanojit::LIns::u [private]
 

Definition at line 298 of file LIR.h.

Referenced by constvalf(), immdisp(), isCall(), isconst(), isGuard(), isLoad(), isop(), isQuad(), isStore(), opcode(), and sameop().


The documentation for this class was generated from the following file:
Generated on Sun Oct 12 18:51:41 2008 for Tamarin by  doxygen 1.4.6