MCPcopy Create free account
hub / github.com/WheretIB/nullc / GenCodeCmdSetRange

Function GenCodeCmdSetRange

NULLC/CodeGen_X86.cpp:1823–1873  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1821}
1822
1823void GenCodeCmdSetRange(VMCmd cmd)
1824{
1825 unsigned int elCount = x86Op[-1].argA.num;
1826
1827 EMIT_COMMENT("SETRANGE");
1828
1829 EMIT_OP_REG(o_pop, rEBX);
1830 unsigned int typeSizeD[] = { 1, 2, 4, 8, 4, 8 };
1831
1832 // start address
1833 EMIT_OP_REG_RPTR(o_lea, rEBX, sNONE, rEBP, paramBase + cmd.argument);
1834 // end address
1835 EMIT_OP_REG_RPTR(o_lea, rECX, sNONE, rEBP, paramBase + cmd.argument + (elCount - 1) * typeSizeD[(cmd.helper>>2)&0x00000007]);
1836 if(cmd.helper == DTYPE_FLOAT)
1837 {
1838 EMIT_OP_RPTR(o_fld, sQWORD, rESP, 0);
1839 }else{
1840 EMIT_OP_REG_RPTR(o_mov, rEAX, sDWORD, rESP, 0);
1841 EMIT_OP_REG_RPTR(o_mov, rEDX, sDWORD, rESP, 4);
1842 }
1843 EMIT_LABEL(aluLabels);
1844 EMIT_OP_REG_REG(o_cmp, rEBX, rECX);
1845 EMIT_OP_LABEL(o_jg, aluLabels + 1);
1846
1847 switch(cmd.helper)
1848 {
1849 case DTYPE_DOUBLE:
1850 case DTYPE_LONG:
1851 EMIT_OP_RPTR_REG(o_mov, sDWORD, rEBX, 4, rEDX);
1852 EMIT_OP_RPTR_REG(o_mov, sDWORD, rEBX, 0, rEAX);
1853 break;
1854 case DTYPE_FLOAT:
1855 EMIT_OP_RPTR(o_fst, sDWORD, rEBX, 0);
1856 break;
1857 case DTYPE_INT:
1858 EMIT_OP_RPTR_REG(o_mov, sDWORD, rEBX, 0, rEAX);
1859 break;
1860 case DTYPE_SHORT:
1861 EMIT_OP_RPTR_REG(o_mov, sWORD, rEBX, 0, rEAX);
1862 break;
1863 case DTYPE_CHAR:
1864 EMIT_OP_RPTR_REG(o_mov, sBYTE, rEBX, 0, rEAX);
1865 break;
1866 }
1867 EMIT_OP_REG_NUM(o_add, rEBX, typeSizeD[(cmd.helper>>2)&0x00000007]);
1868 EMIT_OP_LABEL(o_jmp, aluLabels);
1869 EMIT_LABEL(aluLabels + 1);
1870 if(cmd.helper == DTYPE_FLOAT)
1871 EMIT_OP_FPUREG(o_fstp, rST0);
1872 aluLabels += 2;
1873}
1874
1875
1876void GenCodeCmdJmp(VMCmd cmd)

Callers

nothing calls this directly

Calls 10

EMIT_COMMENTFunction · 0.85
EMIT_OP_REGFunction · 0.85
EMIT_OP_REG_RPTRFunction · 0.85
EMIT_OP_RPTRFunction · 0.85
EMIT_LABELFunction · 0.85
EMIT_OP_REG_REGFunction · 0.85
EMIT_OP_LABELFunction · 0.85
EMIT_OP_RPTR_REGFunction · 0.85
EMIT_OP_REG_NUMFunction · 0.85
EMIT_OP_FPUREGFunction · 0.85

Tested by

no test coverage detected