Ejemplo n.º 1
0
static void dc_callvm_argLongLong_ppc32_sysv(DCCallVM* in_self, DClonglong L)
{
    DCint* p = (DCint*) &L;
    DCCallVM_ppc32* self = (DCCallVM_ppc32*)in_self;
    /* fillup integer register file */
    if (self->mIntRegs < 7)
    {
        /* next free integer register is even (r0, r2, r3) ? */
        /* if not, skip one integer */
        if (self->mIntRegs & 1) self->mIntRegs++;

        self->mRegData.mIntData[self->mIntRegs++] = p[0];
        self->mRegData.mIntData[self->mIntRegs++] = p[1];
    }
    /* OR push onto stack */
    else
    {
        /* in case, mIntRegs == 7, set it to 8 */
        self->mIntRegs = 8;
        /* align stack to 8 byte boundary */
        dcVecResize(&self->mVecHead , ( dcVecSize(&self->mVecHead) + 7 ) & (-8UL) );
        /* push data */
        dcVecAppend(&self->mVecHead,&L,sizeof(DClonglong));
    }
}
Ejemplo n.º 2
0
static void dc_callvm_argFloat_mips_o32(DCCallVM* in_self, DCfloat x)
{
  DCCallVM_mips_o32* self = (DCCallVM_mips_o32*)in_self;

  dcVecAppend(&self->mVecHead, &x, sizeof(DCfloat) );
  if (self->mArgCount < 2) {
/*
   call kernel
        
        mips:
        lwc1	$f12, 4($5)       <--- byte offset 4
	lwc1	$f13, 0($5)
	lwc1	$f14, 12($5)      <--- byte offset 12 
	lwc1	$f15, 8($5)
        mipsel:
        lwc1	$f12, 0($5)       <--- byte offset 4
	lwc1	$f13, 4($5)
	lwc1	$f14, 8($5)      <--- byte offset 12 
	lwc1	$f15, 12($5)

*/
#if defined(__MIPSEL__)
    /* index 0 and 2 */
    self->mRegData.floats[self->mArgCount*2] = x;
#else
    /* index 1 and 3 */
    self->mRegData.floats[self->mArgCount*2+1] = x;
#endif
  }
  self->mArgCount++;
}
Ejemplo n.º 3
0
static void dc_callvm_argFloat_mips_o32(DCCallVM* in_self, DCfloat x)
{
  DCCallVM_mips_o32* self = (DCCallVM_mips_o32*)in_self;

  dcVecAppend(&self->mVecHead, &x, sizeof(DCfloat) );
  if (self->mArgCount < 2) {
#if defined(DC__Endian_LITTLE)
    self->mRegData.u[self->mArgCount].f[0] = x;
#else
    self->mRegData.u[self->mArgCount].f[1] = x;
#endif
#if 0
    self->mRegData.u[self->mArgCount].f[1] = x;
   call kernel
        
        mips:
        lwc1	$f12, 4($5)       <--- byte offset 4
	lwc1	$f13, 0($5)
	lwc1	$f14, 12($5)      <--- byte offset 12 
	lwc1	$f15, 8($5)
        mipsel:
        lwc1	$f12, 0($5)       <--- byte offset 4
	lwc1	$f13, 4($5)
	lwc1	$f14, 8($5)      <--- byte offset 12 
	lwc1	$f15, 12($5)

#if defined(DC__Endian_LITTLE)
    /* index 0 and 2 */
    self->mRegData.floats[self->mArgCount*2] = x;
#else
    /* index 1 and 3 */
    self->mRegData.floats[self->mArgCount*2+1] = x;
#endif
#endif
  }
Ejemplo n.º 4
0
static void dc_callvm_argDouble_arm32_thumb_eabi(DCCallVM* in_self, DCdouble x)
{
  DCCallVM_arm32_thumb* self = (DCCallVM_arm32_thumb*)in_self;

  /* 64 bit values need to be aligned on 8 byte boundaries */
  dcVecSkip(&self->mVecHead, dcVecSize(&self->mVecHead) & 4);
  dcVecAppend(&self->mVecHead, &x, sizeof(DCdouble));
}
Ejemplo n.º 5
0
static void dc_callvm_argPointer_x64(DCCallVM* in_self, DCpointer x)
{
  DCCallVM_x64* self = (DCCallVM_x64*)in_self;
  if(self->mRegCount.i < numIntRegs)
    *(DCpointer*)&self->mRegData.i[self->mRegCount.i++] = x;
  else
    dcVecAppend(&self->mVecHead, &x, sizeof(DCpointer));
}
Ejemplo n.º 6
0
static void dc_callvm_argDouble_x64(DCCallVM* in_self, DCdouble x)
{
  DCCallVM_x64* self = (DCCallVM_x64*)in_self;
  if(self->mRegCount.f < numFloatRegs)
    self->mRegData.f[self->mRegCount.f++] = x;
  else
    dcVecAppend(&self->mVecHead, &x, sizeof(DCdouble));
}
Ejemplo n.º 7
0
static void dc_callvm_argFloat_mips_eabi(DCCallVM* in_self, DCfloat x)
{
  DCCallVM_mips_eabi* self = (DCCallVM_mips_eabi*)in_self;
  if (self->mSingleRegs < 8) {
    self->mRegData.mSingleData[self->mSingleRegs++] = x;
  } else {
    dcVecAppend(&self->mVecHead, &x, sizeof(DCfloat) );
  }
}
Ejemplo n.º 8
0
static void dc_callvm_argInt_mips_eabi(DCCallVM* in_self, DCint i)
{
  DCCallVM_mips_eabi* self = (DCCallVM_mips_eabi*)in_self;
  /* fillup integer register file */
  if (self->mIntRegs < 8)
    self->mRegData.mIntData[self->mIntRegs++] = i;
  else
    dcVecAppend(&self->mVecHead, &i, sizeof(DCint));
}
Ejemplo n.º 9
0
static void dc_callvm_argLongLong_mips_n64(DCCallVM* in_self, DClonglong Lv)
{
  DCCallVM_mips_n64* self = (DCCallVM_mips_n64*)in_self;
  /* fillup integer register file */
  if (self->mRegCount < 8)
    self->mRegData.mIntData[self->mRegCount++] = Lv;
  else
    dcVecAppend(&self->mVecHead, &Lv, sizeof(DClonglong));
}
Ejemplo n.º 10
0
static void dc_callvm_argInt_ppc32_darwin(DCCallVM* in_self, DCint i)
{
    DCCallVM_ppc32* self = (DCCallVM_ppc32*)in_self;
    /* fillup integer register file */
    if (self->mIntRegs < 8)
        self->mRegData.mIntData[self->mIntRegs++] = i;
    /* AND push onto stack */
    dcVecAppend(&self->mVecHead,&i,sizeof(DCint));
}
Ejemplo n.º 11
0
static void dc_callvm_argLongLong_mips_o32(DCCallVM* in_self, DClonglong Lv)
{
  DCCallVM_mips_o32* self = (DCCallVM_mips_o32*)in_self;
    
  /* 64-bit values need to be aligned on 8 byte boundaries */
  dcVecSkip(&self->mVecHead, dcVecSize(&self->mVecHead) & 4);
  dcVecAppend(&self->mVecHead, &Lv, sizeof(DClonglong));
  self->mArgCount += 1;
}
Ejemplo n.º 12
0
static void dc_callvm_argLongLong_x64(DCCallVM* in_self, DClonglong x)
{
  /* A long long always has 64 bits on the supported x64 platforms (lp64 on unix and llp64 on windows). */
  DCCallVM_x64* self = (DCCallVM_x64*)in_self;
  if(self->mRegCount.i < numIntRegs)
    self->mRegData.i[self->mRegCount.i++] = x;
  else
    dcVecAppend(&self->mVecHead, &x, sizeof(DClonglong));
}
Ejemplo n.º 13
0
static void dc_callvm_argInt_x86_win32_fast_gnu(DCCallVM* in_self, DCint x)
{
  DCCallVM_x86* self = (DCCallVM_x86*) in_self;
  if (self->mIntRegs < 2) {
    *( (int*) dcVecAt(&self->mVecHead, sizeof(DCint) * self->mIntRegs ) ) = x;
    ++( self->mIntRegs );
  } else
    dcVecAppend(&self->mVecHead, &x, sizeof(DCint) );
}
Ejemplo n.º 14
0
static void dc_callvm_argStruct_x64(DCCallVM* in_self, DCstruct* s, DCpointer x)
{
  DCCallVM_x64* self = (DCCallVM_x64*)in_self;
  dcVecAppend(&self->mVecHead, x, s->size);
  /*printf("dc_callvm_argStruct_x64 size = %d\n", (int)s->size);@@@*/
  if (s->size <= 64)
  	  dcArgStructUnroll(in_self, s, x);
  /*else@@@*/
  /*	  dcVecAppend(&self->mVecHead, &x, sizeof(DCpointer));@@@*/
}
Ejemplo n.º 15
0
static void a_double(DCCallVM* in_p, DCdouble x)
{
  DCCallVM_arm64* p = (DCCallVM_arm64*)in_p;
  if (p->f < 8) {
    p->u.D[ p->f ] = x;
    p->f++; 
  } else {
    dcVecAppend(&p->mVecHead, &x, sizeof(DCdouble));
  }
}
Ejemplo n.º 16
0
static void dc_callvm_argDouble_mips_o32(DCCallVM* in_self, DCdouble x)
{
  DCCallVM_mips_o32* self = (DCCallVM_mips_o32*)in_self;
  /* 64-bit values need to be aligned on 8 byte boundaries */
  dcVecSkip(&self->mVecHead, dcVecSize(&self->mVecHead) & 4);
  dcVecAppend(&self->mVecHead, &x, sizeof(DCdouble) );
  if (self->mArgCount < 2)
    self->mRegData.doubles[self->mArgCount] = x;
  self->mArgCount++;
}
static void dc_callvm_argLongLong_sparc64(DCCallVM* in_self, DClonglong x)
{
  DCCallVM_sparc64* self = (DCCallVM_sparc64*)in_self;
  if (self->mIntRegs < IREGS) {
    * ( (DClonglong*) ( dcVecAt(&self->mVecHead, (self->mIntRegs++)*8) ) ) = x;
  } else {
    dcVecAppend(&self->mVecHead, &x, sizeof(DClonglong));
  }
  if (self->mFloatRegs < FREGS) self->mFloatRegs++;
}
Ejemplo n.º 18
0
static void a_i64(DCCallVM* in_self, DClonglong x)
{
  DCCallVM_arm64* p = (DCCallVM_arm64*)in_self;
  if (p->i < 8) {
    p->I[p->i] = x;
    p->i++;
  } else {
    dcVecAppend(&p->mVecHead, &x, sizeof(DClonglong));
  }
}
static void a_int(DCCallVM* in_self, DCint x)
{
  DCCallVM_arm32_armhf* p = (DCCallVM_arm32_armhf*)in_self;
  if (p->i < 16) {
    * (DCint*) dcVecAt(&p->mVecHead, p->i) = x;
    p->i += 4;
  } else {
    dcVecAppend(&p->mVecHead, &x, sizeof(DCint));
  }
}
Ejemplo n.º 20
0
static void dc_callvm_argDouble_mips_n64(DCCallVM* in_self, DCdouble x)
{
  DCCallVM_mips_n64* self = (DCCallVM_mips_n64*)in_self;
  if (self->mRegCount < 8) {
    self->mRegData.mUseDouble |= 1<<( self->mRegCount );
    self->mRegData.mFloatData[self->mRegCount++].d = x;
  } else {
    dcVecAppend(&self->mVecHead, &x, sizeof(DCdouble) );
  }
}
Ejemplo n.º 21
0
static void dc_callvm_argFloat_mips_n64(DCCallVM* in_self, DCfloat x)
{
  DCCallVM_mips_n64* self = (DCCallVM_mips_n64*)in_self;
  if (self->mRegCount < 8) {
    /*self->mRegData.mFloatData[self->mRegCount++].d = (DCdouble) x;*/
    self->mRegData.mFloatData[self->mRegCount++].f = x;
  } else {
    dcVecAppend(&self->mVecHead, &x, sizeof(DCfloat) );
    dcVecSkip(&self->mVecHead, sizeof(DCfloat) );
  }
}
Ejemplo n.º 22
0
static void a_float(DCCallVM* in_p, DCfloat x)
{
  DCCallVM_arm64* p = (DCCallVM_arm64*)in_p;

  if (p->f < 8) {
    p->u.S[ p->f << 1 ] = x;
    p->f++;
  } else {
    dcVecAppend(&p->mVecHead, &x, sizeof(DCfloat));
    dcVecSkip(&p->mVecHead, 4);	/* align to 8-bytes */
  }
}
Ejemplo n.º 23
0
static void dc_callvm_argFloat_ppc32_sysv(DCCallVM* in_self, DCfloat f)
{
    DCCallVM_ppc32* self = (DCCallVM_ppc32*)in_self;

    /* Put as float register (casted to double) */

    if (self->mFloatRegs < 8)
        self->mRegData.mFloatData[self->mFloatRegs++] = (DCdouble) (f);

    else /* OR put float on stack */
        dcVecAppend(&self->mVecHead, &f, sizeof(DCfloat));
}
static void dc_callvm_argDouble_sparc64(DCCallVM* in_self, DCdouble x)
{
  DCCallVM_sparc64* self = (DCCallVM_sparc64*)in_self;
  if (self->mFloatRegs < FREGS) {
    * ((double*)dcVecAt(&self->mVecHead,(IREGS+(self->mFloatRegs++))*8)) = x;
  }
  if (self->mIntRegs < IREGS) {
    self->mIntRegs++;
  } else {
    dcVecAppend(&self->mVecHead, &x, sizeof(DCdouble));
  }
}
Ejemplo n.º 25
0
static void dc_callvm_argDouble_ppc32_sysv(DCCallVM* in_self, DCdouble d)
{
    DCCallVM_ppc32* self = (DCCallVM_ppc32*)in_self;
    if (self->mFloatRegs < 8)
        self->mRegData.mFloatData[self->mFloatRegs++] = d;
    else /* OR push data on stack */
    {
        /* align stack to 8 byte boundary */
        dcVecResize(&self->mVecHead , ( dcVecSize(&self->mVecHead) + 7UL ) & -8UL );
        /* AND push data */
        dcVecAppend(&self->mVecHead,(DCpointer) &d,sizeof(DCdouble));
    }
}
Ejemplo n.º 26
0
static void dc_callvm_argLongLong_ppc64_ellipsis(DCCallVM* in_self, DClonglong L)
{
  DCCallVM_ppc64* self = (DCCallVM_ppc64*)in_self;

  if (dcVecSize(&self->mVecHead) == 0) 
    dcVecSkip(&self->mVecHead,(sizeof(DClonglong))*(self->mIntRegs));

  if (self->mIntRegs < 8) 
    self->mRegData.mIntData[self->mIntRegs++] = L;

  /* push on stack */
  dcVecAppend(&self->mVecHead,&L,sizeof(DClonglong));
}
static void a_float(DCCallVM* in_p, DCfloat x)
{
  DCCallVM_arm32_armhf* p = (DCCallVM_arm32_armhf*)in_p;
  if (p->s < 16) {
    p->S[p->s++] = x;
    if (p->d < p->s) {
      p->d = (p->s+1) & ~(1U);
    } else {
      p->s = p->d;
    }
  } else {
    dcVecAppend(&p->mVecHead, &x, sizeof(DCfloat));
  } 
}
static void a_longlong(DCCallVM* in_self, DClonglong x)
{
  DCCallVM_arm32_armhf* p = (DCCallVM_arm32_armhf*)in_self;

  p->i = (p->i+4) & -8;
  if (p->i < 16) {
    * (DClonglong*) dcVecAt(&p->mVecHead, p->i) = x;
    p->i += 8;
  } else {
    /* 64 bit values need to be aligned on 8 byte boundaries */
    dcVecSkip(&p->mVecHead, dcVecSize(&p->mVecHead) & 4);
    dcVecAppend(&p->mVecHead, &x, sizeof(DClonglong));
  }
}
Ejemplo n.º 29
0
static void dc_callvm_argDouble_ppc32_darwin(DCCallVM* in_self, DCdouble d)
{
    DCCallVM_ppc32* self = (DCCallVM_ppc32*)in_self;
    if (self->mFloatRegs < 13) {
        self->mRegData.mFloatData[self->mFloatRegs++] = d;
        /* skip two integer register file entries */
        if (self->mIntRegs < 8)
            self->mRegData.mIntData[self->mIntRegs++] = ( (DCint*) &d )[0];
        if (self->mIntRegs < 8)
            self->mRegData.mIntData[self->mIntRegs++] = ( (DCint*) &d )[1];
    }
    /* push on stack */
    dcVecAppend(&self->mVecHead, &d, sizeof(DCdouble));
}
Ejemplo n.º 30
0
static void dc_callvm_argFloat_ppc32_darwin(DCCallVM* in_self, DCfloat f)
{
    DCCallVM_ppc32* self = (DCCallVM_ppc32*)in_self;
    if (self->mFloatRegs < 13) {
        self->mRegData.mFloatData[self->mFloatRegs++] = (DCdouble) (f);
    }

    /* AND skip one integer register file entry (write in - for ellipsis calls) */

    if (self->mIntRegs < 8)
        self->mRegData.mIntData[self->mIntRegs++] = *( (DCint*) &f );

    /* AND push on stack */

    dcVecAppend(&self->mVecHead, &f, sizeof(DCfloat));
}