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/il-gen.c

    r321 r331  
    1818 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    1919 */
    20 #ifdef TARGET_DEFS_ONLY
     20
     21#error this code has bit-rotted since 2003
    2122
    2223/* number of available registers */
    2324#define NB_REGS             3
    24 #define NB_ASM_REGS         8 // TODO:
    25 #define ELF_PAGE_SIZE  0x1000 // TODO:
    26 #define MAX_ALIGN           8 // TODO:
    27 #define R_DATA_32   R_386_32 // TODO:
    28 #define R_DATA_PTR  R_386_32 // TODO:
    29 #define R_JMP_SLOT  R_386_JMP_SLOT // TODO:
    30 #define R_COPY      R_386_COPY // TODO:
    31 #define ELF_START_ADDR 0x08048000 // TODO:
    32 #define EM_TCC_TARGET 0xFF // TODO:
    3325
    3426/* a register can belong to several classes. The classes must be
     
    5244};
    5345
     46const int reg_classes[NB_REGS] = {
     47    /* ST0 */ RC_ST | RC_ST0,
     48    /* ST1 */ RC_ST | RC_ST1,
     49    /* ST2 */ RC_ST,
     50};
     51
    5452/* return registers for function */
    5553#define REG_IRET REG_ST0 /* single word int return register */
     
    5856
    5957/* defined if function parameters must be evaluated in reverse order */
    60 //#define INVERT_FUNC_PARAMS
     58/* #define INVERT_FUNC_PARAMS */
    6159
    6260/* defined if structures are passed as pointers. Otherwise structures
    6361   are directly pushed on stack. */
    64 //#define FUNC_STRUCT_PARAM_AS_PTR
     62/* #define FUNC_STRUCT_PARAM_AS_PTR */
    6563
    6664/* pointer size, in bytes */
     
    8280
    8381enum ILOPCodes {
    84 #define ENUM_ILOPCODES_DEF
    8582#define OP(name, str, n) IL_OP_ ## name = n,
    8683#include "il-opcodes.h"
    8784#undef OP
    88 #undef ENUM_ILOPCODES_DEF
    8985};
    9086
    91 /******************************************************/
    92 #else /* ! TARGET_DEFS_ONLY */
    93  /******************************************************/
    94 #include "tcc.h"
    95 
    96 const int reg_classes[NB_REGS] = {
    97         /* ST0 */ RC_ST | RC_ST0,
    98         /* ST1 */ RC_ST | RC_ST1,
    99         /* ST2 */ RC_ST,
    100 };
    101 
    10287char *il_opcodes_str[] = {
    103 #define OP(name, str, n) /*[n] = */str,
     88#define OP(name, str, n) [n] = str,
    10489#include "il-opcodes.h"
    10590#undef OP
     
    115100static void out_byte(int c)
    116101{
    117     int ind1 = ind + 1;
    118     if (ind1 > cur_text_section->data_allocated)
    119         section_realloc(cur_text_section, ind1);
    120     *(char *)(cur_text_section->data + ind) = c;
    121     ind++;
     102    *(char *)ind++ = c;
    122103}
    123104
     
    219200    case VT_FUNC:
    220201        s = sym_find((unsigned)t >> VT_STRUCT_SHIFT);
    221         if (s == NULL)
    222             break;
    223         il_type_to_str(buf, buf_size, s->type.t, varstr);
     202        il_type_to_str(buf, buf_size, s->t, varstr);
    224203        pstrcat(buf, buf_size, "(");
    225204        sa = s->next;
    226205        while (sa != NULL) {
    227             il_type_to_str(buf1, sizeof(buf1), sa->type.t, NULL);
     206            il_type_to_str(buf1, sizeof(buf1), sa->t, NULL);
    228207            pstrcat(buf, buf_size, buf1);
    229208            sa = sa->next;
     
    235214    case VT_PTR:
    236215        s = sym_find((unsigned)t >> VT_STRUCT_SHIFT);
    237         if (s == NULL)
    238             break;
    239216        pstrcpy(buf1, sizeof(buf1), "*");
    240217        if (varstr)
    241218            pstrcat(buf1, sizeof(buf1), varstr);
    242         il_type_to_str(buf, buf_size, s->type.t, buf1);
     219        il_type_to_str(buf, buf_size, s->t, buf1);
    243220        goto no_var;
    244221    }
     
    250227}
    251228
    252 #define Reloc void
     229
    253230/* patch relocation entry with value 'val' */
    254231void greloc_patch1(Reloc *p, int val)
     
    285262    v = sv->r & VT_VALMASK;
    286263    fc = sv->c.i;
    287     ft = sv->type.t;
     264    ft = sv->t;
    288265
    289266    if (sv->r & VT_LVAL) {
     
    364341    v = sv->r & VT_VALMASK;
    365342    fc = sv->c.i;
    366     ft = sv->type.t;
     343    ft = sv->t;
    367344    if (v == VT_LOCAL) {
    368345        if (fc >= ARG_BASE) {
     
    412389void gfunc_param(GFuncContext *c)
    413390{
    414     if ((vtop->type.t & VT_BTYPE) == VT_STRUCT) {
     391    if ((vtop->t & VT_BTYPE) == VT_STRUCT) {
    415392        tcc_error("structures passed as value not handled yet");
    416393    } else {
     
    429406    if ((vtop->r & (VT_VALMASK | VT_LVAL)) == VT_CONST) {
    430407        /* XXX: more info needed from tcc */
    431         il_type_to_str(buf, sizeof(buf), vtop->type.t, "xxx");
     408        il_type_to_str(buf, sizeof(buf), vtop->t, "xxx");
    432409        fprintf(il_outfile, " call %s\n", buf);
    433410    } else {
    434411        /* indirect call */
    435412        gv(RC_INT);
    436         il_type_to_str(buf, sizeof(buf), vtop->type.t, NULL);
     413        il_type_to_str(buf, sizeof(buf), vtop->t, NULL);
    437414        fprintf(il_outfile, " calli %s\n", buf);
    438415    }
     
    461438       
    462439    sym = sym_find((unsigned)t >> VT_STRUCT_SHIFT);
    463     if (sym == NULL)
    464         return;
     440    func_call = sym->r;
    465441
    466442    addr = ARG_BASE;
    467443    /* if the function returns a structure, then add an
    468444       implicit pointer parameter */
    469     func_vt = sym->type;
    470     if ((func_vt.t & VT_BTYPE) == VT_STRUCT) {
     445    func_vt = sym->t;
     446    func_var = (sym->c == FUNC_ELLIPSIS);
     447    if ((func_vt & VT_BTYPE) == VT_STRUCT) {
    471448        func_vc = addr;
    472449        addr++;
     
    474451    /* define parameters */
    475452    while ((sym = sym->next) != NULL) {
    476         u = sym->type.t;
     453        u = sym->t;
    477454        sym_push(sym->v & ~SYM_FIELD, u,
    478455                 VT_LOCAL | lvalue_type(sym->type.t), addr);
     
    555532            gsym(vtop->c.i);
    556533        }
    557     } else {
    558         if (is_float(vtop->type.t)) {
    559             vpushi(0);
    560             gen_op(TOK_NE);
    561         }
    562 #define VT_FORWARD 0
    563         if ((vtop->r & (VT_VALMASK | VT_LVAL | VT_FORWARD)) == VT_CONST) {
    564             /* constant jmp optimization */
    565             if ((vtop->c.i != 0) != inv)
    566                 t = gjmp(t);
    567         } else {
    568             v = gv(RC_INT);
    569             t = out_opj(IL_OP_BRTRUE - inv, t);
    570         }
    571534    }
    572535    vtop--;
     
    640603
    641604/* generate a floating point operation 'v = t1 op t2' instruction. The
    642    two operands are guaranted to have the same floating point type */
     605   two operands are guaranteed to have the same floating point type */
    643606void gen_opf(int op)
    644607{
     
    690653}
    691654
    692 void ggoto(void) { }
    693 void gen_bounded_ptr_add(void) {}
    694 void gen_bounded_ptr_deref(int t) {}
    695 void gen_expr32(void) {}
    696 void asm_opcode(TCCState *s1, int opcode) {}
    697 void asm_compute_constraints(ASMOperand *operands,
    698         int nb_operands, int nb_outputs,
    699         const uint8_t *clobber_regs,
    700         int *pout_reg) {}
    701 void subst_asm_operand(CString *add_str,
    702         SValue *sv, int modifier) {}
    703 void asm_gen_code(ASMOperand *operands, int nb_operands,
    704         int nb_outputs, int is_output,
    705         uint8_t *clobber_regs,
    706         int out_reg) {}
    707 void asm_clobber(uint8_t *clobber_regs, const char *str) {}
    708 void gen_le32(int c) {}
    709 void g(int c) {}
    710 void gen_le16(int v) {}
    711 
    712655/* end of CIL code generator */
    713656/*************************************************************/
    714 #endif
    715 /*************************************************************/
     657
Note: See TracChangeset for help on using the changeset viewer.