本文整理汇总了C++中comperr函数的典型用法代码示例。如果您正苦于以下问题:C++ comperr函数的具体用法?C++ comperr怎么用?C++ comperr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了comperr函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: zzzcode
void
zzzcode(NODE * p, int c)
{
int sz;
switch (c) {
case 'C': /* remove arguments from stack after subroutine call */
sz = p->n_qual > 16 ? p->n_qual : 16;
printf("\taddiu %s,%s,%d\n", rnames[SP], rnames[SP], sz);
break;
case 'D': /* long long comparison */
twollcomp(p);
break;
case 'E': /* emit emulated ops */
emulop(p);
break;
case 'F': /* emit emulate floating point ops */
fpemulop(p);
break;
case 'G': /* emit hardware floating-point compare op */
fpcmpops(p);
break;
case 'H': /* structure argument */
starg(p);
break;
case 'I': /* high part of init constant */
if (p->n_name[0] != '\0')
comperr("named highword");
fprintf(stdout, CONFMT, (p->n_lval >> 32) & 0xffffffff);
break;
case 'O': /* 64-bit left and right shift operators */
shiftop(p);
break;
case 'Q': /* emit struct assign */
stasg(p);
break;
default:
comperr("zzzcode %c", c);
}
}
开发者ID:enukane,项目名称:netbsd-src,代码行数:50,代码来源:local2.c
示例2: upput
/*
* Write out the upper address, like the upper register of a 2-register
* reference, or the next memory location.
*/
void
upput(NODE * p, int size)
{
size /= SZCHAR;
switch (p->n_op) {
case REG:
if (GCLASS(p->n_rval) == CLASSB || GCLASS(p->n_rval) == CLASSC)
print_reg64name(stdout, p->n_rval, 1);
else
printf("%s", rnames[p->n_rval]);
break;
case NAME:
case OREG:
setlval(p, getlval(p) + size);
adrput(stdout, p);
setlval(p, getlval(p) - size);
break;
case ICON:
printf(CONFMT, getlval(p) >> 32);
break;
default:
comperr("upput bad op %d size %d", p->n_op, size);
}
}
开发者ID:JamesLinus,项目名称:pcc,代码行数:30,代码来源:local2.c
示例3: getlr
NODE *
getlr(NODE *p, int c)
{
/* return the pointer to the left or right side of p, or p itself,
depending on the optype of p */
switch (c) {
case '1':
case '2':
case '3':
case 'D':
if (c == 'D')
c = 0;
else
c -= '0';
if (resc[c].n_op == FREE)
comperr("getlr: free node");
return &resc[c];
case 'L':
return( optype( p->n_op ) == LTYPE ? p : p->n_left );
case 'R':
return( optype( p->n_op ) != BITYPE ? p : p->n_right );
}
cerror( "bad getlr: %c", c );
/* NOTREACHED */
return NULL;
}
开发者ID:JamesLinus,项目名称:pcc,代码行数:31,代码来源:match.c
示例4: swmatch
/*
* Convert a node to REG or OREG.
* Shape is register class where we want the result.
* Returns register class if register nodes.
* If w is: (should be shapes)
* - SRREG - result in register, call geninsn().
* - SROREG - create OREG; call offstar().
* - 0 - clear su, walk down.
*/
static int
swmatch(NODE *p, int shape, int w)
{
int rv = 0;
F2DEBUG(("swmatch: p=%p, shape=%s, w=%s\n", p, prcook(shape), srtyp[w]));
switch (w) {
case SRREG:
rv = geninsn(p, shape);
break;
case SROREG:
/* should be here only if op == UMUL */
if (p->n_op != UMUL && p->n_op != FLD)
comperr("swmatch %p", p);
if (p->n_op == FLD) {
offstar(p->n_left->n_left, shape);
p->n_left->n_su = 0;
} else
offstar(p->n_left, shape);
p->n_su = 0;
rv = ffs(shape)-1;
break;
case 0:
if (optype(p->n_op) == BITYPE)
swmatch(p->n_right, 0, 0);
if (optype(p->n_op) != LTYPE)
swmatch(p->n_left, 0, 0);
p->n_su = 0;
}
return rv;
}
开发者ID:JamesLinus,项目名称:pcc,代码行数:44,代码来源:match.c
示例5: upput
/*
* Write out the upper address, like the upper register of a 2-register
* reference, or the next memory location.
*/
void
upput(NODE * p, int size)
{
size /= SZCHAR;
switch (p->n_op) {
case REG:
if (GCLASS(p->n_rval) == CLASSB || GCLASS(p->n_rval) == CLASSC)
print_reg64name(stdout, p->n_rval, 1);
else
fputs(rnames[p->n_rval], stdout);
break;
case NAME:
case OREG:
p->n_lval += size;
adrput(stdout, p);
p->n_lval -= size;
break;
case ICON:
fprintf(stdout, CONFMT, p->n_lval >> 32);
break;
default:
comperr("upput bad op %d size %d", p->n_op, size);
}
}
开发者ID:enukane,项目名称:netbsd-src,代码行数:30,代码来源:local2.c
示例6: prologue
void
prologue(struct interpass_prolog *ipp)
{
int i;
/*
* Subtract both space for automatics and permanent regs.
* XXX - no struct return yet.
*/
fpsub = p2maxautooff;
if (fpsub >= AUTOINIT/SZCHAR)
fpsub -= AUTOINIT/SZCHAR;
regm = regf = nfp = 0;
for (i = 0; i < MAXREGS; i++)
if (TESTBIT(p2env.p_regs, i)) {
if (i <= A7) {
regm |= (1 << i);
fpsub += 4;
} else if (i >= FP0) {
regf |= (1 << (i - FP0));
fpsub += 12;
nfp += 12;
} else
comperr("bad reg range");
}
printf(" link.%c %%fp,#%d\n", fpsub > 32768 ? 'l' : 'w', -fpsub);
if (regm)
printf(" movem.l #%d,%d(%%fp)\n", regm, -fpsub + nfp);
if (regf)
printf(" fmovem #%d,%d(%%fp)\n", regf, -fpsub);
}
开发者ID:arnoldrobbins,项目名称:pcc-revived,代码行数:32,代码来源:local2.c
示例7: fldexpand
int
fldexpand(NODE *p, int cookie, char **cp)
{
CONSZ val;
if (p->n_op == ASSIGN)
p = p->n_left;
switch (**cp) {
case 'S':
printf("%d", UPKFSZ(p->n_rval));
break;
case 'H':
printf("%d", UPKFOFF(p->n_rval));
break;
case 'M':
case 'N':
val = (CONSZ)1 << UPKFSZ(p->n_rval);
--val;
val <<= UPKFOFF(p->n_rval);
printf("0x%llx", (**cp == 'M' ? val : ~val) & 0xffffffff);
break;
default:
comperr("fldexpand");
}
return 1;
}
开发者ID:enukane,项目名称:netbsd-src,代码行数:26,代码来源:local2.c
示例8: hopcode
/*
* add/sub/...
*
* Param given:
*/
void
hopcode(int f, int o)
{
char *str;
switch (o) {
case PLUS:
str = "add";
break;
case MINUS:
str = "sub";
break;
case AND:
str = "and";
break;
case OR:
str = "or";
break;
case ER:
str = "eor";
break;
default:
comperr("hopcode2: %d", o);
str = 0; /* XXX gcc */
}
printf("%s", str);
}
开发者ID:arnoldrobbins,项目名称:pcc-revived,代码行数:32,代码来源:local2.c
示例9: tlen
int
tlen(NODE *p)
{
switch (p->n_type) {
case CHAR:
case UCHAR:
return 1;
case SHORT:
case USHORT:
return (SZSHORT / SZCHAR);
case FLOAT:
return (SZFLOAT / SZCHAR);
case DOUBLE:
return (SZDOUBLE / SZCHAR);
case INT:
case UNSIGNED:
return (SZINT / SZCHAR);
case LONG:
case ULONG:
case LONGLONG:
case ULONGLONG:
return SZLONGLONG / SZCHAR;
default:
if (!ISPTR(p->n_type))
comperr("tlen type unknown: %d");
return SZPOINT(p->n_type) / SZCHAR;
}
}
开发者ID:ajinkya93,项目名称:netbsd-src,代码行数:28,代码来源:local2.c
示例10: hopcode
void
hopcode(int f, int o)
{
char *str;
switch (o) {
case EQ: str = "brz"; break;
case NE: str = "brnz"; break;
case ULE:
case LE: str = "brlez"; break;
case ULT:
case LT: str = "brlz"; break;
case UGE:
case GE: str = "brgez"; break;
case UGT:
case GT: str = "brgz"; break;
case PLUS: str = "add"; break;
case MINUS: str = "sub"; break;
case AND: str = "and"; break;
case OR: str = "or"; break;
case ER: str = "xor"; break;
default:
comperr("unknown hopcode: %d (with %c)", o, f);
return;
}
printf("%s%c", str, f);
}
开发者ID:ajinkya93,项目名称:netbsd-src,代码行数:28,代码来源:local2.c
示例11: tlen
/*
* Return type size in bytes. Used by R2REGS, arg 2 to offset().
*/
int
tlen(NODE *p)
{
switch(p->n_type) {
case CHAR:
case UCHAR:
return(1);
case SHORT:
case USHORT:
return(SZSHORT/SZCHAR);
case DOUBLE:
return(SZDOUBLE/SZCHAR);
case INT:
case UNSIGNED:
case LONG:
case ULONG:
return(SZINT/SZCHAR);
case LONGLONG:
case ULONGLONG:
return SZLONGLONG/SZCHAR;
default:
if (!ISPTR(p->n_type))
comperr("tlen type %d not pointer");
return SZPOINT(p->n_type)/SZCHAR;
}
}
开发者ID:didickman,项目名称:pcc,代码行数:34,代码来源:local2.c
示例12: st_build
/*
* Compile a pattern.
*/
static void
st_build(void)
{
if (iflag)
e0->e_len = loconv(e0->e_pat, e0->e_pat, e0->e_len + 1) - 1;
if ((c_exp = compile(e0->e_pat, NULL, NULL)) == NULL)
comperr(regerrno);
}
开发者ID:Sunshine-OS,项目名称:svr4-userland,代码行数:11,代码来源:ggrep.c
示例13: eoftn
void
eoftn(struct interpass_prolog *ipp)
{
if (spcoff)
comperr("spcoff == %d", spcoff);
if (ipp->ipp_ip.ip_lbl == 0)
return; /* no code needs to be generated */
printf("jmp cret\n");
}
开发者ID:JamesLinus,项目名称:pcc,代码行数:9,代码来源:local2.c
示例14: ProcessNoTagLines
dboolean ProcessNoTagLines(line_t* line, sector_t **sec, int *secnum)
{
zerotag_manual = false;
if (line->tag == 0 && comperr(comperr_zerotag))
{
if (!(*sec=line->backsector))
return true;
*secnum = (*sec)->iSectorID;
zerotag_manual = true;
return true;
}
return false;
}
开发者ID:camgunz,项目名称:prboom-plus,代码行数:13,代码来源:e6y.c
示例15: nspecial
/*
* Special handling of some instruction register allocation.
*/
struct rspecial *
nspecial(struct optab *q)
{
switch (q->op) {
case MUL:
if (q->visit == INAREG) {
static struct rspecial s[] = { { NLEFT, R1 }, { 0 } };
return s;
} else if (q->visit == INBREG) {
static struct rspecial s[] = { { NRES, R01 }, { 0 } };
return s;
}
break;
case DIV:
if (q->visit == INAREG && q->ltype == TUNSIGNED) {
static struct rspecial s[] = {
{ NLEFT, R0 }, { NRIGHT, R1 }, { NRES, R0 }, { 0 } };
return s;
} else if (q->visit == INAREG) {
static struct rspecial s[] = {
{ NRES, R0 }, { 0 } };
return s;
} else if (q->visit == INBREG) {
static struct rspecial s[] = { { NRES, R01 }, { 0 } };
return s;
}
break;
case MOD:
if (q->visit == INAREG && q->ltype == TUNSIGNED) {
static struct rspecial s[] = {
{ NLEFT, R0 }, { NRIGHT, R1 }, { NRES, R0 }, { 0 } };
return s;
} else if (q->visit == INBREG) {
static struct rspecial s[] = { { NRES, R01 }, { 0 } };
return s;
}
break;
case SCONV:
if (q->lshape == SAREG) {
static struct rspecial s[] = {
{ NLEFT, R1 }, { NRES, R01 }, { 0 } };
return s;
}
break;
}
comperr("nspecial entry %d", q - table);
return 0; /* XXX gcc */
}
开发者ID:MoochMcGee,项目名称:pcc-optimized,代码行数:54,代码来源:order.c
示例16: casg64
/*
* Assign a constant from p to q. Both are expected to be leaves by now.
* This is for 64-bit integers.
*/
static void
casg64(NODE *p)
{
NODE *l, *r;
char *str;
int mneg = 1;
l = p->n_left;
r = p->n_right;
#ifdef PCC_DEBUG
if (r->n_op != ICON)
comperr("casg");
#endif
if (r->n_name[0] != '\0') {
/* named constant, nothing to do */
str = "movq\tAR,AL";
mneg = 0;
} else if (r->n_lval == 0) {
str = "clrq\tAL";
mneg = 0;
} else if (r->n_lval < 0) {
if (r->n_lval >= -63) {
r->n_lval = -r->n_lval;
str = "mnegl\tAR,AL";
} else if (r->n_lval >= -128) {
str = "cvtbl\tAR,AL";
} else if (r->n_lval >= -32768) {
str = "cvtwl\tAR,AL";
} else if (r->n_lval >= -4294967296LL) {
str = "movl\tAR,AL";
} else {
str = "movq\tAR,AL";
mneg = 0;
}
} else {
mneg = 0;
if (r->n_lval <= 63 || r->n_lval > 4294967295LL) {
str = "movq\tAR,AL";
} else if (r->n_lval <= 255) {
str = "movzbl\tAR,AL\n\tclrl\tUL";
} else if (r->n_lval <= 65535) {
str = "movzwl\tAR,AL\n\tclrl\tUL";
} else /* if (r->n_lval <= 4294967295) */ {
str = "movl\tAR,AL\n\tclrl\tUL";
}
}
expand(p, FOREFF, str);
if (mneg)
expand(p, FOREFF, "\n\tmnegl $1,UL");
}
开发者ID:mutoso-mirrors,项目名称:pcc,代码行数:55,代码来源:local2.c
示例17: adrput
void
adrput(FILE * io, NODE * p)
{
int64_t off;
if (p->n_op == FLD) {
printf("adrput a FLD\n");
p = p->n_left;
}
if (p->n_op == UMUL && p->n_right == 0)
p = p->n_left;
off = p->n_lval;
switch (p->n_op) {
case NAME:
if (p->n_name[0] != '\0')
fputs(p->n_name, io);
if (off > 0)
fprintf(io, "+");
if (off != 0)
fprintf(io, CONFMT, (long long int)off);
return;
case OREG:
fprintf(io, "%s", rnames[p->n_rval]);
if (p->n_rval == FP)
off += V9BIAS;
if (p->n_rval == SP)
off += V9BIAS + V9RESERVE;
if (off > 0)
fprintf(io, "+");
if (off)
fprintf(io, CONFMT, (CONSZ)off);
return;
case ICON:
/* addressable value of the constant */
conput(io, p);
return;
case REG:
fputs(rnames[p->n_rval], io);
return;
case FUNARG:
/* We do something odd and store the stack offset in n_rval. */
fprintf(io, "%d", V9BIAS + V9RESERVE + p->n_rval);
return;
default:
comperr("bad address, %s, node %p", copst(p->n_op), p);
return;
}
}
开发者ID:ajinkya93,项目名称:netbsd-src,代码行数:51,代码来源:local2.c
示例18: hopcode
/*
* add/sub/...
*
* Param given:
*/
void
hopcode(int f, int o)
{
char *str;
switch (o) {
case EQ:
str = "beqz"; /* pseudo-op */
break;
case NE:
str = "bnez"; /* pseudo-op */
break;
case ULE:
case LE:
str = "blez";
break;
case ULT:
case LT:
str = "bltz";
break;
case UGE:
case GE:
str = "bgez";
break;
case UGT:
case GT:
str = "bgtz";
break;
case PLUS:
str = "add";
break;
case MINUS:
str = "sub";
break;
case AND:
str = "and";
break;
case OR:
str = "or";
break;
case ER:
str = "xor";
break;
default:
comperr("hopcode2: %d", o);
str = 0; /* XXX gcc */
}
printf("%s%c", str, f);
}
开发者ID:enukane,项目名称:netbsd-src,代码行数:55,代码来源:local2.c
示例19: prtype
void
prtype(NODE *n)
{
static char pt[] = { 0, 0, 'b', 'b', 'w', 'w', 'l', 'l', 0, 0,
'q', 'q', 'f', 'd' };
TWORD t = n->n_type;
if (ISPTR(t))
t = UNSIGNED;
if (t > DOUBLE || pt[t] == 0)
comperr("prtype: bad type");
putchar(pt[t]);
}
开发者ID:mutoso-mirrors,项目名称:pcc,代码行数:14,代码来源:local2.c
示例20: emulop
/*
* http://gcc.gnu.org/onlinedocs/gccint/Integer-library-routines.html#Integer-library-routines
*/
static void
emulop(NODE *p)
{
char *ch = NULL;
if (p->n_op == LS && DEUNSIGN(p->n_type) == LONGLONG) ch = "ashldi3";
else if (p->n_op == LS && (DEUNSIGN(p->n_type) == LONG ||
DEUNSIGN(p->n_type) == INT))
ch = "ashlsi3";
else if (p->n_op == RS && p->n_type == ULONGLONG) ch = "lshrdi3";
else if (p->n_op == RS && (p->n_type == ULONG || p->n_type == INT))
ch = "lshrsi3";
else if (p->n_op == RS && p->n_type == LONGLONG) ch = "ashrdi3";
else if (p->n_op == RS && (p->n_type == LONG || p->n_type == INT))
ch = "ashrsi3";
else if (p->n_op == DIV && p->n_type == LONGLONG) ch = "divdi3";
else if (p->n_op == DIV && (p->n_type == LONG || p->n_type == INT))
ch = "divsi3";
else if (p->n_op == DIV && p->n_type == ULONGLONG) ch = "udivdi3";
else if (p->n_op == DIV && (p->n_type == ULONG ||
p->n_type == UNSIGNED))
ch = "udivsi3";
else if (p->n_op == MOD && p->n_type == LONGLONG) ch = "moddi3";
else if (p->n_op == MOD && (p->n_type == LONG || p->n_type == INT))
ch = "modsi3";
else if (p->n_op == MOD && p->n_type == ULONGLONG) ch = "umoddi3";
else if (p->n_op == MOD && (p->n_type == ULONG ||
p->n_type == UNSIGNED))
ch = "umodsi3";
else if (p->n_op == MUL && p->n_type == LONGLONG) ch = "muldi3";
else if (p->n_op == MUL && (p->n_type == LONG || p->n_type == INT))
ch = "mulsi3";
else if (p->n_op == UMINUS && p->n_type == LONGLONG) ch = "negdi2";
else if (p->n_op == UMINUS && p->n_type == LONG) ch = "negsi2";
else ch = 0, comperr("ZE");
printf("\tsubu %s,%s,16\n", rnames[SP], rnames[SP]);
printf("\tjal __%s\t# emulated operation\n", exname(ch));
printf("\tnop\n");
printf("\taddiu %s,%s,16\n", rnames[SP], rnames[SP]);
}
开发者ID:enukane,项目名称:netbsd-src,代码行数:52,代码来源:local2.c
注:本文中的comperr函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论