当前位置: 首页>>代码示例>>C++>>正文


C++ emitInt函数代码示例

本文整理汇总了C++中emitInt函数的典型用法代码示例。如果您正苦于以下问题:C++ emitInt函数的具体用法?C++ emitInt怎么用?C++ emitInt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了emitInt函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: assert

void Assembler::movq(Immediate src, Indirect dest) {
    int64_t src_val = src.val;
    assert((-1L << 31) <= src_val && src_val < (1L << 31) - 1);

    int rex = REX_W;

    int dest_idx = dest.base.regnum;

    if (dest_idx >= 8) {
        rex |= REX_B;
        dest_idx -= 8;
    }

    emitRex(rex);
    emitByte(0xc7);

    bool needssib = (dest_idx == 0b100);
    int mode = getModeFromOffset(dest.offset);
    emitModRM(mode, 0, dest_idx);

    if (needssib)
        emitSIB(0b00, 0b100, dest_idx);

    if (mode == 0b01) {
        emitByte(dest.offset);
    } else if (mode == 0b10) {
        emitInt(dest.offset, 4);
    }

    emitInt(src_val, 4);
}
开发者ID:jmgc,项目名称:pyston,代码行数:31,代码来源:assembler.cpp

示例2: add

//-----------------------------------------
int add(int left, int right)
{
	emitInt("ld", left);
	emitInt("add", right);
	int temp = getTemp();
	emitInstruction2("st", symbol[temp]);
	return temp;
}
开发者ID:ShaneRyanKelly,项目名称:R1,代码行数:9,代码来源:R1.c

示例3: checkSetLessThan

void checkSetLessThan() {
	int i, j;
	for (i = 0; i < lengthof(intValues); i++) {
		for (j = 0; j < lengthof(intValues); j++) {
			emitInt(_checkSetLessThanSigned(i, j));
			emitInt(_checkSetLessThanUnsigned(i, j));
		}
	}
}
开发者ID:Falaina,项目名称:cspspemu,代码行数:9,代码来源:alu.c

示例4: RELEASE_ASSERT

void Assembler::emitArith(Immediate imm, Register r, int opcode, MovType type) {
    // assert(r != RSP && "This breaks unwinding, please don't use.");

    int64_t amount = imm.val;
    RELEASE_ASSERT(fitsInto<int32_t>(amount), "");
    assert(0 <= opcode && opcode < 8);

    assert(type == MovType::Q || type == MovType::L);
    int rex = type == MovType::Q ? REX_W : 0;

    int reg_idx = r.regnum;
    if (reg_idx >= 8) {
        rex |= REX_B;
        reg_idx -= 8;
    }

    if (rex)
        emitRex(rex);
    if (-0x80 <= amount && amount < 0x80) {
        emitByte(0x83);
        emitModRM(0b11, opcode, reg_idx);
        emitByte(amount);
    } else {
        emitByte(0x81);
        emitModRM(0b11, opcode, reg_idx);
        emitInt(amount, 4);
    }
}
开发者ID:c-rhodes,项目名称:pyston,代码行数:28,代码来源:assembler.cpp

示例5: RELEASE_ASSERT

void Assembler::emitArith(Immediate imm, Register r, int opcode) {
    // assert(r != RSP && "This breaks unwinding, please don't use.");

    int64_t amount = imm.val;
    RELEASE_ASSERT((-1L << 31) <= amount && amount < (1L << 31) - 1, "");
    assert(0 <= opcode && opcode < 8);

    int rex = REX_W;

    int reg_idx = r.regnum;
    if (reg_idx >= 8) {
        rex |= REX_B;
        reg_idx -= 8;
    }

    emitRex(rex);
    if (-0x80 <= amount && amount < 0x80) {
        emitByte(0x83);
        emitModRM(0b11, opcode, reg_idx);
        emitByte(amount);
    } else {
        emitByte(0x81);
        emitModRM(0b11, opcode, reg_idx);
        emitInt(amount, 4);
    }
}
开发者ID:kod3r,项目名称:pyston,代码行数:26,代码来源:assembler.cpp

示例6: assert

void Assembler::jmp_cond(JumpDestination dest, ConditionCode condition) {
    bool unlikely = false;

    assert(dest.type == JumpDestination::FROM_START);
    int offset = dest.offset - (addr - start_addr) - 2;
    if (unlikely)
        offset--;

    if (offset >= -0x80 && offset < 0x80) {
        if (unlikely)
            emitByte(0x2e);

        emitByte(0x70 | condition);
        emitByte(offset);
    } else {
        offset -= 4;

        if (unlikely)
            emitByte(0x2e);

        emitByte(0x0f);
        emitByte(0x80 | condition);
        emitInt(offset, 4);
    }
}
开发者ID:kod3r,项目名称:pyston,代码行数:25,代码来源:assembler.cpp

示例7: trap

void Assembler::movsd(XMMRegister src, Indirect dest) {
    int rex = 0;
    int src_idx = src.regnum;
    int dest_idx = dest.base.regnum;

    if (src_idx >= 8) {
        rex |= REX_R;
        src_idx -= 8;
    }
    if (dest_idx >= 8) {
        trap();
        rex |= REX_B;
        dest_idx -= 8;
    }

    emitByte(0xf2);
    if (rex)
        emitRex(rex);
    emitByte(0x0f);
    emitByte(0x11);

    bool needssib = (dest_idx == 0b100);
    int mode = getModeFromOffset(dest.offset);
    emitModRM(mode, src_idx, dest_idx);

    if (needssib)
        emitSIB(0b00, 0b100, dest_idx);

    if (mode == 0b01) {
        emitByte(dest.offset);
    } else if (mode == 0b10) {
        emitInt(dest.offset, 4);
    }
}
开发者ID:jmgc,项目名称:pyston,代码行数:34,代码来源:assembler.cpp

示例8: println

//-----------------------------------------
void println(int expVal)
{
	emitInt("ld", expVal);
	emitInstruction1("dout");
	emitInstruction1("ldc \'\\n\'");
	emitInstruction1("aout");
}
开发者ID:ShaneRyanKelly,项目名称:R1,代码行数:8,代码来源:R1.c

示例9: emitByte

void Assembler::decq(Immediate imm) {
    emitByte(0x48);
    emitByte(0xff);
    emitByte(0x0c);
    emitByte(0x25);
    emitInt(imm.val, 4);
}
开发者ID:c-rhodes,项目名称:pyston,代码行数:7,代码来源:assembler.cpp

示例10: assert

void Assembler::cmp(Indirect mem, Immediate imm, MovType type) {
    int64_t val = imm.val;
    assert(fitsInto<int32_t>(val));

    int src_idx = mem.base.regnum;
    assert(type == MovType::Q || type == MovType::L);
    int rex = type == MovType::Q ? REX_W : 0;
    if (src_idx >= 8) {
        rex |= REX_B;
        src_idx -= 8;
    }

    assert(src_idx >= 0 && src_idx < 8);

    bool needssib = (src_idx == 0b100);

    if (rex)
        emitRex(rex);
    emitByte(0x81);

    if (mem.offset == 0) {
        emitModRM(0b00, 7, src_idx);
        if (needssib)
            emitSIB(0b00, 0b100, src_idx);
    } else if (-0x80 <= mem.offset && mem.offset < 0x80) {
        emitModRM(0b01, 7, src_idx);
        if (needssib)
            emitSIB(0b00, 0b100, src_idx);
        emitByte(mem.offset);
    } else {
        assert(fitsInto<int32_t>(mem.offset));
        emitModRM(0b10, 7, src_idx);
        if (needssib)
            emitSIB(0b00, 0b100, src_idx);
        emitInt(mem.offset, 4);
    }

    emitInt(val, 4);
}
开发者ID:c-rhodes,项目名称:pyston,代码行数:39,代码来源:assembler.cpp

示例11: emitRex

void Assembler::mov(Immediate val, Register dest) {
    int rex = REX_W;

    int dest_idx = dest.regnum;
    if (dest_idx >= 8) {
        rex |= REX_B;
        dest_idx -= 8;
    }

    emitRex(rex);
    emitByte(0xb8 + dest_idx);
    emitInt(val.val, 8);
}
开发者ID:kod3r,项目名称:pyston,代码行数:13,代码来源:assembler.cpp

示例12: emitRex

void Assembler::mov(Immediate val, Register dest, bool force_64bit_load) {
    force_64bit_load = force_64bit_load || !val.fitsInto32Bit();

    int rex = force_64bit_load ? REX_W : 0;
    int dest_idx = dest.regnum;
    if (dest_idx >= 8) {
        rex |= REX_B;
        dest_idx -= 8;
    }

    if (rex)
        emitRex(rex);
    emitByte(0xb8 + dest_idx);
    emitInt(val.val, force_64bit_load ? 8 : 4);
}
开发者ID:jmgc,项目名称:pyston,代码行数:15,代码来源:assembler.cpp

示例13: trap

void Assembler::movsd(Indirect src, XMMRegister dest) {
    int rex = 0;
    int src_idx = src.base.regnum;
    int dest_idx = dest.regnum;

    if (src_idx >= 8) {
        trap();
        rex |= REX_R;
        src_idx -= 8;
    }
    if (dest_idx >= 8) {
        trap();
        rex |= REX_B;
        dest_idx -= 8;
    }

    emitByte(0xf2);
    if (rex)
        emitRex(rex);
    emitByte(0x0f);
    emitByte(0x10);

    bool needssib = (src_idx == 0b100);

    int mode;
    if (src.offset == 0)
        mode = 0b00;
    else if (-0x80 <= src.offset && src.offset < 0x80)
        mode = 0b01;
    else
        mode = 0b10;

    emitModRM(mode, dest_idx, src_idx);

    if (needssib)
        emitSIB(0b00, 0b100, src_idx);

    if (mode == 0b01) {
        emitByte(src.offset);
    } else if (mode == 0b10) {
        emitInt(src.offset, 4);
    }
}
开发者ID:kod3r,项目名称:pyston,代码行数:43,代码来源:assembler.cpp

示例14: emitEdgeAttrs


//.........这里部分代码省略.........
	else if (streq(s->name, "pencolor")) {
	    if (*(v = agxget (ep, s))) {
		attrs.fill = v;
		doGraphics = 1;
	    }
	}
	else if (streq(s->name, "arrowhead")) {
	    if (*(v = agxget (ep, s))) {
		attrs.arrowhead = v;
		doGraphics = 1;
	    }
	}
	else if (streq(s->name, "arrowtail")) {
	    if (*(v = agxget (ep, s))) {
		attrs.arrowtail = v;
		doGraphics = 1;
	    }
	}
	else if (streq(s->name, "fontname")) { /* fontName */
	    if (*(v = agxget (ep, s))) {
		attrs.fontName = v;
		doLabelGraphics = 1;
	    }
	}
	else if (streq(s->name, "fontsize")) { /* fontSize */
	    if (*(v = agxget (ep, s))) {
		attrs.fontSize = v;
		doLabelGraphics = 1;
	    }
	}
	else if (streq(s->name, "fontcolor")) { /* fontColor */
	    if (*(v = agxget (ep, s))) {
		attrs.fontColor = v;
		doLabelGraphics = 1;
	    }
	}
	else {
	    v = agxget (ep, s);
	    emitAttr (s->name, v, outFile, ix);
	}
    }

    /* Then, print them, if any */
    if (doGraphics) {
	fprintf (outFile, "    graphics [\n");
	if (attrs.pos) {
	    emitSpline (attrs.pos, outFile, ix+1);
	}
	if (attrs.flags & INVIS) {
	    emitInt ("visible", 0, outFile, ix+1);
	}
	if (attrs.fill) {
	    emitAttr ("fill", attrs.fill, outFile, ix+1);
	}
	if (attrs.width) {
	    emitAttr ("width", attrs.width, outFile, ix+1);
	}
	if (attrs.arrowhead) {
	    emitAttr ("targetArrow", attrs.arrowhead, outFile, ix+1);
	}
	if (attrs.arrowtail) {
	    emitAttr ("sourceArrow", attrs.arrowtail, outFile, ix+1);
	}
	if (attrs.flags & DASH) {
	    emitAttr ("style", "dashed", outFile, ix+1);
	}
	else if (attrs.flags & DOT) {
	    emitAttr ("style", "dotted", outFile, ix+1);
	}
	else if (attrs.flags & LINE) {
	    emitAttr ("style", "line", outFile, ix+1);
	}
	if (attrs.arrow) {
	    if (streq(attrs.arrow,"forward"))
		emitAttr ("arrow", "first", outFile, ix+1);
	    else if (streq(attrs.arrow,"back"))
		emitAttr ("arrow", "last", outFile, ix+1);
	    else if (streq(attrs.arrow,"both"))
		emitAttr ("arrow", "both", outFile, ix+1);
	    else if (streq(attrs.arrow,"none"))
		emitAttr ("arrow", "none", outFile, ix+1);
	}
	fprintf (outFile, "    ]\n");
    }

    if (doLabelGraphics) {
	fprintf (outFile, "    LabelGraphics [\n");
	if (label) emitAttr ("text", label, outFile, ix+1);
	if (attrs.fontColor) {
	    emitAttr ("fontColor", attrs.fontColor, outFile, ix+1);
	}
	if (attrs.fontSize) {
	    emitAttr ("fontSize", attrs.fontSize, outFile, ix+1);
	}
	if (attrs.fontName) {
	    emitAttr ("fontName", attrs.fontName, outFile, ix+1);
	}
	fprintf (outFile, "    ]\n");
    }
}
开发者ID:AhmedAMohamed,项目名称:graphviz,代码行数:101,代码来源:gv2gml.c

示例15: main

int main(int argc, char **argv) {
	emitInt(argc > 0);
	emitInt(strlen(argv[0]) > 0);
	return 0;
}
开发者ID:Falaina,项目名称:cspspemu,代码行数:5,代码来源:args.c


注:本文中的emitInt函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。