示例#1
0
void GenPreIdentAccess(int label)
{
  if (UseGp)
    return;
  printf2("\t.set\tnoat\n\tlui\t$1, %%hi(");
  GenPrintLabel(IdentTable + label);
  puts2(")");
}
示例#2
0
void GenAddrData(int Size, char* Label)
{
  if (Size == 1)
    printf2("\t.byte\t");
  else if (Size == 2)
    printf2("\t.half\t");
  else if (Size == 4)
    printf2("\t.word\t");
  GenPrintLabel(Label); puts2("");
}
示例#3
0
void GenPrintOperand(int op, int val)
{
  if (op >= MipsOpRegZero && op <= MipsOpRegRa)
  {
    printf2("$%d", op);
  }
  else if (op >= MipsOpIndRegZero && op <= MipsOpIndRegRa)
  {
    printf2("%d($%d)", truncInt(val), op - MipsOpIndRegZero);
  }
  else
  {
    switch (op)
    {
    case MipsOpConst: printf2("%d", truncInt(val)); break;
    case MipsOpLabelGpOption:
      if (UseGp)
      {
        printf2("%%gp_rel(");
        GenPrintLabel(IdentTable + val);
        printf2(")($28)");
      }
      else
      {
        printf2("%%lo(");
        GenPrintLabel(IdentTable + val);
        printf2(")($1)");
      }
      break;
    case MipsOpLabel: GenPrintLabel(IdentTable + val); break;
    case MipsOpNumLabel: GenPrintNumLabel(val); break;

    default:
      //error("WTF!\n");
      errorInternal(100);
      break;
    }
  }
}
示例#4
0
文件: cgtr3k2.c 项目: gdos/SmallerC
STATIC
void GenAddrData(int Size, char* Label, int ofs)
{
  ofs = truncInt(ofs);
  if (Size == 1)
    printf2("\t.db\t");
  else if (Size == 2)
    printf2("\t.dw\t");
  else if (Size == 4)
    printf2("\t.dd\t");
  GenPrintLabel(Label);
  if (ofs)
    printf2(" %+d", ofs);
  puts2("");
}
示例#5
0
文件: cgtr3k2.c 项目: gdos/SmallerC
STATIC
void GenPrintOperand(int op, int val)
{
  if (op >= Tr32OpReg0 && op <= Tr32OpRegFlags)
  {
    GenRegsUsed |= 1 << op;
    switch (op)
    {
    case Tr32OpRegBp:    printf2("%%bp");    break;
    case Tr32OpRegSp:    printf2("%%sp");    break;
    case Tr32OpRegY:     printf2("%%y");     break;
    case Tr32OpRegFlags: printf2("%%flags"); break;
    default:             printf2("%%r%d", op);
    }
  }
  else if (op >= Tr32OpIndReg0 && op <= Tr32OpIndRegFlags)
  {
    GenPrintOperand(op - Tr32OpIndReg0, 0);
    val = truncInt(val);
    if (val)
      printf2(", %d", val);
  }
  else
  {
    switch (op)
    {
    case Tr32OpConst: printf2("%d", truncInt(val)); break;
    case Tr32OpLabel: GenPrintLabel(IdentTable + val); break;
    case Tr32OpNumLabel: GenPrintNumLabel(val); break;

    default:
      //error("WTF!\n");
      errorInternal(100);
      break;
    }
  }
}