Ignore:
Timestamp:
Jan 21, 2018, 12:10:09 AM (6 years ago)
Author:
coas-nagasima
Message:

prototoolに関連するプロジェクトをnewlibからmuslを使うよう変更・更新
ntshellをnewlibの下位の実装から、muslのsyscallの実装に変更・更新
以下のOSSをアップデート
・mruby-1.3.0
・musl-1.1.18
・onigmo-6.1.3
・tcc-0.9.27
以下のOSSを追加
・openssl-1.1.0e
・curl-7.57.0
・zlib-1.2.11
以下のmrbgemsを追加
・iij/mruby-digest
・iij/mruby-env
・iij/mruby-errno
・iij/mruby-iijson
・iij/mruby-ipaddr
・iij/mruby-mock
・iij/mruby-require
・iij/mruby-tls-openssl

Location:
EcnlProtoTool/trunk/tcc-0.9.27
Files:
1 edited
1 moved

Legend:

Unmodified
Added
Removed
  • EcnlProtoTool/trunk/tcc-0.9.27/c67-gen.c

    r321 r331  
    2121#ifdef TARGET_DEFS_ONLY
    2222
    23 //#define ASSEMBLY_LISTING_C67
     23/* #define ASSEMBLY_LISTING_C67 */
    2424
    2525/* number of available registers */
     
    9494
    9595/* defined if function parameters must be evaluated in reverse order */
    96 //#define INVERT_FUNC_PARAMS
     96/* #define INVERT_FUNC_PARAMS */
    9797
    9898/* defined if structures are passed as pointers. Otherwise structures
    9999   are directly pushed on stack. */
    100 //#define FUNC_STRUCT_PARAM_AS_PTR
     100/* #define FUNC_STRUCT_PARAM_AS_PTR */
    101101
    102102/* pointer size, in bytes */
     
    108108/* maximum alignment (for aligned attribute support) */
    109109#define MAX_ALIGN     8
    110 
    111 /******************************************************/
    112 /* ELF defines */
    113 
    114 #define EM_TCC_TARGET EM_C60
    115 
    116 /* relocation type for 32 bit data relocation */
    117 #define R_DATA_32   R_C60_32
    118 #define R_DATA_PTR  R_C60_32
    119 #define R_JMP_SLOT  R_C60_JMP_SLOT
    120 #define R_COPY      R_C60_COPY
    121 
    122 #define ELF_START_ADDR 0x00000400
    123 #define ELF_PAGE_SIZE  0x1000
    124110
    125111/******************************************************/
     
    197183{
    198184    int ind1;
    199 
     185    if (nocode_wanted)
     186        return;
    200187#ifdef ASSEMBLY_LISTING_C67
    201188    fprintf(f, " %08X", c);
     
    246233
    247234// these are regs that tcc doesn't really know about,
    248 // but asign them unique values so the mapping routines
    249 // can distinquish them
     235// but assign them unique values so the mapping routines
     236// can distinguish them
    250237
    251238#define C67_A0 105
     
    254241#define C67_FP 108
    255242#define C67_B2 109
    256 #define C67_CREG_ZERO -1        // Special code for no condition reg test
     243#define C67_CREG_ZERO -1        /* Special code for no condition reg test */
    257244
    258245
     
    15681555    fr = sv->r;
    15691556    ft = sv->type.t;
    1570     fc = sv->c.ul;
     1557    fc = sv->c.i;
    15711558
    15721559    v = fr & VT_VALMASK;
     
    15751562            v1.type.t = VT_INT;
    15761563            v1.r = VT_LOCAL | VT_LVAL;
    1577             v1.c.ul = fc;
     1564            v1.c.i = fc;
    15781565            load(r, &v1);
    15791566            fr = r;
     
    17271714
    17281715    ft = v->type.t;
    1729     fc = v->c.ul;
     1716    fc = v->c.i;
    17301717    fr = v->r & VT_VALMASK;
    17311718    bt = ft & VT_BTYPE;
     
    18801867}
    18811868
     1869/* Return the number of registers needed to return the struct, or 0 if
     1870   returning via struct pointer. */
     1871ST_FUNC int gfunc_sret(CType *vt, int variadic, CType *ret, int *ret_align, int *regsize) {
     1872    *ret_align = 1; // Never have to re-align return values for x86-64
     1873    return 0;
     1874}
     1875
    18821876/* generate function call with address in (vtop->t, vtop->c) and free function
    18831877   context. Stack entry is popped */
     
    18941888    for (i = 0; i < nb_args; i++) {
    18951889        if ((vtop->type.t & VT_BTYPE) == VT_STRUCT) {
    1896             ALWAYS_ASSERT(FALSE);
    1897         } else if ((vtop->type.t & VT_BTYPE) == VT_STRUCT) {
    18981890            ALWAYS_ASSERT(FALSE);
    18991891        } else {
     
    19601952
    19611953    sym = func_type->ref;
    1962     func_call = sym->r;
     1954    func_call = sym->f.func_call;
    19631955    addr = 8;
    19641956    /* if the function returns a structure, then add an
    19651957       implicit pointer parameter */
    19661958    func_vt = sym->type;
     1959    func_var = (sym->f.func_type == FUNC_ELLIPSIS);
    19671960    if ((func_vt.t & VT_BTYPE) == VT_STRUCT) {
    19681961        func_vc = addr;
     
    20472040{
    20482041    int ind1 = ind;
     2042    if (nocode_wanted)
     2043        return t;
    20492044
    20502045    C67_MVKL(C67_A0, t);        //r=reg to load,  constant
     
    20792074
    20802075    v = vtop->r & VT_VALMASK;
    2081     if (v == VT_CMP) {
     2076    if (nocode_wanted) {
     2077        ;
     2078    } else if (v == VT_CMP) {
    20822079        /* fast case : can jump directly since flags are set */
    20832080        // C67 uses B2 sort of as flags register
     
    21012098        if ((v & 1) == inv) {
    21022099            /* insert vtop->c jump list in t */
    2103             p = &vtop->c.i;
    21042100
    21052101            // I guess the idea is to traverse to the
     
    21072103            // there
    21082104
    2109             n = *p;
     2105            n = vtop->c.i;
    21102106            while (n != 0) {
    21112107                p = (int *) (cur_text_section->data + n);
     
    21222118            t = gjmp(t);
    21232119            gsym(vtop->c.i);
    2124         }
    2125     } else {
    2126         if (is_float(vtop->type.t)) {
    2127             vpushi(0);
    2128             gen_op(TOK_NE);
    2129         }
    2130         if ((vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST) {
    2131             /* constant jmp optimization */
    2132             if ((vtop->c.i != 0) != inv)
    2133                 t = gjmp(t);
    2134         } else {
    2135             // I think we need to get the value on the stack
    2136             // into a register, test it, and generate a branch
    2137             // return the address of the branch, so it can be
    2138             // later patched
    2139 
    2140             v = gv(RC_INT);     // get value into a reg
    2141             ind1 = ind;
    2142             C67_MVKL(C67_A0, t);        //r=reg to load, constant
    2143             C67_MVKH(C67_A0, t);        //r=reg to load, constant
    2144 
    2145             if (v != TREG_EAX &&        // check if not already in a conditional test reg
    2146                 v != TREG_EDX && v != TREG_ST0 && v != C67_B2) {
    2147                 C67_MV(v, C67_B2);
    2148                 v = C67_B2;
    2149             }
    2150 
    2151             C67_IREG_B_REG(inv, v, C67_A0);     // [!R] B.S2x  A0
    2152             C67_NOP(5);
    2153             t = ind1;           //return where we need to patch
    2154             ind1 = ind;
    21552120        }
    21562121    }
     
    22612226        fr = vtop[0].r;
    22622227        vtop--;
    2263         C67_MPYI(fr, r);        // 32 bit bultiply  fr,r,fr
     2228        C67_MPYI(fr, r);        // 32 bit multiply  fr,r,fr
    22642229        C67_NOP(8);             // NOP 8 for worst case
    22652230        break;
     
    23182283
    23192284/* generate a floating point operation 'v = t1 op t2' instruction. The
    2320    two operands are guaranted to have the same floating point type */
     2285   two operands are guaranteed to have the same floating point type */
    23212286/* XXX: need to use ST1 too */
    23222287void gen_opf(int op)
     
    23302295
    23312296    ft = vtop->type.t;
    2332     fc = vtop->c.ul;
     2297    fc = vtop->c.i;
    23332298    r = vtop->r;
    23342299    fr = vtop[-1].r;
     
    25552520}
    25562521
     2522/* Save the stack pointer onto the stack and return the location of its address */
     2523ST_FUNC void gen_vla_sp_save(int addr) {
     2524    tcc_error("variable length arrays unsupported for this target");
     2525}
     2526
     2527/* Restore the SP from a location on the stack */
     2528ST_FUNC void gen_vla_sp_restore(int addr) {
     2529    tcc_error("variable length arrays unsupported for this target");
     2530}
     2531
     2532/* Subtract from the stack pointer, and push the resulting value onto the stack */
     2533ST_FUNC void gen_vla_alloc(CType *type, int align) {
     2534    tcc_error("variable length arrays unsupported for this target");
     2535}
     2536
    25572537/* end of C67 code generator */
    25582538/*************************************************************/
Note: See TracChangeset for help on using the changeset viewer.