Mercurial > hg > CbC > old > device
view b11.s @ 0:d35df41eac69
Initial revision
author | kono |
---|---|
date | Thu, 13 Jan 2000 02:41:41 +0900 |
parents | |
children |
line wrap: on
line source
.file "mc-nop-386.c" .version "01.01" gcc2_compiled.: .text # /* Micro-C Code Generatation Part for intel386 */ # # #define EXTERN extern # #include "mc.h" # /* Micro-C header file */ # # #define DEBUG error(-1) # # /*#include "CCLIB.TXT" */ # #include "stdio.h" # #define const # # typedef struct { # /* this is all wrong, but so what? */ # char pad[96]; # } FILE; # # # extern FILE __sstdin; # extern FILE __sstdout; # extern FILE __sstderr; # # #define stdin (&__sstdin) # #define stdout (&__sstdout) # #define stderr (&__sstderr) # #define BUFSIZ 1024 /* size of buffer used by setbuf */ # #define EOF (-1) # #define NULL 0 # # typedef int size_t; # typedef /*long*/ int fpos_t; # typedef void *__gnuc_va_list; # # void clearerr(FILE *); # clearerr # 0 # int fclose(FILE *); # fclose # 0 # int feof(FILE *); # feof # 0 # int ferror(FILE *); # ferror # 0 # int fflush(FILE *); # fflush # 0 # int fgetc(FILE *); # fgetc # 0 # int fgetpos(FILE *, fpos_t *); # fgetpos # 0 # 0 # int fileno(FILE *); # fileno # 0 # void flockfile(); # int fprintf(FILE *, const char *, ...); # fprintf # 0 # 0 # 0 # int fpurge(); # int fputc(int, FILE *); # fputc # 0 # 0 # int fputs(const char *, FILE *); # fputs # 0 # 0 # size_t fread(void *, size_t, size_t, FILE *); # fread # 0 # 0 # 0 # 0 # int fscanf(FILE *, const char *, ...); # fscanf # 0 # 0 # 0 # /* int fseek(FILE *, long int, int); */ # int fsetpos(FILE *, const fpos_t *); # fsetpos # 0 # 0 # long ftell(FILE *); # ftell # 0 # int ftrylockfile(); # void funlockfile(); # size_t fwrite(const void *, size_t, size_t, FILE *); # fwrite # 0 # 0 # 0 # 0 # int getc(FILE *); # getc # 0 # int getc_unlocked(); # int getchar(void); # getchar # 0 # int getchar_unlocked(); # int getw(FILE *); # getw # 0 # int pclose(FILE *); # pclose # 0 # void perror(const char *); # perror # 0 # int printf(const char *, ...); # printf # 0 # 0 # int putc(int, FILE *); # putc # 0 # 0 # int putc_unlocked(); # int putchar(int); # putchar # 0 # int putchar_unlocked(); # int puts(const char *); # puts # 0 # int putw(int, FILE *); # putw # 0 # 0 # int remove(const char *); # remove # 0 # int rename (const char *, const char *); # rename # 0 # 0 # void rewind(FILE *); # rewind # 0 # int scanf(const char *, ...); # scanf # 0 # 0 # void setbuf(FILE *, char *); # setbuf # 0 # 0 # void setbuffer(); # int setlinebuf(); # int setvbuf(FILE *, char *, int, size_t); # setvbuf # 0 # 0 # 0 # 0 # int snprintf(); # int sprintf(char *, const char *, ...); # sprintf # 0 # 0 # 0 # int sscanf(const char *, const char *, ...); # sscanf # 0 # 0 # 0 # int ungetc(int, FILE *); # ungetc # 0 # 0 # int vfprintf(FILE *, const char *, __gnuc_va_list); # vfprintf # 0 # 0 # 0 # int vfscanf(); # int vprintf(const char *, __gnuc_va_list); # vprintf # 0 # 0 # int vscanf(); # int vsnprintf(); # int vsprintf(char *, const char *, __gnuc_va_list); # vsprintf # 0 # 0 # 0 # int vsscanf(); # char *ctermid(char *); # ctermid # 0 # FILE *fdopen(int, const char *); # fdopen # 0 # 0 # char *fgetln(); # char *fgets(char *, int, FILE *); # fgets # 0 # 0 # 0 # FILE *fopen(const char *, const char *); # fopen # 0 # 0 # FILE *freopen(const char *, const char *, FILE *); # freopen # 0 # 0 # 0 # FILE *funopen(); # char *gets(char *); # gets # 0 # FILE *popen(const char *, const char *); # popen # 0 # 0 # char *tempnam(const char *, const char *); # tempnam # 0 # 0 # FILE *tmpfile(void); # tmpfile # 0 # char *tmpnam(char *); # tmpnam # 0 # # #define SIZE_INT 4 # # #define INT (-1) # #define CHAR (-2) # #define UNSIGNED (-3) # #define POINTER (-4) # #define ARRAY (-5) # #define STRUCT (-6) # #define UNION (-7) # #define FUNCTION (-8) # #define EMPTY (-9) # # #define STATIC (-10) # #define GOTO (-11) # #define RETURN (-12) # #define BREAK (-13) # #define CONTINUE (-14) # #define IF (-15) # #define ELSE (-16) # #define FOR (-17) # #define DO (-18) # #define WHILE (-19) # #define SWITCH (-20) # #define CASE (-21) # #define DEFAULT (-22) # #define RESERVE (-23) # #define TAG (-24) # #define FIELD (-25) # #define IDENT (-26) # #define STRING (-27) # #define MACRO (-28) # #define BLABEL (-29) # #define FLABEL (-30) # #define TYPEDEF (-31) # #define SIZEOF (-32) # #define TYPE (-33) # #define LONG (-34) # #define SHORT (-35) # #define EXTRN (-36) # #define VOID (-37) # #define REGISTER (-38) # #define CODE (-39) # #define ENVIRONMENT (-40) # # #define TOP 0 # #define GDECL 1 # #define GSDECL 2 # #define GUDECL 3 # #define ADECL 4 # #define LDECL 5 # #define LSDECL 6 # #define LUDECL 7 # #define STADECL 8 # #define STAT 9 # #define GTDECL 10 # #define LTDECL 11 # # #define GVAR 1 # #define RGVAR 2 # #define CRGVAR 3 # #define LVAR 4 # #define RLVAR 5 # #define CRLVAR 6 # #define CONST 7 # #define FNAME 8 # #define INDIRECT 9 # #define RINDIRECT 10 # #define CRINDIRECT 11 # #define ADDRESS 12 # #define MINUS 13 # #define LNOT 14 # #define BNOT 15 # #define INC 16 # #define POSTINC 17 # #define PREINC 18 # #define CPOSTINC 19 # #define CPREINC 20 # #define DEC 21 # #define CPOSTDEC 22 # #define CPREDEC 23 # #define MUL 24 # #define UMUL 25 # #define DIV 26 # #define UDIV 27 # #define MOD 28 # #define UMOD 29 # #define ADD 30 # #define SUB 31 # #define RSHIFT 32 # #define URSHIFT 33 # #define LSHIFT 34 # #define ULSHIFT 35 # #define GT 36 # #define UGT 37 # #define GE 38 # #define UGE 39 # #define LT 40 # #define ULT 41 # #define LE 42 # #define ULE 43 # #define EQ 44 # #define NEQ 45 # #define BAND 46 # #define EOR 47 # #define BOR 48 # #define LAND 49 # #define LOR 50 # #define COND 51 # #define ASS 52 # #define CASS 53 # #define ASSOP 54 # #define CASSOP 55 # #define COMMA 56 # #define LPAR 57 # #define RPAR 58 # #define LBRA 59 # #define RBRA 60 # #define LC 61 # #define RC 62 # #define COLON 63 # #define SM 64 # #define PERIOD 65 # #define ARROW 66 # #define CNAME 67 # #define SASS 68 # #define DOTS 69 # # #define US 1 # #define AS 100 # # #define FILERR 1 # #define DCERR 2 # #define STERR 3 # #define EXERR 4 # #define CNERR 5 # #define CHERR 6 # #define GSERR 7 # #define LSERR 8 # #define STRERR 9 # #define LNERR 10 # #define EOFERR 11 # #define MCERR 12 # #define INCERR 13 # #define HPERR 14 # #define TYERR 15 # #define LVERR 16 # #define UDERR 17 # #define OPTION 18 # #define REG_ERR 19 # #define CODE_ERR 20 # # #define GSYMS 9000 # #define LSYMS 500 # # #define HEAPSIZE 10000 # /* #define CHEAPSIZE 3000 */ # #define CHEAPSIZE 256000 # #define LBUFSIZE 4096 # # #define FILES 3 # #define OUTPUT_FILE_NAME "mcout.s" # # EXTERN int sym,ch,chsave,type,mode,stmode,gfree,lfree,mflag,lineno,glineno; # EXTERN int labelno,gpc,disp,reg_var,debug; # EXTERN int symval,args,init_vars,heap[HEAPSIZE]; # EXTERN int blabel,clabel,dlabel,cslabel,ilabel,control,ac,ac2,lsrc,chk,asmf; # EXTERN int MAX_REGISTER_VAR; # # EXTERN unsigned hash; # # EXTERN char linebuf[LBUFSIZE],namebuf[LBUFSIZE],*chptr,*chptrsave; # EXTERN char *name,*cheapp,**av,/*obuf[320],*/*sptr,escape(void); # escape # 0 # EXTERN int arg_offset,stat_no,int_size,disp_offset,endian,csvalue,csvalue1; # EXTERN int code_arg_offset; # EXTERN int retlabel,retpending,retcont; # # EXTERN FILE *obuf; # # typedef struct nametable { # char *nm; # int sc,ty,dsp; } NMTBL; # # EXTERN NMTBL ntable[GSYMS+LSYMS],*nptr,*gnptr,*decl0(void),*decl1(void),*lsearch(char *name),*gsearch(void); # decl0 # 0 # decl1 # 0 # lsearch # 0 # gsearch # 0 # EXTERN NMTBL *fnptr; # # EXTERN struct {int fd,ln;/*char fcb[320]*/FILE *fcb;} *filep,filestack[FILES]; # EXTERN char cheap[CHEAPSIZE]; # # # #define REGISTERS6 0 # # void code_init(void); # code_init # 0 # void free_register(int i); # free_register # 0 # void emit_init(void); # emit_init # 0 # void emit_push(void); # emit_push # 0 # void gexpr(int e1); # gexpr # 0 # void g_expr(int e1); # g_expr # 0 # void bexpr(int e1, char cond, int l1); # bexpr # 0 # 0 # 0 # void b_expr(int e1, char cond, int l1); # b_expr # 0 # 0 # 0 # void string(int e1); # string # 0 # void function(int e1); # function # 0 # void machinop(int e1); # machinop # 0 # void rindirect(int e1); # rindirect # 0 # void assign(int e1); # assign # 0 # void sassign(int e1); # sassign # 0 # void assop(int e1); # assop # 0 # void tosop(int op); # tosop # 0 # char *div_setup(int oreg) ; # div_setup # 0 # void shift(char *op, int reg) ; # shift # 0 # 0 # void ld_indexx(int byte, int n, char *xrn); # ld_indexx # 0 # 0 # 0 # void st_indexx(int byte, int n, char *xrn); # st_indexx # 0 # 0 # 0 # void indexy(char *op, char *gvar); # indexy # 0 # 0 # void cmpdimm(int e, int csreg); # cmpdimm # 0 # 0 # void global_table(void) ; # global_table # 0 # void local_table(void) ; # local_table # 0 # void opening(char *filename); # opening # 0 # void closing(void); # closing # 0 # void gen_gdecl(char *n, int gpc) ; # gen_gdecl # 0 # 0 # void jmp_label(int l); # jmp_label # 0 # void jmp_eq_label(int l); # jmp_eq_label # 0 # void rexpr(int e1, int l1, char *s); # rexpr # 0 # 0 # 0 # void jcond(int l, char cond); # jcond # 0 # 0 # void jmp(int l); # jmp # 0 # void def_label(int cslabel, int dlabel) ; # def_label # 0 # 0 # void gen_comment(char *s); # gen_comment # 0 # void gen_source(char *s); # gen_source # 0 # void code_enter(char *name) ; # code_enter # 0 # void code_leave(char *name) ; # code_leave # 0 # void enter(char *name) ; # enter # 0 # void enter1(int disp) ; # enter1 # 0 # void ret(void); # ret # 0 # void emit_data(int e, int t, NMTBL *n); # emit_data # 0 # 0 # 0 # void text_mode(void); # text_mode # 0 # void data_mode(char *name); # data_mode # 0 # int get_register_var(void); # get_register_var # 0 # void jump(int e1, int env); # jump # 0 # 0 # int lvar(int l); # lvar # 0 # # int cadr(int e); # cadr # 0 # int car(int e); # car # 0 # int caddr(int e); # caddr # 0 # int fwdlabel(void); # fwdlabel # 0 # void fwddef(int l); # fwddef # 0 # int cadddr(int e); # cadddr # 0 # int backdef(void); # backdef # 0 # int error(int n); # error # 0 # int size(int t); # size # 0 # int list3(int e1, int e2, int e3); # list3 # 0 # 0 # 0 # # #define TEXT_EMIT_MODE 0 # #define DATA_EMIT_MODE 1 # #define RODATA_EMIT_MODE 2 # # static output_mode = TEXT_EMIT_MODE; .globl output_mode .data .type output_mode,@object output_mode: .long 0 _2: .size output_mode,_2-output_mode # static data_alignment = 0; .globl data_alignment .type data_alignment,@object data_alignment: .long 0 _3: .size data_alignment,_3-data_alignment # # /* # local1 <----24 local variable # %esi -20 <- disp_offset # %edi -16 # %edx -12 # %ecx -8 # %ebx -4 # %ebp = %esp 0 # %eip 4 <- arg_offset # arg1 8 # see enter/enter1/leave # */ # int arg_offset = 8; .globl arg_offset .type arg_offset,@object arg_offset: .long 8 _4: .size arg_offset,_4-arg_offset # int disp_offset = -20; .globl disp_offset .type disp_offset,@object disp_offset: .long -20 _5: .size disp_offset,_5-disp_offset # int func_disp_offset = -20; .globl func_disp_offset .type func_disp_offset,@object func_disp_offset: .long -20 _6: .size func_disp_offset,_6-func_disp_offset # int code_disp_offset = 0; .globl code_disp_offset .type code_disp_offset,@object code_disp_offset: .long 0 _7: .size code_disp_offset,_7-code_disp_offset # int int_size = 4; .globl int_size .type int_size,@object int_size: .long 4 _8: .size int_size,_8-int_size # int endian = 0; .globl endian .type endian,@object endian: .long 0 _9: .size endian,_9-endian # int MAX_REGISTER=6; /* intel386のレジスタを4つまで使う*/ .globl MAX_REGISTER .type MAX_REGISTER,@object MAX_REGISTER: .long 6 _10: .size MAX_REGISTER,_10-MAX_REGISTER # int REAL_MAX_REGISTER=8; /* intel386のレジスタが8つということ*/ .globl REAL_MAX_REGISTER .type REAL_MAX_REGISTER,@object REAL_MAX_REGISTER: .long 8 _11: .size REAL_MAX_REGISTER,_11-REAL_MAX_REGISTER # int MAX_DATA_REG=4; .globl MAX_DATA_REG .type MAX_DATA_REG,@object MAX_DATA_REG: .long 4 _12: .size MAX_DATA_REG,_12-MAX_DATA_REG # int MAX_POINTER=3; .globl MAX_POINTER .type MAX_POINTER,@object MAX_POINTER: .long 3 _13: .size MAX_POINTER,_13-MAX_POINTER # int MAX_REGISTGER_VAR=2; .globl MAX_REGISTGER_VAR .type MAX_REGISTGER_VAR,@object MAX_REGISTGER_VAR: .long 2 _14: .size MAX_REGISTGER_VAR,_14-MAX_REGISTGER_VAR # # static int creg; /* current register */ # static char *crn; /* current register name */ # static int lreg; /* operand register */ # static char *lrn; /* operand register name */ # static int dreg; /* temporary register */ # static char *drn; /* temporary register name */ # static int xreg; /* pointer register */ # static int reg_sp; /* REGister Stack-Pointer */ # # # #define REG_EAX 0 # #define REG_EBX 1 # #define REG_ECX 2 # #define REG_EDX 3 # #define REG_ESI 4 # #define REG_EDI 5 # #define REG_EBP 6 # #define REG_ESP 7 # # # #define DATA_REG 0 # #define POINTER_REG 3 # static char *reg_name[8]; # static char *reg_name_l[4]; # # /* # creg currrent virtual register # lreg operand virtual register # dreg spare virtual register # # rname[creg] currrent real register # rname[lreg] operand real register # rname[dreg] spare real register # # regs[] virtual register usage # # reg_name[rname[creg]] # */ # # #define MAX_MAX 10 # static int rname[MAX_MAX]; # static int regs[MAX_MAX]; /* 使われているレジスタを示すフラグ */ # static int reg_stack[MAX_MAX]; /* 実際のレジスタの領域 */ # # void # code_init(void) # code_init # 474 # { .text .align 2 .align 2 .globl code_init code_init: .type code_init,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # if (REGISTERS6) { jmp _16 # arg_offset = 8; movl $8,%eax movl %eax,arg_offset # func_disp_offset = -20; movl $-20,%eax movl %eax,func_disp_offset # int_size = 4; movl $4,%eax movl %eax,int_size # endian = 0; movl $0,%eax movl %eax,endian # MAX_REGISTER=6; movl $6,%eax movl %eax,MAX_REGISTER # MAX_DATA_REG=4; movl $4,%eax movl %eax,MAX_DATA_REG # MAX_POINTER=3; movl $3,%eax movl %eax,MAX_POINTER # } else { _16: # arg_offset = 8; movl $8,%eax movl %eax,arg_offset # func_disp_offset = -12; movl $-12,%eax movl %eax,func_disp_offset # int_size = 4; movl $4,%eax movl %eax,int_size # endian = 0; movl $0,%eax movl %eax,endian # MAX_REGISTER=4; movl $4,%eax movl %eax,MAX_REGISTER # MAX_DATA_REG=4; movl $4,%eax movl %eax,MAX_DATA_REG # MAX_POINTER=1; movl $1,%eax movl %eax,MAX_POINTER # } # MAX_REGISTER_VAR=2; movl $2,%eax movl %eax,MAX_REGISTER_VAR # # reg_name[REG_EAX] = "%eax"; .section .rodata _17: .string "%eax" .text lea _17,%eax movl $0,%ecx movl $reg_name,%edx addl %ecx,%edx movl %eax,(%edx) movl %eax,%edx # reg_name[REG_EBX] = "%ebx"; .section .rodata _18: .string "%ebx" .text lea _18,%edx movl $4,%eax movl $reg_name,%ecx addl %eax,%ecx movl %edx,(%ecx) movl %edx,%ecx # reg_name[REG_ECX] = "%ecx"; .section .rodata _19: .string "%ecx" .text lea _19,%ecx movl $8,%eax movl $reg_name,%edx addl %eax,%edx movl %ecx,(%edx) movl %ecx,%edx # reg_name[REG_EDX] = "%edx"; .section .rodata _20: .string "%edx" .text lea _20,%edx movl $12,%eax movl $reg_name,%ecx addl %eax,%ecx movl %edx,(%ecx) movl %edx,%ecx # reg_name[REG_ESI] = "%esi"; .section .rodata _21: .string "%esi" .text lea _21,%ecx movl $16,%eax movl $reg_name,%edx addl %eax,%edx movl %ecx,(%edx) movl %ecx,%edx # reg_name[REG_EDI] = "%edi"; .section .rodata _22: .string "%edi" .text lea _22,%edx movl $20,%eax movl $reg_name,%ecx addl %eax,%ecx movl %edx,(%ecx) movl %edx,%ecx # reg_name[REG_EBP] = "%ebp"; .section .rodata _23: .string "%ebp" .text lea _23,%ecx movl $24,%eax movl $reg_name,%edx addl %eax,%edx movl %ecx,(%edx) movl %ecx,%edx # reg_name[REG_ESP] = "%esp"; .section .rodata _24: .string "%esp" .text lea _24,%edx movl $28,%eax movl $reg_name,%ecx addl %eax,%ecx movl %edx,(%ecx) movl %edx,%ecx # reg_name_l[REG_EAX] = "%al"; .section .rodata _25: .string "%al" .text lea _25,%ecx movl $0,%eax movl $reg_name_l,%edx addl %eax,%edx movl %ecx,(%edx) movl %ecx,%edx # reg_name_l[REG_EBX] = "%bl"; .section .rodata _26: .string "%bl" .text lea _26,%edx movl $4,%eax movl $reg_name_l,%ecx addl %eax,%ecx movl %edx,(%ecx) movl %edx,%ecx # reg_name_l[REG_ECX] = "%cl"; .section .rodata _27: .string "%cl" .text lea _27,%ecx movl $8,%eax movl $reg_name_l,%edx addl %eax,%edx movl %ecx,(%edx) movl %ecx,%edx # reg_name_l[REG_EDX] = "%dl"; .section .rodata _28: .string "%dl" .text lea _28,%edx movl $12,%eax movl $reg_name_l,%ecx addl %eax,%ecx movl %edx,(%ecx) movl %edx,%ecx # # } movl %ecx,%eax _15: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _29: .size code_init,_29-code_init # # char * # register_name(int i) # register_name # 0 # { .align 2 .globl register_name register_name: .type register_name,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # return reg_name[rname[i]]; movl $4,%eax movl $4,%ecx movl 8(%ebp),%edx imull %ecx,%edx movl $rname,%ecx addl %edx,%ecx movl (%ecx),%ecx imull %eax,%ecx movl $reg_name,%eax addl %ecx,%eax movl (%eax),%eax # } _30: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _31: .size register_name,_31-register_name # # int # get_register(void) # get_register # 0 # { /* 使われていないレジスタを調べる */ .align 2 .globl get_register get_register: .type get_register,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # int i; # for(i=0;i<MAX_REGISTER;i++) { subl $4,%esp movl $0,%eax movl %eax,-16(%ebp) _34: movl MAX_REGISTER,%eax movl -16(%ebp),%ecx subl %eax,%ecx jge _33 # if (! regs[i]) { /* 使われていないなら */ movl $4,%ecx movl -16(%ebp),%eax imull %ecx,%eax movl $regs,%ecx addl %eax,%ecx movl (%ecx),%ecx cmpl $0,%ecx jne _36 # regs[i]=1; /* そのレジスタを使うことを宣言し */ movl $1,%ecx movl $4,%eax movl -16(%ebp),%edx imull %eax,%edx movl $regs,%eax addl %edx,%eax movl %ecx,(%eax) movl %ecx,%eax # return i; /* その場所を表す番号を返す */ movl -16(%ebp),%eax # } jmp _32 # } _36: # return -1; /* 空いている場所がないなら、それを表す -1 を返す */ _35: lea -16(%ebp),%eax movl (%eax),%ecx addl $1,(%eax) jmp _34 _33: movl $-1,%ecx # } movl %ecx,%eax _32: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _37: .size get_register,_37-get_register # # void # free_register(int i) { /* いらなくなったレジスタを開放 */ # free_register # 479 .align 2 .globl free_register free_register: .type free_register,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # regs[i]=0; movl $0,%eax movl $4,%ecx movl 8(%ebp),%edx imull %ecx,%edx movl $regs,%ecx addl %edx,%ecx movl %eax,(%ecx) movl %eax,%ecx # } movl %ecx,%eax _38: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _39: .size free_register,_39-free_register # # int # register_full(void) # register_full # 0 # { .align 2 .globl register_full register_full: .type register_full,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # int i; # for(i=0;i<MAX_REGISTER;i++) { subl $4,%esp movl $0,%eax movl %eax,-16(%ebp) _42: movl MAX_REGISTER,%eax movl -16(%ebp),%ecx subl %eax,%ecx jge _41 # if (! regs[i]) { movl $4,%ecx movl -16(%ebp),%eax imull %ecx,%eax movl $regs,%ecx addl %eax,%ecx movl (%ecx),%ecx cmpl $0,%ecx jne _44 # return 0; movl $0,%ecx # } movl %ecx,%eax jmp _40 # } _44: # return 1; _43: lea -16(%ebp),%eax movl (%eax),%ecx addl $1,(%eax) jmp _42 _41: movl $1,%ecx # } movl %ecx,%eax _40: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _45: .size register_full,_45-register_full # # void # gexpr_init(void) # gexpr_init # 0 # { .align 2 .globl gexpr_init gexpr_init: .type gexpr_init,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # int i; # while(reg_sp > 0) { subl $4,%esp _48: movl $0,%eax movl reg_sp,%ecx subl %eax,%ecx jle _47 # free_register(reg_stack[--reg_sp]); movl $4,%ecx movl $reg_sp,%eax addl $-1,(%eax) movl (%eax),%eax imull %ecx,%eax movl $reg_stack,%ecx addl %eax,%ecx movl (%ecx),%ecx pushl %ecx call free_register addl $4,%esp # } # text_mode(); jmp _48 _47: call text_mode # } _46: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _49: .size gexpr_init,_49-gexpr_init # # void # emit_init(void) # emit_init # 484 # { .align 2 .globl emit_init emit_init: .type emit_init,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # int i; # for(i=0;i<REAL_MAX_REGISTER;i++) regs[i]=0; subl $4,%esp movl $0,%eax movl %eax,-16(%ebp) _52: movl REAL_MAX_REGISTER,%eax movl -16(%ebp),%ecx subl %eax,%ecx jge _51 movl $0,%ecx movl $4,%eax movl -16(%ebp),%edx imull %eax,%edx movl $regs,%eax addl %edx,%eax movl %ecx,(%eax) movl %ecx,%eax # for(i=0;i<REAL_MAX_REGISTER;i++) rname[i]=i; _53: lea -16(%ebp),%eax movl (%eax),%ecx addl $1,(%eax) jmp _52 _51: movl $0,%ecx movl %ecx,-16(%ebp) _55: movl REAL_MAX_REGISTER,%ecx movl -16(%ebp),%eax subl %ecx,%eax jge _54 movl -16(%ebp),%eax movl $4,%ecx movl -16(%ebp),%edx imull %ecx,%edx movl $rname,%ecx addl %edx,%ecx movl %eax,(%ecx) movl %eax,%ecx # creg = get_register(); _56: lea -16(%ebp),%ecx movl (%ecx),%eax addl $1,(%ecx) jmp _55 _54: call get_register movl %eax,creg # crn = reg_name[rname[creg]]; movl $4,%eax movl $4,%ecx movl creg,%edx imull %ecx,%edx movl $rname,%ecx addl %edx,%ecx movl (%ecx),%ecx imull %eax,%ecx movl $reg_name,%eax addl %ecx,%eax movl (%eax),%eax movl %eax,crn # dreg = get_register(); call get_register movl %eax,dreg # drn = reg_name[rname[dreg]]; movl $4,%eax movl $4,%ecx movl dreg,%edx imull %ecx,%edx movl $rname,%ecx addl %edx,%ecx movl (%ecx),%ecx imull %eax,%ecx movl $reg_name,%eax addl %ecx,%eax movl (%eax),%eax movl %eax,drn # reg_sp = 0; movl $0,%eax movl %eax,reg_sp # text_mode(); call text_mode # } _50: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _57: .size emit_init,_57-emit_init # # void # set_crn(int i) # set_crn # 0 # { .align 2 .globl set_crn set_crn: .type set_crn,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # creg = i; movl 8(%ebp),%eax movl %eax,creg # crn = reg_name[rname[creg]]; movl $4,%eax movl $4,%ecx movl creg,%edx imull %ecx,%edx movl $rname,%ecx addl %edx,%ecx movl (%ecx),%ecx imull %eax,%ecx movl $reg_name,%eax addl %ecx,%eax movl (%eax),%eax movl %eax,crn # } _58: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _59: .size set_crn,_59-set_crn # # void # set_drn(int i) # set_drn # 0 # { .align 2 .globl set_drn set_drn: .type set_drn,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # dreg = i; movl 8(%ebp),%eax movl %eax,dreg # drn = reg_name[rname[dreg]]; movl $4,%eax movl $4,%ecx movl dreg,%edx imull %ecx,%edx movl $rname,%ecx addl %edx,%ecx movl (%ecx),%ecx imull %eax,%ecx movl $reg_name,%eax addl %ecx,%eax movl (%eax),%eax movl %eax,drn # } _60: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _61: .size set_drn,_61-set_drn # # int # virtual(int real) # virtual # 0 # { .align 2 .globl virtual virtual: .type virtual,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # int real_v,i; # real_v = -1; subl $8,%esp movl $-1,%eax movl %eax,-16(%ebp) # for(i=0;i<MAX_REGISTER;i++) { movl $0,%eax movl %eax,-20(%ebp) _64: movl MAX_REGISTER,%eax movl -20(%ebp),%ecx subl %eax,%ecx jge _63 # if (rname[i]==real) { movl 8(%ebp),%ecx movl $4,%eax movl -20(%ebp),%edx imull %eax,%edx movl $rname,%eax addl %edx,%eax movl (%eax),%eax subl %ecx,%eax jne _66 # real_v=i; movl -20(%ebp),%eax movl %eax,-16(%ebp) # break; jmp _63 # } # } _66: # if (real_v == -1) _65: lea -20(%ebp),%eax movl (%eax),%ecx addl $1,(%eax) jmp _64 _63: movl $-1,%ecx movl -16(%ebp),%eax subl %ecx,%eax jne _67 # error(-1); movl $-1,%eax pushl %eax call error addl $4,%esp # return real_v; _67: movl -16(%ebp),%eax # } _62: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _68: .size virtual,_68-virtual # # void # use_register(int virt, int real, int move) # use_register # 0 # 0 # 0 # { .align 2 .globl use_register use_register: .type use_register,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # int real_v; # char *move_op; # if (rname[virt]==real) subl $8,%esp movl 12(%ebp),%eax movl $4,%ecx movl 8(%ebp),%edx imull %ecx,%edx movl $rname,%ecx addl %edx,%ecx movl (%ecx),%ecx subl %eax,%ecx jne _70 # return; # real_v = virtual(real); movl %ecx,%eax jmp _69 _70: movl 12(%ebp),%eax pushl %eax call virtual addl $4,%esp movl %eax,-16(%ebp) # move_op = regs[real_v]?"\txchg %s,%s\n":"\tmovl %s,%s\n"; movl $4,%eax movl -16(%ebp),%ecx imull %eax,%ecx movl $regs,%eax addl %ecx,%eax movl (%eax),%eax cmpl $0,%eax je _71 .section .rodata _72: .string "\011xchg %s,%s\n" .text lea _72,%eax jmp _73 _71: .section .rodata _74: .string "\011movl %s,%s\n" .text lea _74,%eax _73: movl %eax,-20(%ebp) # if (move || regs[real_v]) { cmpl $0,16(%ebp) jne _76 movl $4,%eax movl -16(%ebp),%ecx imull %eax,%ecx movl $regs,%eax addl %ecx,%eax movl (%eax),%eax cmpl $0,%eax je _75 _76: # printf(move_op,reg_name[rname[virt]],reg_name[real]); movl $4,%eax movl 12(%ebp),%ecx imull %eax,%ecx movl $reg_name,%eax addl %ecx,%eax movl (%eax),%eax pushl %eax movl $4,%eax movl $4,%ecx movl 8(%ebp),%edx imull %ecx,%edx movl $rname,%ecx addl %edx,%ecx movl (%ecx),%ecx imull %eax,%ecx movl $reg_name,%eax addl %ecx,%eax movl (%eax),%eax pushl %eax movl -20(%ebp),%eax pushl %eax call printf addl $12,%esp # } # rname[real_v] = rname[virt]; _75: movl $4,%eax movl 8(%ebp),%ecx imull %eax,%ecx movl $rname,%eax addl %ecx,%eax movl (%eax),%eax movl $4,%ecx movl -16(%ebp),%edx imull %ecx,%edx movl $rname,%ecx addl %edx,%ecx movl %eax,(%ecx) movl %eax,%ecx # rname[virt] = real; movl 12(%ebp),%ecx movl $4,%eax movl 8(%ebp),%edx imull %eax,%edx movl $rname,%eax addl %edx,%eax movl %ecx,(%eax) movl %ecx,%eax # crn = reg_name[rname[creg]]; movl $4,%eax movl $4,%ecx movl creg,%edx imull %ecx,%edx movl $rname,%ecx addl %edx,%ecx movl (%ecx),%ecx imull %eax,%ecx movl $reg_name,%eax addl %ecx,%eax movl (%eax),%eax movl %eax,crn # drn = reg_name[rname[dreg]]; movl $4,%eax movl $4,%ecx movl dreg,%edx imull %ecx,%edx movl $rname,%ecx addl %edx,%ecx movl (%ecx),%ecx imull %eax,%ecx movl $reg_name,%eax addl %ecx,%eax movl (%eax),%eax movl %eax,drn # lrn = reg_name[rname[lreg]]; movl $4,%eax movl $4,%ecx movl lreg,%edx imull %ecx,%edx movl $rname,%ecx addl %edx,%ecx movl (%ecx),%ecx imull %eax,%ecx movl $reg_name,%eax addl %ecx,%eax movl (%eax),%eax movl %eax,lrn # } _69: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _77: .size use_register,_77-use_register # # void # use_pointer(int virt, int move) # use_pointer # 0 # 0 # { .align 2 .globl use_pointer use_pointer: .type use_pointer,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # int i; # if (rname[virt]>=POINTER_REG) subl $4,%esp movl $3,%eax movl $4,%ecx movl 8(%ebp),%edx imull %ecx,%edx movl $rname,%ecx addl %edx,%ecx movl (%ecx),%ecx subl %eax,%ecx jl _79 # return; # for(i=POINTER_REG;i<MAX_REGISTER;i++) { movl %ecx,%eax jmp _78 _79: movl $3,%eax movl %eax,-16(%ebp) _81: movl MAX_REGISTER,%eax movl -16(%ebp),%ecx subl %eax,%ecx jge _80 # if (!regs[virtual(i)]) { movl $4,%ecx movl -16(%ebp),%eax pushl %eax call virtual addl $4,%esp imull %ecx,%eax movl $regs,%ecx addl %eax,%ecx movl (%ecx),%ecx cmpl $0,%ecx jne _83 # use_register(virt,i,move); movl 12(%ebp),%ecx pushl %ecx movl -16(%ebp),%ecx pushl %ecx movl 8(%ebp),%ecx pushl %ecx call use_register addl $12,%esp # return; # } jmp _78 # } _83: # /* we prefer EBX */ # use_register(virt,REG_EBX,move); _82: lea -16(%ebp),%eax movl (%eax),%ecx addl $1,(%eax) jmp _81 _80: movl 12(%ebp),%ecx pushl %ecx movl $1,%ecx pushl %ecx movl 8(%ebp),%ecx pushl %ecx call use_register addl $12,%esp # } _78: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _84: .size use_pointer,_84-use_pointer # # void # use_data_reg(int virt, int move) # use_data_reg # 0 # 0 # { .align 2 .globl use_data_reg use_data_reg: .type use_data_reg,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # int i; # if (rname[virt]<MAX_DATA_REG) subl $4,%esp movl MAX_DATA_REG,%eax movl $4,%ecx movl 8(%ebp),%edx imull %ecx,%edx movl $rname,%ecx addl %edx,%ecx movl (%ecx),%ecx subl %eax,%ecx jge _86 # return; # for(i=0;i<MAX_DATA_REG;i++) { movl %ecx,%eax jmp _85 _86: movl $0,%eax movl %eax,-16(%ebp) _88: movl MAX_DATA_REG,%eax movl -16(%ebp),%ecx subl %eax,%ecx jge _87 # if (!regs[virtual(i)]) { movl $4,%ecx movl -16(%ebp),%eax pushl %eax call virtual addl $4,%esp imull %ecx,%eax movl $regs,%ecx addl %eax,%ecx movl (%ecx),%ecx cmpl $0,%ecx jne _90 # use_register(virt,i,move); movl 12(%ebp),%ecx pushl %ecx movl -16(%ebp),%ecx pushl %ecx movl 8(%ebp),%ecx pushl %ecx call use_register addl $12,%esp # return; # } jmp _85 # } _90: # /* we prefer EBX */ # use_register(virt,REG_EBX,move); _89: lea -16(%ebp),%eax movl (%eax),%ecx addl $1,(%eax) jmp _88 _87: movl 12(%ebp),%ecx pushl %ecx movl $1,%ecx pushl %ecx movl 8(%ebp),%ecx pushl %ecx call use_register addl $12,%esp # } _85: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _91: .size use_data_reg,_91-use_data_reg # # int # pop_register(void) # pop_register # 0 # { /* レジスタから値を取り出す */ .align 2 .globl pop_register pop_register: .type pop_register,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # int i,j; # # j = creg; subl $8,%esp movl creg,%eax movl %eax,-20(%ebp) # i = reg_stack[--reg_sp]; movl $4,%eax movl $reg_sp,%ecx addl $-1,(%ecx) movl (%ecx),%ecx imull %eax,%ecx movl $reg_stack,%eax addl %ecx,%eax movl (%eax),%eax movl %eax,-16(%ebp) # # if(i<0) { movl $0,%eax movl -16(%ebp),%ecx subl %eax,%ecx jge _93 # return i; movl -16(%ebp),%ecx # } else { movl %ecx,%eax jmp _92 _93: # free_register(i); movl -16(%ebp),%eax pushl %eax call free_register addl $4,%esp # lreg = i; movl -16(%ebp),%eax movl %eax,lreg # lrn = reg_name[rname[lreg]]; movl $4,%eax movl $4,%ecx movl lreg,%edx imull %ecx,%edx movl $rname,%ecx addl %edx,%ecx movl (%ecx),%ecx imull %eax,%ecx movl $reg_name,%eax addl %ecx,%eax movl (%eax),%eax movl %eax,lrn # regs[i]=0; movl $0,%eax movl $4,%ecx movl -16(%ebp),%edx imull %ecx,%edx movl $regs,%ecx addl %edx,%ecx movl %eax,(%ecx) movl %eax,%ecx # return lreg; movl lreg,%ecx # } movl %ecx,%eax jmp _92 # } _92: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _94: .size pop_register,_94-pop_register # # int # stack_used(void) { # stack_used # 0 .align 2 .globl stack_used stack_used: .type stack_used,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # return reg_stack[--reg_sp]<0; movl $0,%eax movl $4,%ecx movl $reg_sp,%edx addl $-1,(%edx) movl (%edx),%edx imull %ecx,%edx movl $reg_stack,%ecx addl %edx,%ecx movl (%ecx),%ecx subl %eax,%ecx jl _96 xorl %ecx,%ecx jmp _97 _96: movl $1,%ecx _97: # } movl %ecx,%eax _95: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _98: .size stack_used,_98-stack_used # # void # emit_push(void) # emit_push # 489 # { .align 2 .globl emit_push emit_push: .type emit_push,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # int new_reg; # new_reg = get_register(); subl $4,%esp call get_register movl %eax,-16(%ebp) # if(new_reg<0) { /* もうレジスタがない */ movl $0,%eax movl -16(%ebp),%ecx subl %eax,%ecx jge _100 # reg_stack[reg_sp++] = -1; movl $-1,%ecx movl $4,%eax movl $reg_sp,%edx pushl %edx popl %ebx movl (%ebx),%edx addl $1,(%ebx) imull %eax,%edx movl $reg_stack,%eax addl %edx,%eax movl %ecx,(%eax) movl %ecx,%eax # printf("\tpushl %s\n",crn); movl crn,%eax pushl %eax .section .rodata _101: .string "\011pushl %s\n" .text lea _101,%eax pushl %eax call printf addl $8,%esp # } else { jmp _102 _100: # reg_stack[reg_sp++] = creg; /* push するかわりにレジスタを使う */ movl creg,%eax movl $4,%ecx movl $reg_sp,%edx pushl %edx popl %ebx movl (%ebx),%edx addl $1,(%ebx) imull %ecx,%edx movl $reg_stack,%ecx addl %edx,%ecx movl %eax,(%ecx) movl %eax,%ecx # set_crn(new_reg); movl -16(%ebp),%ecx pushl %ecx call set_crn addl $4,%esp # } # } _102: _99: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _103: .size emit_push,_103-emit_push # # char * # emit_pop(int type) # emit_pop # 0 # { .align 2 .globl emit_pop emit_pop: .type emit_pop,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # char *xrn; # if (pop_register()==-1) { subl $4,%esp movl $-1,%eax xchg %ecx,%eax call pop_register subl %ecx,%eax jne _105 # if (type==POINTER_REG) movl $3,%eax movl 8(%ebp),%ecx subl %eax,%ecx jne _106 # use_pointer(dreg,0); movl $0,%ecx pushl %ecx movl dreg,%ecx pushl %ecx call use_pointer addl $8,%esp # else if (type==DATA_REG) jmp _107 _106: movl $0,%eax movl 8(%ebp),%ecx subl %eax,%ecx jne _108 # use_data_reg(dreg,0); movl $0,%ecx pushl %ecx movl dreg,%ecx pushl %ecx call use_data_reg addl $8,%esp # printf("\tpopl %s\n",drn); _108: _107: movl drn,%eax pushl %eax .section .rodata _109: .string "\011popl %s\n" .text lea _109,%eax pushl %eax call printf addl $8,%esp # xrn = drn; movl drn,%eax movl %eax,-16(%ebp) # xreg = dreg; movl dreg,%eax movl %eax,xreg # } else { jmp _110 _105: # xrn = lrn; movl lrn,%eax movl %eax,-16(%ebp) # xreg = lreg; movl lreg,%eax movl %eax,xreg # } # return xrn; _110: movl -16(%ebp),%eax # } _104: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _111: .size emit_pop,_111-emit_pop # # int # get_register_var(void) # get_register_var # 691 # { .align 2 .globl get_register_var get_register_var: .type get_register_var,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # int i; # for(i=REG_ESI;i<REG_ESP;i++) { subl $4,%esp movl $4,%eax movl %eax,-16(%ebp) _114: movl $7,%eax movl -16(%ebp),%ecx subl %eax,%ecx jge _113 # if (! regs[i]) { /* 使われていないなら */ movl $4,%ecx movl -16(%ebp),%eax imull %ecx,%eax movl $regs,%ecx addl %eax,%ecx movl (%ecx),%ecx cmpl $0,%ecx jne _116 # regs[i]=1; /* そのレジスタを使うことを宣言し */ movl $1,%ecx movl $4,%eax movl -16(%ebp),%edx imull %eax,%edx movl $regs,%eax addl %edx,%eax movl %ecx,(%eax) movl %ecx,%eax # return i; /* その場所を表す番号を返す */ movl -16(%ebp),%eax # } jmp _112 # } _116: # return -1; _115: lea -16(%ebp),%eax movl (%eax),%ecx addl $1,(%eax) jmp _114 _113: movl $-1,%ecx # } movl %ecx,%eax _112: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _117: .size get_register_var,_117-get_register_var # # void # gexpr(int e1) # gexpr # 494 # { .align 2 .globl gexpr gexpr: .type gexpr,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # gexpr_init(); call gexpr_init # g_expr(e1); movl 8(%ebp),%eax pushl %eax call g_expr addl $4,%esp # csvalue = rname[creg]; /* for siwtch value */ movl $4,%eax movl creg,%ecx imull %eax,%ecx movl $rname,%eax addl %ecx,%eax movl (%eax),%eax movl %eax,csvalue # } _118: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _119: .size gexpr,_119-gexpr # # void # g_expr(int e1) # g_expr # 499 # { .align 2 .globl g_expr g_expr: .type g_expr,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # int e2,e3,e4; # char *xrn; # NMTBL *n; # # if (chk) return; subl $20,%esp cmpl $0,chk je _121 # e2 = cadr(e1); jmp _120 _121: movl 8(%ebp),%eax pushl %eax call cadr addl $4,%esp movl %eax,-16(%ebp) # switch (car(e1)){ movl 8(%ebp),%eax pushl %eax call car addl $4,%esp # case GVAR: # /* use_pointer(creg,0); */ # printf("\tmovl $%s,%s\n",caddr(e1),crn); cmpl $1,%eax jne _124 _123: movl crn,%eax pushl %eax movl 8(%ebp),%eax pushl %eax call caddr addl $4,%esp pushl %eax .section .rodata _125: .string "\011movl $%s,%s\n" .text lea _125,%eax pushl %eax call printf addl $12,%esp # return; # case RGVAR: jmp _120 # /* use_pointer(creg,0); */ # printf("\tmovl %s,%s\n",caddr(e1),crn); _124: cmpl $2,%eax jne _127 _126: movl crn,%eax pushl %eax movl 8(%ebp),%eax pushl %eax call caddr addl $4,%esp pushl %eax .section .rodata _128: .string "\011movl %s,%s\n" .text lea _128,%eax pushl %eax call printf addl $12,%esp # return; # case CRGVAR: jmp _120 # printf("\tmovsbl %s,%s\n",caddr(e1),crn); _127: cmpl $3,%eax jne _130 _129: movl crn,%eax pushl %eax movl 8(%ebp),%eax pushl %eax call caddr addl $4,%esp pushl %eax .section .rodata _131: .string "\011movsbl %s,%s\n" .text lea _131,%eax pushl %eax call printf addl $12,%esp # return; # case LVAR: jmp _120 # /* use_pointer(creg,0); */ # printf("\tlea %d(%%ebp),%s\n",lvar(e2),crn); _130: cmpl $4,%eax jne _133 _132: movl crn,%eax pushl %eax movl -16(%ebp),%eax pushl %eax call lvar addl $4,%esp pushl %eax .section .rodata _134: .string "\011lea %d(%%ebp),%s\n" .text lea _134,%eax pushl %eax call printf addl $12,%esp # return; # case REGISTER: jmp _120 # /* this is of course redundant... */ # printf("\tmovl %s,%s\n",register_name(e2),crn); _133: cmpl $-38,%eax jne _136 _135: movl crn,%eax pushl %eax movl -16(%ebp),%eax pushl %eax call register_name addl $4,%esp pushl %eax .section .rodata _137: .string "\011movl %s,%s\n" .text lea _137,%eax pushl %eax call printf addl $12,%esp # return; # case RLVAR: jmp _120 # printf("\tmovl %d(%%ebp),%s\n",lvar(e2),crn); _136: cmpl $5,%eax jne _139 _138: movl crn,%eax pushl %eax movl -16(%ebp),%eax pushl %eax call lvar addl $4,%esp pushl %eax .section .rodata _140: .string "\011movl %d(%%ebp),%s\n" .text lea _140,%eax pushl %eax call printf addl $12,%esp # return; # case CRLVAR: jmp _120 # printf("\tmovsbl %d(%%ebp),%s\n",lvar(e2),crn); _139: cmpl $6,%eax jne _142 _141: movl crn,%eax pushl %eax movl -16(%ebp),%eax pushl %eax call lvar addl $4,%esp pushl %eax .section .rodata _143: .string "\011movsbl %d(%%ebp),%s\n" .text lea _143,%eax pushl %eax call printf addl $12,%esp # return; # case FNAME: jmp _120 # printf("\tmovl $%s,%s\n",((NMTBL *)e2)->nm,crn); _142: cmpl $8,%eax jne _145 _144: movl crn,%eax pushl %eax movl -16(%ebp),%eax movl (%eax),%eax pushl %eax .section .rodata _146: .string "\011movl $%s,%s\n" .text lea _146,%eax pushl %eax call printf addl $12,%esp # return; # case CONST: /* 代入する値が0でも特別な処理はしない */ jmp _120 # printf("\tmovl $%d,%s\n",e2,crn); _145: cmpl $7,%eax jne _148 _147: movl crn,%eax pushl %eax movl -16(%ebp),%eax pushl %eax .section .rodata _149: .string "\011movl $%d,%s\n" .text lea _149,%eax pushl %eax call printf addl $12,%esp # return; # case STRING: jmp _120 # string(e1); _148: cmpl $-27,%eax jne _151 _150: movl 8(%ebp),%eax pushl %eax call string addl $4,%esp # return; # case FUNCTION: jmp _120 # function(e1); _151: cmpl $-8,%eax jne _153 _152: movl 8(%ebp),%eax pushl %eax call function addl $4,%esp # return; # case CODE: jmp _120 # jump(e2,caddr(e1)); _153: cmpl $-39,%eax jne _155 _154: movl 8(%ebp),%eax pushl %eax call caddr addl $4,%esp pushl %eax movl -16(%ebp),%eax pushl %eax call jump addl $8,%esp # return; # case INDIRECT: jmp _120 # g_expr(e2); _155: cmpl $9,%eax jne _157 _156: movl -16(%ebp),%eax pushl %eax call g_expr addl $4,%esp # return; # case RINDIRECT: case CRINDIRECT: jmp _120 # rindirect(e1); _157: cmpl $11,%eax je _158 cmpl $10,%eax jne _159 _158: movl 8(%ebp),%eax pushl %eax call rindirect addl $4,%esp # return; # case ADDRESS: jmp _120 # g_expr(e2); _159: cmpl $12,%eax jne _161 _160: movl -16(%ebp),%eax pushl %eax call g_expr addl $4,%esp # return; # case MINUS: /* レジスタに対し、neglを実行すれば実現可能 */ jmp _120 # g_expr(e2); _161: cmpl $13,%eax jne _163 _162: movl -16(%ebp),%eax pushl %eax call g_expr addl $4,%esp # /* use_data_reg(creg,1); */ # printf("\tnegl %s\n", crn); movl crn,%eax pushl %eax .section .rodata _164: .string "\011negl %s\n" .text lea _164,%eax pushl %eax call printf addl $8,%esp # return; # case BNOT: /* ~ */ jmp _120 # g_expr(e2); _163: cmpl $15,%eax jne _166 _165: movl -16(%ebp),%eax pushl %eax call g_expr addl $4,%esp # /* use_data_reg(creg,1); */ # printf("\tnotl %s\n", crn); movl crn,%eax pushl %eax .section .rodata _167: .string "\011notl %s\n" .text lea _167,%eax pushl %eax call printf addl $8,%esp # return; # case LNOT: /* ! */ jmp _120 # g_expr(e2); _166: cmpl $14,%eax jne _169 _168: movl -16(%ebp),%eax pushl %eax call g_expr addl $4,%esp # use_data_reg(creg,1); movl $1,%eax pushl %eax movl creg,%eax pushl %eax call use_data_reg addl $8,%esp # printf("\tcmpl $0,%s\n", crn); movl crn,%eax pushl %eax .section .rodata _170: .string "\011cmpl $0,%s\n" .text lea _170,%eax pushl %eax call printf addl $8,%esp # printf("\tsete %s\n", reg_name_l[rname[creg]]); movl $4,%eax movl $4,%ecx movl creg,%edx imull %ecx,%edx movl $rname,%ecx addl %edx,%ecx movl (%ecx),%ecx imull %eax,%ecx movl $reg_name_l,%eax addl %ecx,%eax movl (%eax),%eax pushl %eax .section .rodata _171: .string "\011sete %s\n" .text lea _171,%eax pushl %eax call printf addl $8,%esp # printf("\tmovzbl %s,%s\n", reg_name_l[rname[creg]],crn); movl crn,%eax pushl %eax movl $4,%eax movl $4,%ecx movl creg,%edx imull %ecx,%edx movl $rname,%ecx addl %edx,%ecx movl (%ecx),%ecx imull %eax,%ecx movl $reg_name_l,%eax addl %ecx,%eax movl (%eax),%eax pushl %eax .section .rodata _172: .string "\011movzbl %s,%s\n" .text lea _172,%eax pushl %eax call printf addl $12,%esp # return; # case PREINC: jmp _120 # if (car(e2)==REGISTER) { _169: cmpl $18,%eax jne _174 _173: movl $-38,%eax movl -16(%ebp),%ecx pushl %ecx xchg %ecx,%eax call car addl $4,%esp subl %ecx,%eax jne _175 # printf("\taddl $%d,%s\n",caddr(e1),register_name(cadr(e2))); movl -16(%ebp),%eax pushl %eax call cadr addl $4,%esp pushl %eax call register_name addl $4,%esp pushl %eax movl 8(%ebp),%eax pushl %eax call caddr addl $4,%esp pushl %eax .section .rodata _176: .string "\011addl $%d,%s\n" .text lea _176,%eax pushl %eax call printf addl $12,%esp # printf("\tmovl %s,%s\n",register_name(cadr(e2)),crn); movl crn,%eax pushl %eax movl -16(%ebp),%eax pushl %eax call cadr addl $4,%esp pushl %eax call register_name addl $4,%esp pushl %eax .section .rodata _177: .string "\011movl %s,%s\n" .text lea _177,%eax pushl %eax call printf addl $12,%esp # return; # } jmp _120 # g_expr(e2); _175: movl -16(%ebp),%eax pushl %eax call g_expr addl $4,%esp # printf("\taddl $%d,(%s)\n",caddr(e1),crn); movl crn,%eax pushl %eax movl 8(%ebp),%eax pushl %eax call caddr addl $4,%esp pushl %eax .section .rodata _178: .string "\011addl $%d,(%s)\n" .text lea _178,%eax pushl %eax call printf addl $12,%esp # printf("\tmovl (%s),%s\n",crn,crn); movl crn,%eax pushl %eax movl crn,%eax pushl %eax .section .rodata _179: .string "\011movl (%s),%s\n" .text lea _179,%eax pushl %eax call printf addl $12,%esp # return; # case POSTINC: jmp _120 # if (car(e2)==REGISTER) { _174: cmpl $17,%eax jne _181 _180: movl $-38,%eax movl -16(%ebp),%ecx pushl %ecx xchg %ecx,%eax call car addl $4,%esp subl %ecx,%eax jne _182 # printf("\tmovl %s,%s\n",register_name(cadr(e2)),crn); movl crn,%eax pushl %eax movl -16(%ebp),%eax pushl %eax call cadr addl $4,%esp pushl %eax call register_name addl $4,%esp pushl %eax .section .rodata _183: .string "\011movl %s,%s\n" .text lea _183,%eax pushl %eax call printf addl $12,%esp # printf("\taddl $%d,%s\n",caddr(e1),register_name(cadr(e2))); movl -16(%ebp),%eax pushl %eax call cadr addl $4,%esp pushl %eax call register_name addl $4,%esp pushl %eax movl 8(%ebp),%eax pushl %eax call caddr addl $4,%esp pushl %eax .section .rodata _184: .string "\011addl $%d,%s\n" .text lea _184,%eax pushl %eax call printf addl $12,%esp # return; # } jmp _120 # g_expr(e2); _182: movl -16(%ebp),%eax pushl %eax call g_expr addl $4,%esp # emit_push(); call emit_push # /* in case of register full we should copy crn to drn */ # xrn = emit_pop(0); movl $0,%eax pushl %eax call emit_pop addl $4,%esp movl %eax,-28(%ebp) # printf("\tmovl (%s),%s\n",xrn,crn); movl crn,%eax pushl %eax movl -28(%ebp),%eax pushl %eax .section .rodata _185: .string "\011movl (%s),%s\n" .text lea _185,%eax pushl %eax call printf addl $12,%esp # printf("\taddl $%d,(%s)\n",caddr(e1),xrn); movl -28(%ebp),%eax pushl %eax movl 8(%ebp),%eax pushl %eax call caddr addl $4,%esp pushl %eax .section .rodata _186: .string "\011addl $%d,(%s)\n" .text lea _186,%eax pushl %eax call printf addl $12,%esp # return; # case CPOSTINC: jmp _120 # /* char *p; *p++ */ # if (car(e2)==REGISTER) { _181: cmpl $19,%eax jne _188 _187: movl $-38,%eax movl -16(%ebp),%ecx pushl %ecx xchg %ecx,%eax call car addl $4,%esp subl %ecx,%eax jne _189 # printf("\tmovl %s,%s\n",register_name(cadr(e2)),crn); movl crn,%eax pushl %eax movl -16(%ebp),%eax pushl %eax call cadr addl $4,%esp pushl %eax call register_name addl $4,%esp pushl %eax .section .rodata _190: .string "\011movl %s,%s\n" .text lea _190,%eax pushl %eax call printf addl $12,%esp # printf("\taddl $%d,%s\n",caddr(e1),register_name(cadr(e2))); movl -16(%ebp),%eax pushl %eax call cadr addl $4,%esp pushl %eax call register_name addl $4,%esp pushl %eax movl 8(%ebp),%eax pushl %eax call caddr addl $4,%esp pushl %eax .section .rodata _191: .string "\011addl $%d,%s\n" .text lea _191,%eax pushl %eax call printf addl $12,%esp # return; # } jmp _120 # g_expr(e2); _189: movl -16(%ebp),%eax pushl %eax call g_expr addl $4,%esp # emit_push(); /* in case of register full we should copy crn to drn */ call emit_push # xrn = emit_pop(0); movl $0,%eax pushl %eax call emit_pop addl $4,%esp movl %eax,-28(%ebp) # printf("\tmovsbl (%s),%s\n",xrn,crn); movl crn,%eax pushl %eax movl -28(%ebp),%eax pushl %eax .section .rodata _192: .string "\011movsbl (%s),%s\n" .text lea _192,%eax pushl %eax call printf addl $12,%esp # printf("\tincl (%s)\n",xrn); movl -28(%ebp),%eax pushl %eax .section .rodata _193: .string "\011incl (%s)\n" .text lea _193,%eax pushl %eax call printf addl $8,%esp # return; # case CPREINC: jmp _120 # if (car(e2)==REGISTER) { _188: cmpl $20,%eax jne _195 _194: movl $-38,%eax movl -16(%ebp),%ecx pushl %ecx xchg %ecx,%eax call car addl $4,%esp subl %ecx,%eax jne _196 # printf("\taddl $%d,%s\n",caddr(e1),register_name(cadr(e2))); movl -16(%ebp),%eax pushl %eax call cadr addl $4,%esp pushl %eax call register_name addl $4,%esp pushl %eax movl 8(%ebp),%eax pushl %eax call caddr addl $4,%esp pushl %eax .section .rodata _197: .string "\011addl $%d,%s\n" .text lea _197,%eax pushl %eax call printf addl $12,%esp # printf("\tmovl %s,%s\n",register_name(cadr(e2)),crn); movl crn,%eax pushl %eax movl -16(%ebp),%eax pushl %eax call cadr addl $4,%esp pushl %eax call register_name addl $4,%esp pushl %eax .section .rodata _198: .string "\011movl %s,%s\n" .text lea _198,%eax pushl %eax call printf addl $12,%esp # return; # } jmp _120 # g_expr(e2); _196: movl -16(%ebp),%eax pushl %eax call g_expr addl $4,%esp # printf("\tincl (%s)\n",crn); movl crn,%eax pushl %eax .section .rodata _199: .string "\011incl (%s)\n" .text lea _199,%eax pushl %eax call printf addl $8,%esp # printf("\tmovsbl (%s),%s\n",crn,crn); movl crn,%eax pushl %eax movl crn,%eax pushl %eax .section .rodata _200: .string "\011movsbl (%s),%s\n" .text lea _200,%eax pushl %eax call printf addl $12,%esp # return; # case CPOSTDEC: jmp _120 # if (car(e2)==REGISTER) { _195: cmpl $22,%eax jne _202 _201: movl $-38,%eax movl -16(%ebp),%ecx pushl %ecx xchg %ecx,%eax call car addl $4,%esp subl %ecx,%eax jne _203 # printf("\tmovl %s,%s\n",register_name(cadr(e2)),crn); movl crn,%eax pushl %eax movl -16(%ebp),%eax pushl %eax call cadr addl $4,%esp pushl %eax call register_name addl $4,%esp pushl %eax .section .rodata _204: .string "\011movl %s,%s\n" .text lea _204,%eax pushl %eax call printf addl $12,%esp # printf("\tdecl %s\n",register_name(cadr(e2))); movl -16(%ebp),%eax pushl %eax call cadr addl $4,%esp pushl %eax call register_name addl $4,%esp pushl %eax .section .rodata _205: .string "\011decl %s\n" .text lea _205,%eax pushl %eax call printf addl $8,%esp # return; # } jmp _120 # g_expr(e2); _203: movl -16(%ebp),%eax pushl %eax call g_expr addl $4,%esp # printf("\tmovsbl (%s),%s\n",crn,crn); movl crn,%eax pushl %eax movl crn,%eax pushl %eax .section .rodata _206: .string "\011movsbl (%s),%s\n" .text lea _206,%eax pushl %eax call printf addl $12,%esp # printf("\tdecl (%s)\n",crn); movl crn,%eax pushl %eax .section .rodata _207: .string "\011decl (%s)\n" .text lea _207,%eax pushl %eax call printf addl $8,%esp # return; # case CPREDEC: jmp _120 # if (car(e2)==REGISTER) { _202: cmpl $23,%eax jne _209 _208: movl $-38,%eax movl -16(%ebp),%ecx pushl %ecx xchg %ecx,%eax call car addl $4,%esp subl %ecx,%eax jne _210 # printf("\tdecl %s\n",register_name(cadr(e2))); movl -16(%ebp),%eax pushl %eax call cadr addl $4,%esp pushl %eax call register_name addl $4,%esp pushl %eax .section .rodata _211: .string "\011decl %s\n" .text lea _211,%eax pushl %eax call printf addl $8,%esp # printf("\tmovl %s,%s\n",register_name(cadr(e2)),crn); movl crn,%eax pushl %eax movl -16(%ebp),%eax pushl %eax call cadr addl $4,%esp pushl %eax call register_name addl $4,%esp pushl %eax .section .rodata _212: .string "\011movl %s,%s\n" .text lea _212,%eax pushl %eax call printf addl $12,%esp # return; # } jmp _120 # g_expr(e2); _210: movl -16(%ebp),%eax pushl %eax call g_expr addl $4,%esp # emit_push(); call emit_push # xrn = emit_pop(0); movl $0,%eax pushl %eax call emit_pop addl $4,%esp movl %eax,-28(%ebp) # printf("\tdecl (%s)\n",xrn); movl -28(%ebp),%eax pushl %eax .section .rodata _213: .string "\011decl (%s)\n" .text lea _213,%eax pushl %eax call printf addl $8,%esp # printf("\tmovsbl (%s),%s\n",xrn,crn); movl crn,%eax pushl %eax movl -28(%ebp),%eax pushl %eax .section .rodata _214: .string "\011movsbl (%s),%s\n" .text lea _214,%eax pushl %eax call printf addl $12,%esp # return; # case MUL: case UMUL: jmp _120 # case DIV: case UDIV: # case MOD: case UMOD: # case LSHIFT: case ULSHIFT: case RSHIFT: case URSHIFT: # case ADD: case SUB: case BAND: case EOR: case BOR: # machinop(e1); _209: cmpl $48,%eax je _215 cmpl $47,%eax je _215 cmpl $46,%eax je _215 cmpl $31,%eax je _215 cmpl $30,%eax je _215 cmpl $33,%eax je _215 cmpl $32,%eax je _215 cmpl $35,%eax je _215 cmpl $34,%eax je _215 cmpl $29,%eax je _215 cmpl $28,%eax je _215 cmpl $27,%eax je _215 cmpl $26,%eax je _215 cmpl $25,%eax je _215 cmpl $24,%eax jne _216 _215: movl 8(%ebp),%eax pushl %eax call machinop addl $4,%esp # return; # case COND: jmp _120 # e2=fwdlabel(); _216: cmpl $51,%eax jne _218 _217: call fwdlabel movl %eax,-16(%ebp) # b_expr(cadr(e1),0,e2); movl -16(%ebp),%eax pushl %eax movl $0,%eax pushl %eax movl 8(%ebp),%eax pushl %eax call cadr addl $4,%esp pushl %eax call b_expr addl $12,%esp # g_expr(caddr(e1)); movl 8(%ebp),%eax pushl %eax call caddr addl $4,%esp pushl %eax call g_expr addl $4,%esp # e4 = rname[creg]; movl $4,%eax movl creg,%ecx imull %eax,%ecx movl $rname,%eax addl %ecx,%eax movl (%eax),%eax movl %eax,-24(%ebp) # jmp(e3=fwdlabel()); call fwdlabel movl %eax,-20(%ebp) pushl %eax call jmp addl $4,%esp # fwddef(e2); movl -16(%ebp),%eax pushl %eax call fwddef addl $4,%esp # g_expr(cadddr(e1)); movl 8(%ebp),%eax pushl %eax call cadddr addl $4,%esp pushl %eax call g_expr addl $4,%esp # use_register(creg,e4,1); movl $1,%eax pushl %eax movl -24(%ebp),%eax pushl %eax movl creg,%eax pushl %eax call use_register addl $12,%esp # fwddef(e3); movl -20(%ebp),%eax pushl %eax call fwddef addl $4,%esp # return; # case SASS: jmp _120 # sassign(e1); _218: cmpl $68,%eax jne _220 _219: movl 8(%ebp),%eax pushl %eax call sassign addl $4,%esp # return; # case ASS: case CASS: jmp _120 # assign(e1); _220: cmpl $53,%eax je _221 cmpl $52,%eax jne _222 _221: movl 8(%ebp),%eax pushl %eax call assign addl $4,%esp # return; # case ASSOP: case CASSOP: jmp _120 # assop(e1); _222: cmpl $55,%eax je _223 cmpl $54,%eax jne _224 _223: movl 8(%ebp),%eax pushl %eax call assop addl $4,%esp # return; # case COMMA: jmp _120 # g_expr(e2); _224: cmpl $56,%eax jne _226 _225: movl -16(%ebp),%eax pushl %eax call g_expr addl $4,%esp # g_expr(caddr(e1)); movl 8(%ebp),%eax pushl %eax call caddr addl $4,%esp pushl %eax call g_expr addl $4,%esp # return; # case RETURN: jmp _120 # n = (NMTBL *)e2; _226: cmpl $-12,%eax jne _228 _227: movl -16(%ebp),%eax movl %eax,-32(%ebp) # if (retcont==0) movl $0,%eax movl retcont,%ecx subl %eax,%ecx jne _229 # retcont=fwdlabel(); call fwdlabel movl %eax,retcont # printf("\tleal _%d,%s\n",retcont,crn); _229: movl crn,%eax pushl %eax movl retcont,%eax pushl %eax .section .rodata _230: .string "\011leal _%d,%s\n" .text lea _230,%eax pushl %eax call printf addl $12,%esp # return; # case ENVIRONMENT: jmp _120 # printf("\tmovl %%ebp,%s\n",crn); _228: cmpl $-40,%eax jne _232 _231: movl crn,%eax pushl %eax .section .rodata _233: .string "\011movl %%ebp,%s\n" .text lea _233,%eax pushl %eax call printf addl $8,%esp # return; # default: jmp _120 # b_expr(e1,1,e2=fwdlabel()); /* including > < ... */ _234: call fwdlabel movl %eax,-16(%ebp) pushl %eax movl $1,%eax pushl %eax movl 8(%ebp),%eax pushl %eax call b_expr addl $12,%esp # printf("\txorl %s,%s\n",crn,crn); movl crn,%eax pushl %eax movl crn,%eax pushl %eax .section .rodata _235: .string "\011xorl %s,%s\n" .text lea _235,%eax pushl %eax call printf addl $12,%esp # jmp(e3=fwdlabel()); call fwdlabel movl %eax,-20(%ebp) pushl %eax call jmp addl $4,%esp # fwddef(e2); movl -16(%ebp),%eax pushl %eax call fwddef addl $4,%esp # printf("\tmovl $1,%s\n",crn); movl crn,%eax pushl %eax .section .rodata _236: .string "\011movl $1,%s\n" .text lea _236,%eax pushl %eax call printf addl $8,%esp # fwddef(e3); movl -20(%ebp),%eax pushl %eax call fwddef addl $4,%esp # } # } jmp _237 _232: jmp _234 _237: _122: _120: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _238: .size g_expr,_238-g_expr # # void # bexpr(int e1, char cond, int l1) # bexpr # 504 # 504 # 504 # { .align 2 .globl bexpr bexpr: .type bexpr,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # gexpr_init(); call gexpr_init # b_expr(e1,cond,l1); movl 16(%ebp),%eax pushl %eax movsbl 12(%ebp),%eax pushl %eax movl 8(%ebp),%eax pushl %eax call b_expr addl $12,%esp # } _239: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _240: .size bexpr,_240-bexpr # # void # b_expr(int e1, char cond, int l1) # b_expr # 509 # 509 # 509 # { .align 2 .globl b_expr b_expr: .type b_expr,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # int e2,l2; # if (chk) return; subl $8,%esp cmpl $0,chk je _242 # e2=cadr(e1); jmp _241 _242: movl 8(%ebp),%eax pushl %eax call cadr addl $4,%esp movl %eax,-16(%ebp) # switch(car(e1)) { movl 8(%ebp),%eax pushl %eax call car addl $4,%esp # case LNOT: # b_expr(e2,!cond,l1); cmpl $14,%eax jne _245 _244: movl 16(%ebp),%eax pushl %eax movsbl 12(%ebp),%eax cmpl $0,%eax sete %al movzbl %al,%eax pushl %eax movl -16(%ebp),%eax pushl %eax call b_expr addl $12,%esp # return; # case GT: jmp _241 # rexpr(e1,l1,cond?"g":"le"); _245: cmpl $36,%eax jne _247 _246: cmpb $0,12(%ebp) je _248 .section .rodata _249: .string "g" .text lea _249,%eax jmp _250 _248: .section .rodata _251: .string "le" .text lea _251,%eax _250: pushl %eax movl 16(%ebp),%eax pushl %eax movl 8(%ebp),%eax pushl %eax call rexpr addl $12,%esp # return; # case UGT: jmp _241 # rexpr(e1,l1,cond?"a":"be"); _247: cmpl $37,%eax jne _253 _252: cmpb $0,12(%ebp) je _254 .section .rodata _255: .string "a" .text lea _255,%eax jmp _256 _254: .section .rodata _257: .string "be" .text lea _257,%eax _256: pushl %eax movl 16(%ebp),%eax pushl %eax movl 8(%ebp),%eax pushl %eax call rexpr addl $12,%esp # return; # case GE: jmp _241 # rexpr(e1,l1,cond?"ge":"l"); _253: cmpl $38,%eax jne _259 _258: cmpb $0,12(%ebp) je _260 .section .rodata _261: .string "ge" .text lea _261,%eax jmp _262 _260: .section .rodata _263: .string "l" .text lea _263,%eax _262: pushl %eax movl 16(%ebp),%eax pushl %eax movl 8(%ebp),%eax pushl %eax call rexpr addl $12,%esp # return; # case UGE: jmp _241 # rexpr(e1,l1,cond?"ae":"b"); _259: cmpl $39,%eax jne _265 _264: cmpb $0,12(%ebp) je _266 .section .rodata _267: .string "ae" .text lea _267,%eax jmp _268 _266: .section .rodata _269: .string "b" .text lea _269,%eax _268: pushl %eax movl 16(%ebp),%eax pushl %eax movl 8(%ebp),%eax pushl %eax call rexpr addl $12,%esp # return; # case LT: jmp _241 # rexpr(e1,l1,cond?"l":"ge"); _265: cmpl $40,%eax jne _271 _270: cmpb $0,12(%ebp) je _272 .section .rodata _273: .string "l" .text lea _273,%eax jmp _274 _272: .section .rodata _275: .string "ge" .text lea _275,%eax _274: pushl %eax movl 16(%ebp),%eax pushl %eax movl 8(%ebp),%eax pushl %eax call rexpr addl $12,%esp # return; # case ULT: jmp _241 # rexpr(e1,l1,cond?"b":"ae"); _271: cmpl $41,%eax jne _277 _276: cmpb $0,12(%ebp) je _278 .section .rodata _279: .string "b" .text lea _279,%eax jmp _280 _278: .section .rodata _281: .string "ae" .text lea _281,%eax _280: pushl %eax movl 16(%ebp),%eax pushl %eax movl 8(%ebp),%eax pushl %eax call rexpr addl $12,%esp # return; # case LE: jmp _241 # rexpr(e1,l1,cond?"le":"g"); _277: cmpl $42,%eax jne _283 _282: cmpb $0,12(%ebp) je _284 .section .rodata _285: .string "le" .text lea _285,%eax jmp _286 _284: .section .rodata _287: .string "g" .text lea _287,%eax _286: pushl %eax movl 16(%ebp),%eax pushl %eax movl 8(%ebp),%eax pushl %eax call rexpr addl $12,%esp # return; # case ULE: jmp _241 # rexpr(e1,l1,cond?"be":"a"); _283: cmpl $43,%eax jne _289 _288: cmpb $0,12(%ebp) je _290 .section .rodata _291: .string "be" .text lea _291,%eax jmp _292 _290: .section .rodata _293: .string "a" .text lea _293,%eax _292: pushl %eax movl 16(%ebp),%eax pushl %eax movl 8(%ebp),%eax pushl %eax call rexpr addl $12,%esp # return; # case EQ: jmp _241 # rexpr(e1,l1,cond?"e":"ne"); _289: cmpl $44,%eax jne _295 _294: cmpb $0,12(%ebp) je _296 .section .rodata _297: .string "e" .text lea _297,%eax jmp _298 _296: .section .rodata _299: .string "ne" .text lea _299,%eax _298: pushl %eax movl 16(%ebp),%eax pushl %eax movl 8(%ebp),%eax pushl %eax call rexpr addl $12,%esp # return; # case NEQ: jmp _241 # rexpr(e1,l1,cond?"ne":"e"); _295: cmpl $45,%eax jne _301 _300: cmpb $0,12(%ebp) je _302 .section .rodata _303: .string "ne" .text lea _303,%eax jmp _304 _302: .section .rodata _305: .string "e" .text lea _305,%eax _304: pushl %eax movl 16(%ebp),%eax pushl %eax movl 8(%ebp),%eax pushl %eax call rexpr addl $12,%esp # return; # case LAND: jmp _241 # b_expr(e2,0,cond?(l2=fwdlabel()):l1); _301: cmpl $49,%eax jne _307 _306: cmpb $0,12(%ebp) je _308 call fwdlabel movl %eax,-20(%ebp) jmp _309 _308: movl 16(%ebp),%eax _309: pushl %eax movl $0,%eax pushl %eax movl -16(%ebp),%eax pushl %eax call b_expr addl $12,%esp # b_expr(caddr(e1),cond,l1); movl 16(%ebp),%eax pushl %eax movsbl 12(%ebp),%eax pushl %eax movl 8(%ebp),%eax pushl %eax call caddr addl $4,%esp pushl %eax call b_expr addl $12,%esp # if(cond) fwddef(l2); cmpb $0,12(%ebp) je _310 movl -20(%ebp),%eax pushl %eax call fwddef addl $4,%esp # return; _310: # case LOR: jmp _241 # b_expr(e2,1,cond?l1:(l2=fwdlabel())); _307: cmpl $50,%eax jne _312 _311: cmpb $0,12(%ebp) je _313 movl 16(%ebp),%eax jmp _314 _313: call fwdlabel movl %eax,-20(%ebp) _314: pushl %eax movl $1,%eax pushl %eax movl -16(%ebp),%eax pushl %eax call b_expr addl $12,%esp # b_expr(caddr(e1),cond,l1); movl 16(%ebp),%eax pushl %eax movsbl 12(%ebp),%eax pushl %eax movl 8(%ebp),%eax pushl %eax call caddr addl $4,%esp pushl %eax call b_expr addl $12,%esp # if(!cond) fwddef(l2); cmpb $0,12(%ebp) jne _315 movl -20(%ebp),%eax pushl %eax call fwddef addl $4,%esp # return; _315: # case CRGVAR: jmp _241 # printf("\tcmpb $0,%s\n",caddr(e1)); _312: cmpl $3,%eax jne _317 _316: movl 8(%ebp),%eax pushl %eax call caddr addl $4,%esp pushl %eax .section .rodata _318: .string "\011cmpb $0,%s\n" .text lea _318,%eax pushl %eax call printf addl $8,%esp # jcond(l1,cond); movsbl 12(%ebp),%eax pushl %eax movl 16(%ebp),%eax pushl %eax call jcond addl $8,%esp # return; # case CRLVAR: jmp _241 # printf("\tcmpb $0,%d(%%ebp)\n",lvar(e2)); _317: cmpl $6,%eax jne _320 _319: movl -16(%ebp),%eax pushl %eax call lvar addl $4,%esp pushl %eax .section .rodata _321: .string "\011cmpb $0,%d(%%ebp)\n" .text lea _321,%eax pushl %eax call printf addl $8,%esp # jcond(l1,cond); movsbl 12(%ebp),%eax pushl %eax movl 16(%ebp),%eax pushl %eax call jcond addl $8,%esp # return; # case RGVAR: jmp _241 # printf("\tcmpl $0,%s\n",caddr(e1)); _320: cmpl $2,%eax jne _323 _322: movl 8(%ebp),%eax pushl %eax call caddr addl $4,%esp pushl %eax .section .rodata _324: .string "\011cmpl $0,%s\n" .text lea _324,%eax pushl %eax call printf addl $8,%esp # jcond(l1,cond); movsbl 12(%ebp),%eax pushl %eax movl 16(%ebp),%eax pushl %eax call jcond addl $8,%esp # return; # case RLVAR: jmp _241 # printf("\tcmpl $0,%d(%%ebp)\n",lvar(e2)); _323: cmpl $5,%eax jne _326 _325: movl -16(%ebp),%eax pushl %eax call lvar addl $4,%esp pushl %eax .section .rodata _327: .string "\011cmpl $0,%d(%%ebp)\n" .text lea _327,%eax pushl %eax call printf addl $8,%esp # jcond(l1,cond); movsbl 12(%ebp),%eax pushl %eax movl 16(%ebp),%eax pushl %eax call jcond addl $8,%esp # return; # case REGISTER: jmp _241 # printf("\tcmpl $0,%s\n",register_name(e2)); _326: cmpl $-38,%eax jne _329 _328: movl -16(%ebp),%eax pushl %eax call register_name addl $4,%esp pushl %eax .section .rodata _330: .string "\011cmpl $0,%s\n" .text lea _330,%eax pushl %eax call printf addl $8,%esp # jcond(l1,cond); movsbl 12(%ebp),%eax pushl %eax movl 16(%ebp),%eax pushl %eax call jcond addl $8,%esp # return; # case CONST: jmp _241 # if((cond&&e2)||(!cond&&!e2)) jmp(l1); _329: cmpl $7,%eax jne _332 _331: cmpb $0,12(%ebp) je _335 cmpl $0,-16(%ebp) jne _334 _335: cmpb $0,12(%ebp) jne _333 cmpl $0,-16(%ebp) jne _333 _334: movl 16(%ebp),%eax pushl %eax call jmp addl $4,%esp # return; _333: # default: jmp _241 # g_expr(e1); _336: movl 8(%ebp),%eax pushl %eax call g_expr addl $4,%esp # printf("\tcmpl $0,%s\n",crn); movl crn,%eax pushl %eax .section .rodata _337: .string "\011cmpl $0,%s\n" .text lea _337,%eax pushl %eax call printf addl $8,%esp # jcond(l1,cond); movsbl 12(%ebp),%eax pushl %eax movl 16(%ebp),%eax pushl %eax call jcond addl $8,%esp # return; # } jmp _241 # } _332: jmp _336 _243: _241: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _338: .size b_expr,_338-b_expr # # void # ascii(char *s) # ascii # 0 # { .align 2 .globl ascii ascii: .type ascii,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # printf("\t.string \""); .section .rodata _340: .string "\011.string \"" .text lea _340,%eax pushl %eax call printf addl $4,%esp # while(*s) { _342: movl 8(%ebp),%eax movsbl (%eax),%eax cmpl $0,%eax je _341 # if (*s=='\n') movl $10,%eax movl 8(%ebp),%ecx movsbl (%ecx),%ecx subl %eax,%ecx jne _343 # printf("%cn",92); movl $92,%ecx pushl %ecx .section .rodata _344: .string "%cn" .text lea _344,%ecx pushl %ecx call printf addl $8,%esp # else if (*s<' ') jmp _345 _343: movl $32,%eax movl 8(%ebp),%ecx movsbl (%ecx),%ecx subl %eax,%ecx jge _346 # printf("%c%03o",92,*s); movl 8(%ebp),%ecx movsbl (%ecx),%ecx pushl %ecx movl $92,%ecx pushl %ecx .section .rodata _347: .string "%c%03o" .text lea _347,%ecx pushl %ecx call printf addl $12,%esp # else if (*s==34) jmp _348 _346: movl $34,%eax movl 8(%ebp),%ecx movsbl (%ecx),%ecx subl %eax,%ecx jne _349 # printf("%c%c",92,34); movl $34,%ecx pushl %ecx movl $92,%ecx pushl %ecx .section .rodata _350: .string "%c%c" .text lea _350,%ecx pushl %ecx call printf addl $12,%esp # else jmp _351 _349: # printf("%c",*s); movl 8(%ebp),%eax movsbl (%eax),%eax pushl %eax .section .rodata _352: .string "%c" .text lea _352,%eax pushl %eax call printf addl $8,%esp # s++; _351: _348: _345: lea 8(%ebp),%eax movl (%eax),%ecx addl $1,(%eax) # } # printf("%c\n",34); jmp _342 _341: movl $34,%ecx pushl %ecx .section .rodata _353: .string "%c\n" .text lea _353,%ecx pushl %ecx call printf addl $8,%esp # } _339: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _354: .size ascii,_354-ascii # # void # string(int e1) # string # 514 # { .align 2 .globl string string: .type string,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # char *s; # int i,lb; # # if (0) { subl $12,%esp jmp _356 # s=(char *)cadr(e1); movl 8(%ebp),%eax pushl %eax call cadr addl $4,%esp movl %eax,-16(%ebp) # lb=fwdlabel(); call fwdlabel movl %eax,-24(%ebp) # printf("\tjmp _%d\n",lb); movl -24(%ebp),%eax pushl %eax .section .rodata _357: .string "\011jmp _%d\n" .text lea _357,%eax pushl %eax call printf addl $8,%esp # i=backdef(); call backdef movl %eax,-20(%ebp) # ascii(s); movl -16(%ebp),%eax pushl %eax call ascii addl $4,%esp # printf("\t.align 2\n"); .section .rodata _358: .string "\011.align 2\n" .text lea _358,%eax pushl %eax call printf addl $4,%esp # fwddef(lb); movl -24(%ebp),%eax pushl %eax call fwddef addl $4,%esp # printf("\tlea _%d,%s\n",i,crn); movl crn,%eax pushl %eax movl -20(%ebp),%eax pushl %eax .section .rodata _359: .string "\011lea _%d,%s\n" .text lea _359,%eax pushl %eax call printf addl $12,%esp # } else { _356: # s=(char *)cadr(e1); movl 8(%ebp),%eax pushl %eax call cadr addl $4,%esp movl %eax,-16(%ebp) # printf(".section\t.rodata\n"); .section .rodata _360: .string ".section\011.rodata\n" .text lea _360,%eax pushl %eax call printf addl $4,%esp # lb=fwdlabel(); call fwdlabel movl %eax,-24(%ebp) # printf("_%d:\n",lb); movl -24(%ebp),%eax pushl %eax .section .rodata _361: .string "_%d:\n" .text lea _361,%eax pushl %eax call printf addl $8,%esp # ascii(s); movl -16(%ebp),%eax pushl %eax call ascii addl $4,%esp # if (output_mode==TEXT_EMIT_MODE) { movl $0,%eax movl output_mode,%ecx subl %eax,%ecx jne _362 # printf(".text\n"); .section .rodata _363: .string ".text\n" .text lea _363,%ecx pushl %ecx call printf addl $4,%esp # } else { jmp _364 _362: # text_mode(); call text_mode # } # printf("\tlea _%d,%s\n",lb,crn); _364: movl crn,%eax pushl %eax movl -24(%ebp),%eax pushl %eax .section .rodata _365: .string "\011lea _%d,%s\n" .text lea _365,%eax pushl %eax call printf addl $12,%esp # } # } _355: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _366: .size string,_366-string # # void # function(int e1) # function # 519 # { .align 2 .globl function function: .type function,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # int e2,e3,e4,e5,nargs; # NMTBL *n; # # e2 = cadr(e1); subl $24,%esp movl 8(%ebp),%eax pushl %eax call cadr addl $4,%esp movl %eax,-16(%ebp) # nargs = 0; movl $0,%eax movl %eax,-32(%ebp) # for (e3 = caddr(e1); e3; e3 = cadr(e3)) { movl 8(%ebp),%eax pushl %eax call caddr addl $4,%esp movl %eax,-20(%ebp) _369: cmpl $0,-20(%ebp) je _368 # n=(NMTBL *)(e5=(cadr(e4 = car(e3)))); movl -20(%ebp),%eax pushl %eax call car addl $4,%esp movl %eax,-24(%ebp) pushl %eax call cadr addl $4,%esp movl %eax,-28(%ebp) movl %eax,-36(%ebp) # switch(car(e4)) { movl -24(%ebp),%eax pushl %eax call car addl $4,%esp # case FNAME: # printf("\tlea %s,%s\n",n->nm,crn); cmpl $8,%eax jne _373 _372: movl crn,%eax pushl %eax movl -36(%ebp),%eax movl (%eax),%eax pushl %eax .section .rodata _374: .string "\011lea %s,%s\n" .text lea _374,%eax pushl %eax call printf addl $12,%esp # printf("\tpushl %s\n",crn); movl crn,%eax pushl %eax .section .rodata _375: .string "\011pushl %s\n" .text lea _375,%eax pushl %eax call printf addl $8,%esp # break; jmp _371 # case ADDRESS: # g_expr(e5); _373: cmpl $12,%eax jne _377 _376: movl -28(%ebp),%eax pushl %eax call g_expr addl $4,%esp # printf("\tpushl %s\n",crn); movl crn,%eax pushl %eax .section .rodata _378: .string "\011pushl %s\n" .text lea _378,%eax pushl %eax call printf addl $8,%esp # break; jmp _371 # default:g_expr(e4); _379: movl -24(%ebp),%eax pushl %eax call g_expr addl $4,%esp # printf("\tpushl %s\n",crn); movl crn,%eax pushl %eax .section .rodata _380: .string "\011pushl %s\n" .text lea _380,%eax pushl %eax call printf addl $8,%esp # } # ++nargs; jmp _381 _377: jmp _379 _381: _371: lea -32(%ebp),%eax addl $1,(%eax) movl (%eax),%eax # } # if (car(e2) == FNAME) { _370: movl -20(%ebp),%eax pushl %eax call cadr addl $4,%esp movl %eax,-20(%ebp) jmp _369 _368: movl $8,%eax movl -16(%ebp),%ecx pushl %ecx xchg %ecx,%eax call car addl $4,%esp subl %ecx,%eax jne _382 # n=(NMTBL *)cadr(e2); movl -16(%ebp),%eax pushl %eax call cadr addl $4,%esp movl %eax,-36(%ebp) # use_register(creg,REG_EAX,0); movl $0,%eax pushl %eax movl $0,%eax pushl %eax movl creg,%eax pushl %eax call use_register addl $12,%esp # printf("\tcall\t%s\n",n->nm); movl -36(%ebp),%eax movl (%eax),%eax pushl %eax .section .rodata _383: .string "\011call\011%s\n" .text lea _383,%eax pushl %eax call printf addl $8,%esp # } else { jmp _384 _382: # g_expr(e2); movl -16(%ebp),%eax pushl %eax call g_expr addl $4,%esp # use_register(creg,REG_EAX,0); movl $0,%eax pushl %eax movl $0,%eax pushl %eax movl creg,%eax pushl %eax call use_register addl $12,%esp # printf("\tcall\t*%s\n",crn); movl crn,%eax pushl %eax .section .rodata _385: .string "\011call\011*%s\n" .text lea _385,%eax pushl %eax call printf addl $8,%esp # } # if (nargs) printf("\taddl $%d,%%esp\n",4*nargs); _384: cmpl $0,-32(%ebp) je _386 movl $4,%eax movl -32(%ebp),%ecx imull %eax,%ecx pushl %ecx .section .rodata _387: .string "\011addl $%d,%%esp\n" .text lea _387,%ecx pushl %ecx call printf addl $8,%esp # } _386: _367: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _388: .size function,_388-function # # void # jump(int e1, int env) # jump # 696 # 696 # { .align 2 .globl jump jump: .type jump,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # int i,e2,e3,e4,e5,nargs,regs; # NMTBL *n,*code0; # int new_disp; # char *xrn; # # /* count number of args */ # nargs = 0; subl $44,%esp movl $0,%eax movl %eax,-36(%ebp) # for (e3 = caddr(e1); e3;e3 =cadr(e3)) nargs++; movl 8(%ebp),%eax pushl %eax call caddr addl $4,%esp movl %eax,-24(%ebp) _391: cmpl $0,-24(%ebp) je _390 lea -36(%ebp),%eax movl (%eax),%ecx addl $1,(%eax) # new_disp = -(nargs-MAX_REGISTER_VAR)*int_size; _392: movl -24(%ebp),%ecx pushl %ecx call cadr addl $4,%esp movl %eax,-24(%ebp) jmp _391 _390: movl int_size,%eax movl MAX_REGISTER_VAR,%ecx movl -36(%ebp),%edx subl %ecx,%edx negl %edx imull %eax,%edx movl %edx,-52(%ebp) # if (new_disp > 0) movl $0,%edx movl -52(%ebp),%ecx subl %edx,%ecx jle _393 # new_disp=0; movl $0,%ecx movl %ecx,-52(%ebp) # /* printf("# new_disp %d,disp %d\n",new_disp,disp); */ # if (new_disp < disp) { _393: movl disp,%ecx movl -52(%ebp),%eax subl %ecx,%eax jge _394 # printf("\tlea %d(%%ebp),%%esp\n",new_disp+disp_offset); movl -52(%ebp),%eax movl disp_offset,%ecx addl %eax,%ecx pushl %ecx .section .rodata _395: .string "\011lea %d(%%ebp),%%esp\n" .text lea _395,%ecx pushl %ecx call printf addl $8,%esp # } # /* compute jump address */ # e2 = cadr(e1); _394: movl 8(%ebp),%eax pushl %eax call cadr addl $4,%esp movl %eax,-20(%ebp) # if (car(e2) == FNAME) { movl $8,%eax movl -20(%ebp),%ecx pushl %ecx xchg %ecx,%eax call car addl $4,%esp subl %ecx,%eax jne _396 # code0=(NMTBL *)cadr(e2); movl -20(%ebp),%eax pushl %eax call cadr addl $4,%esp movl %eax,-48(%ebp) # if (code0->sc!=CODE) { movl $-39,%eax movl $4,%ecx movl -48(%ebp),%edx addl %ecx,%edx movl (%edx),%edx subl %eax,%edx je _397 # error(STERR); return; movl $3,%edx pushl %edx call error addl $4,%esp # } jmp _389 # } else { /* indirect */ _397: jmp _398 _396: # g_expr(e2); movl -20(%ebp),%eax pushl %eax call g_expr addl $4,%esp # emit_push(); call emit_push # } # /* compute arguments */ # regs = nargs-1; _398: movl $1,%eax movl -36(%ebp),%ecx subl %eax,%ecx movl %ecx,-40(%ebp) # i=0; movl $0,%ecx movl %ecx,-16(%ebp) # for (e3 = caddr(e1); e3;e3 =cadr(e3),i++) { movl 8(%ebp),%ecx pushl %ecx call caddr addl $4,%esp movl %eax,-24(%ebp) _400: cmpl $0,-24(%ebp) je _399 # n=(NMTBL *)(e5=(cadr(e4 = car(e3)))); movl -24(%ebp),%eax pushl %eax call car addl $4,%esp movl %eax,-28(%ebp) pushl %eax call cadr addl $4,%esp movl %eax,-32(%ebp) movl %eax,-44(%ebp) # switch(car(e4)) { movl -28(%ebp),%eax pushl %eax call car addl $4,%esp # case FNAME: # printf("\tlea %s,%s\n",n->nm,crn); cmpl $8,%eax jne _404 _403: movl crn,%eax pushl %eax movl -44(%ebp),%eax movl (%eax),%eax pushl %eax .section .rodata _405: .string "\011lea %s,%s\n" .text lea _405,%eax pushl %eax call printf addl $12,%esp # emit_push(); call emit_push # break; jmp _402 # case ADDRESS: # g_expr(e5); _404: cmpl $12,%eax jne _407 _406: movl -32(%ebp),%eax pushl %eax call g_expr addl $4,%esp # emit_push(); call emit_push # break; jmp _402 # /* # printf("# cadr(e4) %d ==disp_offset+(-1-i)*int_size %d\n", cadr(e4), disp_offset+(-2-i)*int_size); # */ # case RLVAR: # case CRLVAR: # if (env==0 && cadr(e4)==disp_offset+(-1-i)*int_size) { _407: cmpl $6,%eax je _408 cmpl $5,%eax jne _409 _408: movl $0,%eax movl 12(%ebp),%edx subl %eax,%edx jne _410 movl disp_offset,%edx movl int_size,%eax movl -16(%ebp),%ecx pushl %ecx movl $-1,%ecx popl %ebx subl %ebx,%ecx imull %eax,%ecx addl %edx,%ecx movl -28(%ebp),%eax pushl %eax call cadr addl $4,%esp subl %ecx,%eax jne _410 # /* Same positioned local variable. No need to copy */ # reg_stack[reg_sp++] = -2; movl $-2,%eax movl $4,%edx movl $reg_sp,%ecx pushl %ecx popl %ebx movl (%ebx),%ecx addl $1,(%ebx) imull %edx,%ecx movl $reg_stack,%edx addl %ecx,%edx movl %eax,(%edx) movl %eax,%edx # --regs; lea -40(%ebp),%edx addl $-1,(%edx) movl (%edx),%edx # continue; jmp _401 # } # case REGISTER: _410: # if (rname[cadr(e4)]==REG_ESI+regs) { jmp _411 _409: cmpl $-38,%eax jne _412 _411: movl $4,%eax movl -40(%ebp),%edx addl %eax,%edx movl $4,%eax movl -28(%ebp),%ecx pushl %ecx xchg %ecx,%eax call cadr addl $4,%esp imull %ecx,%eax movl $rname,%ecx addl %eax,%ecx movl (%ecx),%ecx subl %edx,%ecx jne _413 # /* Same register variable. No need to copy */ # reg_stack[reg_sp++] = cadr(e4); movl -28(%ebp),%ecx pushl %ecx call cadr addl $4,%esp movl $4,%edx movl $reg_sp,%ecx pushl %ecx popl %ebx movl (%ebx),%ecx addl $1,(%ebx) imull %edx,%ecx movl $reg_stack,%edx addl %ecx,%edx movl %eax,(%edx) movl %eax,%edx # --regs; lea -40(%ebp),%edx addl $-1,(%edx) movl (%edx),%edx # continue; jmp _401 # } # default: _413: # g_expr(e4); _414: movl -28(%ebp),%edx pushl %edx call g_expr addl $4,%esp # emit_push(); call emit_push # } # --regs; jmp _415 _412: jmp _414 _415: _402: lea -40(%ebp),%eax addl $-1,(%eax) movl (%eax),%eax # } # /* save frame pointer before jump in fuction */ # if (fnptr->sc==FUNCTION) { _401: movl -24(%ebp),%eax pushl %eax call cadr addl $4,%esp movl %eax,-24(%ebp) lea -16(%ebp),%eax movl (%eax),%edx addl $1,(%eax) jmp _400 _399: movl $-8,%edx movl $4,%eax movl fnptr,%ecx addl %eax,%ecx movl (%ecx),%ecx subl %edx,%ecx jne _416 # printf("\tmovl %%ebp,%d(%%ebp)\n",disp_offset); movl disp_offset,%ecx pushl %ecx .section .rodata _417: .string "\011movl %%ebp,%d(%%ebp)\n" .text lea _417,%ecx pushl %ecx call printf addl $8,%esp # } # if (env) { _416: cmpl $0,12(%ebp) je _418 # /* change frame pointer */ # g_expr(env); movl 12(%ebp),%eax pushl %eax call g_expr addl $4,%esp # printf("\tmovl %s,%%ebp\n",crn); movl crn,%eax pushl %eax .section .rodata _419: .string "\011movl %s,%%ebp\n" .text lea _419,%eax pushl %eax call printf addl $8,%esp # } # /* copy arguments to destination environment if necessary */ # for(i=0;i<nargs;i++) { _418: movl $0,%eax movl %eax,-16(%ebp) _421: movl -36(%ebp),%eax movl -16(%ebp),%ecx subl %eax,%ecx jge _420 # if (i>=MAX_REGISTGER_VAR) { movl MAX_REGISTGER_VAR,%ecx movl -16(%ebp),%edx subl %ecx,%edx jl _423 # if (reg_stack[reg_sp-1]== -2) { movl $-2,%edx movl $4,%ecx movl $1,%eax pushl %eax movl reg_sp,%eax popl %ebx subl %ebx,%eax imull %ecx,%eax movl $reg_stack,%ecx addl %eax,%ecx movl (%ecx),%ecx subl %edx,%ecx jne _424 # /* same positioned variable */ # reg_sp--; movl $reg_sp,%ecx movl (%ecx),%edx addl $-1,(%ecx) # } else { jmp _425 _424: # xrn=emit_pop(0); movl $0,%edx pushl %edx call emit_pop addl $4,%esp movl %eax,-56(%ebp) # printf("\tmovl %s,%d(%%ebp)\n",xrn, # disp_offset+(-(nargs-i))*int_size); movl disp_offset,%eax movl int_size,%ecx movl -16(%ebp),%edx pushl %edx movl -36(%ebp),%edx popl %ebx subl %ebx,%edx negl %edx imull %ecx,%edx addl %eax,%edx pushl %edx movl -56(%ebp),%edx pushl %edx .section .rodata _426: .string "\011movl %s,%d(%%ebp)\n" .text lea _426,%edx pushl %edx call printf addl $12,%esp # } # } else if (reg_stack[--reg_sp]>=REG_ESI) { _425: jmp _427 _423: movl $4,%eax movl $4,%ecx movl $reg_sp,%edx addl $-1,(%edx) movl (%edx),%edx imull %ecx,%edx movl $reg_stack,%ecx addl %edx,%ecx movl (%ecx),%ecx subl %eax,%ecx jl _428 # /* the same registger */ # ; # } else { jmp _429 _428: # if(reg_stack[reg_sp]<0) { movl $0,%ecx movl $4,%edx movl reg_sp,%eax imull %edx,%eax movl $reg_stack,%edx addl %eax,%edx movl (%edx),%edx subl %ecx,%edx jge _430 # printf("\tpopl %s\n",reg_name[rname[REG_ESI+i]]); movl $4,%edx movl $4,%ecx movl $4,%eax pushl %eax movl -16(%ebp),%eax popl %ebx addl %ebx,%eax imull %ecx,%eax movl $rname,%ecx addl %eax,%ecx movl (%ecx),%ecx imull %edx,%ecx movl $reg_name,%edx addl %ecx,%edx movl (%edx),%edx pushl %edx .section .rodata _431: .string "\011popl %s\n" .text lea _431,%edx pushl %edx call printf addl $8,%esp # } else { jmp _432 _430: # printf("\tmovl %s,%s\n", # reg_name[rname[reg_stack[reg_sp]]], # reg_name[rname[REG_ESI+i]]); movl $4,%eax movl $4,%ecx movl $4,%edx pushl %edx movl -16(%ebp),%edx popl %ebx addl %ebx,%edx imull %ecx,%edx movl $rname,%ecx addl %edx,%ecx movl (%ecx),%ecx imull %eax,%ecx movl $reg_name,%eax addl %ecx,%eax movl (%eax),%eax pushl %eax movl $4,%eax movl $4,%ecx movl $4,%edx pushl %edx movl reg_sp,%edx popl %ebx imull %ebx,%edx pushl %edx movl $reg_stack,%edx popl %ebx addl %ebx,%edx movl (%edx),%edx imull %ecx,%edx movl $rname,%ecx addl %edx,%ecx movl (%ecx),%ecx imull %eax,%ecx movl $reg_name,%eax addl %ecx,%eax movl (%eax),%eax pushl %eax .section .rodata _433: .string "\011movl %s,%s\n" .text lea _433,%eax pushl %eax call printf addl $12,%esp # free_register(reg_stack[reg_sp]); movl $4,%eax movl reg_sp,%ecx imull %eax,%ecx movl $reg_stack,%eax addl %ecx,%eax movl (%eax),%eax pushl %eax call free_register addl $4,%esp # } # } _432: # } _429: _427: # if (car(e2) != FNAME) { _422: lea -16(%ebp),%eax movl (%eax),%ecx addl $1,(%eax) jmp _421 _420: movl $8,%ecx movl -20(%ebp),%eax pushl %eax call car addl $4,%esp subl %ecx,%eax je _434 # xrn=emit_pop(0); movl $0,%eax pushl %eax call emit_pop addl $4,%esp movl %eax,-56(%ebp) # } # /* printf("# new_disp %d,disp %d\n",new_disp,disp); */ # if (new_disp>disp) { _434: movl disp,%eax movl -52(%ebp),%ecx subl %eax,%ecx jle _435 # /* shrink stack if necessary */ # printf("\tlea %d(%%ebp),%%esp\n",new_disp+disp_offset); movl -52(%ebp),%ecx movl disp_offset,%eax addl %ecx,%eax pushl %eax .section .rodata _436: .string "\011lea %d(%%ebp),%%esp\n" .text lea _436,%eax pushl %eax call printf addl $8,%esp # } # if (fnptr->sc==FUNCTION) { _435: movl $-8,%eax movl $4,%ecx movl fnptr,%edx addl %ecx,%edx movl (%edx),%edx subl %eax,%edx jne _437 # /* link operation for leave, %ebp must point saved old %ebp */ # printf("\tlea %d(%%ebp),%%ebp\n",disp_offset); movl disp_offset,%edx pushl %edx .section .rodata _438: .string "\011lea %d(%%ebp),%%ebp\n" .text lea _438,%edx pushl %edx call printf addl $8,%esp # } # if (car(e2) == FNAME) { _437: movl $8,%eax movl -20(%ebp),%ecx pushl %ecx xchg %ecx,%eax call car addl $4,%esp subl %ecx,%eax jne _439 # printf("\tjmp %s\n",code0->nm); movl -48(%ebp),%eax movl (%eax),%eax pushl %eax .section .rodata _440: .string "\011jmp %s\n" .text lea _440,%eax pushl %eax call printf addl $8,%esp # } else { jmp _441 _439: # printf("\tjmp *%s\n",xrn); movl -56(%ebp),%eax pushl %eax .section .rodata _442: .string "\011jmp *%s\n" .text lea _442,%eax pushl %eax call printf addl $8,%esp # } # } _441: _389: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _443: .size jump,_443-jump # # # void # machinop(int e1) # machinop # 524 # { .align 2 .globl machinop machinop: .type machinop,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # int e2,e3,op; # # e2 = cadr(e1); subl $12,%esp movl 8(%ebp),%eax pushl %eax call cadr addl $4,%esp movl %eax,-16(%ebp) # op = car(e1); movl 8(%ebp),%eax pushl %eax call car addl $4,%esp movl %eax,-24(%ebp) # e3 = caddr(e1); movl 8(%ebp),%eax pushl %eax call caddr addl $4,%esp movl %eax,-20(%ebp) # g_expr(e3); movl -20(%ebp),%eax pushl %eax call g_expr addl $4,%esp # emit_push(); call emit_push # g_expr(e2); movl -16(%ebp),%eax pushl %eax call g_expr addl $4,%esp # tosop(car(e1)); movl 8(%ebp),%eax pushl %eax call car addl $4,%esp pushl %eax call tosop addl $4,%esp # return; # } _444: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _445: .size machinop,_445-machinop # # # void # rindirect(int e1) /* *(p +5 ) */ # rindirect # 529 # # { .align 2 .globl rindirect rindirect: .type rindirect,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # char *op; # int e2,e3,byte; # # op = ((byte = (car(e1) == CRINDIRECT)) ? "movsbl" : "movl"); subl $16,%esp movl $11,%eax movl 8(%ebp),%ecx pushl %ecx xchg %ecx,%eax call car addl $4,%esp subl %ecx,%eax je _448 xorl %eax,%eax jmp _449 _448: movl $1,%eax _449: movl %eax,-28(%ebp) cmpl $0,%eax je _447 .section .rodata _450: .string "movsbl" .text lea _450,%eax jmp _451 _447: .section .rodata _452: .string "movl" .text lea _452,%eax _451: movl %eax,-16(%ebp) # e3 = cadr(e2 = cadr(e1)); movl 8(%ebp),%eax pushl %eax call cadr addl $4,%esp movl %eax,-20(%ebp) pushl %eax call cadr addl $4,%esp movl %eax,-24(%ebp) # g_expr(e2); movl -20(%ebp),%eax pushl %eax call g_expr addl $4,%esp # printf("\t%s (%s),%s\n",op,crn,crn); movl crn,%eax pushl %eax movl crn,%eax pushl %eax movl -16(%ebp),%eax pushl %eax .section .rodata _453: .string "\011%s (%s),%s\n" .text lea _453,%eax pushl %eax call printf addl $16,%esp # } _446: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _454: .size rindirect,_454-rindirect # # void # sassign(int e1) # sassign # 539 # { .align 2 .globl sassign sassign: .type sassign,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # int e2,e3,e4,sz; # char *xrn; # # e2 = cadr(e1); subl $20,%esp movl 8(%ebp),%eax pushl %eax call cadr addl $4,%esp movl %eax,-16(%ebp) # e3 = cadr(e2); movl -16(%ebp),%eax pushl %eax call cadr addl $4,%esp movl %eax,-20(%ebp) # e4 = caddr(e1); movl 8(%ebp),%eax pushl %eax call caddr addl $4,%esp movl %eax,-24(%ebp) # sz = size(cadr(e2)); /* cld rep movsb */ movl -16(%ebp),%eax pushl %eax call cadr addl $4,%esp pushl %eax call size addl $4,%esp movl %eax,-28(%ebp) # g_expr(e4); movl -24(%ebp),%eax pushl %eax call g_expr addl $4,%esp # emit_push(); call emit_push # g_expr(e2); movl -16(%ebp),%eax pushl %eax call g_expr addl $4,%esp # xrn = emit_pop(0); movl $0,%eax pushl %eax call emit_pop addl $4,%esp movl %eax,-32(%ebp) # return; # } _455: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _456: .size sassign,_456-sassign # # void # assign(int e1) # assign # 534 # { .align 2 .globl assign assign: .type assign,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # char *op; # int e2,e3,e4,byte; # char *xrn; # # op = ((byte=(car(e1) == CASS))? "movb" : "movl"); subl $24,%esp movl $53,%eax movl 8(%ebp),%ecx pushl %ecx xchg %ecx,%eax call car addl $4,%esp subl %ecx,%eax je _459 xorl %eax,%eax jmp _460 _459: movl $1,%eax _460: movl %eax,-32(%ebp) cmpl $0,%eax je _458 .section .rodata _461: .string "movb" .text lea _461,%eax jmp _462 _458: .section .rodata _463: .string "movl" .text lea _463,%eax _462: movl %eax,-16(%ebp) # /* e2=e4 */ # e2 = cadr(e1); movl 8(%ebp),%eax pushl %eax call cadr addl $4,%esp movl %eax,-20(%ebp) # e3 = cadr(e2); movl -20(%ebp),%eax pushl %eax call cadr addl $4,%esp movl %eax,-24(%ebp) # e4 = caddr(e1); movl 8(%ebp),%eax pushl %eax call caddr addl $4,%esp movl %eax,-28(%ebp) # switch(car(e2)) { movl -20(%ebp),%eax pushl %eax call car addl $4,%esp # case GVAR: /* i=3 */ # g_expr(e4); cmpl $1,%eax jne _466 _465: movl -28(%ebp),%eax pushl %eax call g_expr addl $4,%esp # if (byte) use_data_reg(creg,1); cmpl $0,-32(%ebp) je _467 movl $1,%eax pushl %eax movl creg,%eax pushl %eax call use_data_reg addl $8,%esp # printf("\t%s %s,%s\n",op,crn,caddr(e2)); _467: movl -20(%ebp),%eax pushl %eax call caddr addl $4,%esp pushl %eax movl crn,%eax pushl %eax movl -16(%ebp),%eax pushl %eax .section .rodata _468: .string "\011%s %s,%s\n" .text lea _468,%eax pushl %eax call printf addl $16,%esp # return; # case LVAR: jmp _457 # g_expr(e4); _466: cmpl $4,%eax jne _470 _469: movl -28(%ebp),%eax pushl %eax call g_expr addl $4,%esp # if (byte) use_data_reg(creg,1); cmpl $0,-32(%ebp) je _471 movl $1,%eax pushl %eax movl creg,%eax pushl %eax call use_data_reg addl $8,%esp # printf("\t%s %s,%d(%%ebp)\n",op,crn,lvar(cadr(e2))); _471: movl -20(%ebp),%eax pushl %eax call cadr addl $4,%esp pushl %eax call lvar addl $4,%esp pushl %eax movl crn,%eax pushl %eax movl -16(%ebp),%eax pushl %eax .section .rodata _472: .string "\011%s %s,%d(%%ebp)\n" .text lea _472,%eax pushl %eax call printf addl $16,%esp # return; # case REGISTER: jmp _457 # g_expr(e4); _470: cmpl $-38,%eax jne _474 _473: movl -28(%ebp),%eax pushl %eax call g_expr addl $4,%esp # if (creg!=cadr(e2)) movl -20(%ebp),%eax pushl %eax call cadr addl $4,%esp movl creg,%ecx subl %eax,%ecx je _475 # printf("\t%s %s,%s\n",op,crn,register_name(cadr(e2))); movl -20(%ebp),%ecx pushl %ecx call cadr addl $4,%esp pushl %eax call register_name addl $4,%esp pushl %eax movl crn,%eax pushl %eax movl -16(%ebp),%eax pushl %eax .section .rodata _476: .string "\011%s %s,%s\n" .text lea _476,%eax pushl %eax call printf addl $16,%esp # return; _475: # } jmp _457 # g_expr(e4); _474: _464: movl -28(%ebp),%eax pushl %eax call g_expr addl $4,%esp # emit_push(); call emit_push # g_expr(e2); movl -20(%ebp),%eax pushl %eax call g_expr addl $4,%esp # xrn = emit_pop(0); movl $0,%eax pushl %eax call emit_pop addl $4,%esp movl %eax,-36(%ebp) # if (byte) use_data_reg(creg,1); cmpl $0,-32(%ebp) je _477 movl $1,%eax pushl %eax movl creg,%eax pushl %eax call use_data_reg addl $8,%esp # printf("\t%s %s,(%s)\n",op,xrn,crn); _477: movl crn,%eax pushl %eax movl -36(%ebp),%eax pushl %eax movl -16(%ebp),%eax pushl %eax .section .rodata _478: .string "\011%s %s,(%s)\n" .text lea _478,%eax pushl %eax call printf addl $16,%esp # printf("\tmovl %s,%s\n",xrn,crn); movl crn,%eax pushl %eax movl -36(%ebp),%eax pushl %eax .section .rodata _479: .string "\011movl %s,%s\n" .text lea _479,%eax pushl %eax call printf addl $12,%esp # return; # } _457: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _480: .size assign,_480-assign # # void # assop(int e1) # assop # 544 # { .align 2 .globl assop assop: .type assop,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # int e2,e3,byte,op,new_reg; # char *xrn; # # /* e2 op= e3 */ # byte = (car(e1) == CASSOP); subl $24,%esp movl $55,%eax movl 8(%ebp),%ecx pushl %ecx xchg %ecx,%eax call car addl $4,%esp subl %ecx,%eax je _482 xorl %eax,%eax jmp _483 _482: movl $1,%eax _483: movl %eax,-24(%ebp) # e2 = cadr(e1); movl 8(%ebp),%eax pushl %eax call cadr addl $4,%esp movl %eax,-16(%ebp) # if (car(e2)==INDIRECT) e2=cadr(e2); movl $9,%eax movl -16(%ebp),%ecx pushl %ecx xchg %ecx,%eax call car addl $4,%esp subl %ecx,%eax jne _484 movl -16(%ebp),%eax pushl %eax call cadr addl $4,%esp movl %eax,-16(%ebp) # e3 = caddr(e1); _484: movl 8(%ebp),%eax pushl %eax call caddr addl $4,%esp movl %eax,-20(%ebp) # op = cadddr(e1); movl 8(%ebp),%eax pushl %eax call cadddr addl $4,%esp movl %eax,-28(%ebp) # # g_expr(e3); movl -20(%ebp),%eax pushl %eax call g_expr addl $4,%esp # emit_push(); call emit_push # if (car(e2)==REGISTER) { movl $-38,%eax movl -16(%ebp),%ecx pushl %ecx xchg %ecx,%eax call car addl $4,%esp subl %ecx,%eax jne _485 # new_reg=creg; movl creg,%eax movl %eax,-32(%ebp) # set_crn(cadr(e2)); movl -16(%ebp),%eax pushl %eax call cadr addl $4,%esp pushl %eax call set_crn addl $4,%esp # tosop(op); movl -28(%ebp),%eax pushl %eax call tosop addl $4,%esp # set_crn(new_reg); movl -32(%ebp),%eax pushl %eax call set_crn addl $4,%esp # printf("\tmovl %s,%s\n",register_name(cadr(e2)),crn); movl crn,%eax pushl %eax movl -16(%ebp),%eax pushl %eax call cadr addl $4,%esp pushl %eax call register_name addl $4,%esp pushl %eax .section .rodata _486: .string "\011movl %s,%s\n" .text lea _486,%eax pushl %eax call printf addl $12,%esp # return; # } jmp _481 # g_expr(e2); _485: movl -16(%ebp),%eax pushl %eax call g_expr addl $4,%esp # xrn = emit_pop(0); /* pop e3 value */ movl $0,%eax pushl %eax call emit_pop addl $4,%esp movl %eax,-36(%ebp) # printf("\tpushl %s # assop \n",crn); /* push e2 address */ movl crn,%eax pushl %eax .section .rodata _487: .string "\011pushl %s # assop \n" .text lea _487,%eax pushl %eax call printf addl $8,%esp # ld_indexx(byte,0,crn); movl crn,%eax pushl %eax movl $0,%eax pushl %eax movl -24(%ebp),%eax pushl %eax call ld_indexx addl $12,%esp # new_reg = get_register(); call get_register movl %eax,-32(%ebp) # /* push e3 value */ # if(new_reg<0) { /* もうレジスタがない */ movl $0,%eax movl -32(%ebp),%ecx subl %eax,%ecx jge _488 # reg_stack[reg_sp++] = -1; movl $-1,%ecx movl $4,%eax movl $reg_sp,%edx pushl %edx popl %ebx movl (%ebx),%edx addl $1,(%ebx) imull %eax,%edx movl $reg_stack,%eax addl %edx,%eax movl %ecx,(%eax) movl %ecx,%eax # printf("\tpushl %s\n",xrn); movl -36(%ebp),%eax pushl %eax .section .rodata _489: .string "\011pushl %s\n" .text lea _489,%eax pushl %eax call printf addl $8,%esp # } else { jmp _490 _488: # reg_stack[reg_sp++] = xreg; /* push するかわりにレジスタを使う */ movl xreg,%eax movl $4,%ecx movl $reg_sp,%edx pushl %edx popl %ebx movl (%ebx),%edx addl $1,(%ebx) imull %ecx,%edx movl $reg_stack,%ecx addl %edx,%ecx movl %eax,(%ecx) movl %eax,%ecx # } # tosop(op); _490: movl -28(%ebp),%ecx pushl %ecx call tosop addl $4,%esp # if(new_reg>=0) free_register(new_reg); movl $0,%eax movl -32(%ebp),%ecx subl %eax,%ecx jl _491 movl -32(%ebp),%ecx pushl %ecx call free_register addl $4,%esp # printf("\tpopl %s # assop \n",drn); _491: movl drn,%eax pushl %eax .section .rodata _492: .string "\011popl %s # assop \n" .text lea _492,%eax pushl %eax call printf addl $8,%esp # printf("\t%s %s,(%s)\n",byte ? "movb" : "movl",crn,drn); movl drn,%eax pushl %eax movl crn,%eax pushl %eax cmpl $0,-24(%ebp) je _493 .section .rodata _494: .string "movb" .text lea _494,%eax jmp _495 _493: .section .rodata _496: .string "movl" .text lea _496,%eax _495: pushl %eax .section .rodata _497: .string "\011%s %s,(%s)\n" .text lea _497,%eax pushl %eax call printf addl $16,%esp # return; # # } _481: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _498: .size assop,_498-assop # # # void # tosop(int op) # tosop # 549 # { .align 2 .globl tosop tosop: .type tosop,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # int oreg; # char *orn; # # oreg = pop_register(); subl $8,%esp call pop_register movl %eax,-16(%ebp) # switch(op) { movl 8(%ebp),%eax # case LSHIFT: # case ULSHIFT: # shift("sall",oreg); cmpl $35,%eax je _501 cmpl $34,%eax jne _502 _501: movl -16(%ebp),%eax pushl %eax .section .rodata _503: .string "sall" .text lea _503,%eax pushl %eax call shift addl $8,%esp # return; # case RSHIFT: jmp _499 # shift("sarl",oreg); _502: cmpl $32,%eax jne _505 _504: movl -16(%ebp),%eax pushl %eax .section .rodata _506: .string "sarl" .text lea _506,%eax pushl %eax call shift addl $8,%esp # return; # case URSHIFT: jmp _499 # shift("shrl",oreg); _505: cmpl $33,%eax jne _508 _507: movl -16(%ebp),%eax pushl %eax .section .rodata _509: .string "shrl" .text lea _509,%eax pushl %eax call shift addl $8,%esp # return; # } jmp _499 # if(oreg==-1) { _508: _500: movl $-1,%eax movl -16(%ebp),%ecx subl %eax,%ecx jne _510 # printf("\tpopl %s\n",drn); movl drn,%ecx pushl %ecx .section .rodata _511: .string "\011popl %s\n" .text lea _511,%ecx pushl %ecx call printf addl $8,%esp # oreg = dreg; movl dreg,%eax movl %eax,-16(%ebp) # } # orn = reg_name[rname[oreg]]; _510: movl $4,%eax movl $4,%ecx movl -16(%ebp),%edx imull %ecx,%edx movl $rname,%ecx addl %edx,%ecx movl (%ecx),%ecx imull %eax,%ecx movl $reg_name,%eax addl %ecx,%eax movl (%eax),%eax movl %eax,-20(%ebp) # switch(op) { movl 8(%ebp),%eax # case ADD: # printf("\taddl %s,%s\n",orn,crn); cmpl $30,%eax jne _514 _513: movl crn,%eax pushl %eax movl -20(%ebp),%eax pushl %eax .section .rodata _515: .string "\011addl %s,%s\n" .text lea _515,%eax pushl %eax call printf addl $12,%esp # return; # case SUB: jmp _499 # printf("\tsubl %s,%s\n",orn,crn); _514: cmpl $31,%eax jne _517 _516: movl crn,%eax pushl %eax movl -20(%ebp),%eax pushl %eax .section .rodata _518: .string "\011subl %s,%s\n" .text lea _518,%eax pushl %eax call printf addl $12,%esp # return; # case BAND: jmp _499 # printf("\tandl %s,%s\n",orn,crn); _517: cmpl $46,%eax jne _520 _519: movl crn,%eax pushl %eax movl -20(%ebp),%eax pushl %eax .section .rodata _521: .string "\011andl %s,%s\n" .text lea _521,%eax pushl %eax call printf addl $12,%esp # return; # case EOR: jmp _499 # printf("\txorl %s,%s\n",orn,crn); _520: cmpl $47,%eax jne _523 _522: movl crn,%eax pushl %eax movl -20(%ebp),%eax pushl %eax .section .rodata _524: .string "\011xorl %s,%s\n" .text lea _524,%eax pushl %eax call printf addl $12,%esp # return; # case BOR: jmp _499 # printf("\torl %s,%s\n",orn,crn); _523: cmpl $48,%eax jne _526 _525: movl crn,%eax pushl %eax movl -20(%ebp),%eax pushl %eax .section .rodata _527: .string "\011orl %s,%s\n" .text lea _527,%eax pushl %eax call printf addl $12,%esp # return; # case MUL: jmp _499 # case UMUL: # /* use_register(dreg,REG_EDX,0); */ # printf("\t%s %s,%s\n","imull",orn,crn); _526: cmpl $25,%eax je _528 cmpl $24,%eax jne _529 _528: movl crn,%eax pushl %eax movl -20(%ebp),%eax pushl %eax .section .rodata _530: .string "imull" .text lea _530,%eax pushl %eax .section .rodata _531: .string "\011%s %s,%s\n" .text lea _531,%eax pushl %eax call printf addl $16,%esp # return; # case DIV: jmp _499 # case UDIV: # orn = div_setup(oreg); _529: cmpl $27,%eax je _532 cmpl $26,%eax jne _533 _532: movl -16(%ebp),%eax pushl %eax call div_setup addl $4,%esp movl %eax,-20(%ebp) # if (op==DIV) movl $26,%eax movl 8(%ebp),%ecx subl %eax,%ecx jne _534 # printf("\tcltd\n\tdivl %s\n",orn); movl -20(%ebp),%ecx pushl %ecx .section .rodata _535: .string "\011cltd\n\011divl %s\n" .text lea _535,%ecx pushl %ecx call printf addl $8,%esp # else jmp _536 _534: # printf("\txor %%edx,%%edx\n\tidivl %s\n",orn); movl -20(%ebp),%eax pushl %eax .section .rodata _537: .string "\011xor %%edx,%%edx\n\011idivl %s\n" .text lea _537,%eax pushl %eax call printf addl $8,%esp # div_cleanup(orn); _536: movl -20(%ebp),%eax pushl %eax call div_cleanup addl $4,%esp # return; # case MOD: jmp _499 # case UMOD: # orn = div_setup(oreg); _533: cmpl $29,%eax je _538 cmpl $28,%eax jne _539 _538: movl -16(%ebp),%eax pushl %eax call div_setup addl $4,%esp movl %eax,-20(%ebp) # if (op==DIV) movl $26,%eax movl 8(%ebp),%ecx subl %eax,%ecx jne _540 # printf("\tcltd\n\tdivl %s\n",orn); movl -20(%ebp),%ecx pushl %ecx .section .rodata _541: .string "\011cltd\n\011divl %s\n" .text lea _541,%ecx pushl %ecx call printf addl $8,%esp # else jmp _542 _540: # printf("\txor %%edx,%%edx\n\tidivl %s\n",orn); movl -20(%ebp),%eax pushl %eax .section .rodata _543: .string "\011xor %%edx,%%edx\n\011idivl %s\n" .text lea _543,%eax pushl %eax call printf addl $8,%esp # rname[creg]=REG_EDX; _542: movl $3,%eax movl $4,%ecx movl creg,%edx imull %ecx,%edx movl $rname,%ecx addl %edx,%ecx movl %eax,(%ecx) movl %eax,%ecx # crn=reg_name[REG_EDX]; movl $12,%ecx movl $reg_name,%eax addl %ecx,%eax movl (%eax),%eax movl %eax,crn # rname[dreg]=REG_EAX; movl $0,%eax movl $4,%ecx movl dreg,%edx imull %ecx,%edx movl $rname,%ecx addl %edx,%ecx movl %eax,(%ecx) movl %eax,%ecx # drn=reg_name[REG_EAX]; movl $0,%ecx movl $reg_name,%eax addl %ecx,%eax movl (%eax),%eax movl %eax,drn # div_cleanup(orn); movl -20(%ebp),%eax pushl %eax call div_cleanup addl $4,%esp # return; # } jmp _499 # } _539: _512: _499: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _544: .size tosop,_544-tosop # # static char *dvi_push = "(%esp)"; .globl dvi_push .data .type dvi_push,@object dvi_push: .long _545 .section .rodata _545: .string "(%esp)" .data _546: .size dvi_push,_546-dvi_push # # char * # div_setup(int oreg) # div_setup # 556 # { .text .align 2 .align 2 .globl div_setup div_setup: .type div_setup,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # if (oreg<0) { movl $0,%eax movl 8(%ebp),%ecx subl %eax,%ecx jge _548 # use_register(creg,REG_EAX,1); movl $1,%ecx pushl %ecx movl $0,%ecx pushl %ecx movl creg,%ecx pushl %ecx call use_register addl $12,%esp # use_register(dreg,REG_EDX,0); movl $0,%eax pushl %eax movl $3,%eax pushl %eax movl dreg,%eax pushl %eax call use_register addl $12,%esp # return 0; movl $0,%eax # } jmp _547 # if (register_full()) { _548: call register_full cmpl $0,%eax je _549 # printf("\tpushl %s\n",reg_name[rname[oreg]]); movl $4,%eax movl $4,%ecx movl 8(%ebp),%edx imull %ecx,%edx movl $rname,%ecx addl %edx,%ecx movl (%ecx),%ecx imull %eax,%ecx movl $reg_name,%eax addl %ecx,%eax movl (%eax),%eax pushl %eax .section .rodata _550: .string "\011pushl %s\n" .text lea _550,%eax pushl %eax call printf addl $8,%esp # use_register(creg,REG_EAX,1); movl $1,%eax pushl %eax movl $0,%eax pushl %eax movl creg,%eax pushl %eax call use_register addl $12,%esp # use_register(oreg,REG_EDX,0); movl $0,%eax pushl %eax movl $3,%eax pushl %eax movl 8(%ebp),%eax pushl %eax call use_register addl $12,%esp # return dvi_push; movl dvi_push,%eax # } jmp _547 # regs[oreg]=1; _549: movl $1,%eax movl $4,%ecx movl 8(%ebp),%edx imull %ecx,%edx movl $regs,%ecx addl %edx,%ecx movl %eax,(%ecx) movl %eax,%ecx # use_register(creg,REG_EAX,1); movl $1,%ecx pushl %ecx movl $0,%ecx pushl %ecx movl creg,%ecx pushl %ecx call use_register addl $12,%esp # use_register(dreg,REG_EDX,0); movl $0,%eax pushl %eax movl $3,%eax pushl %eax movl dreg,%eax pushl %eax call use_register addl $12,%esp # regs[oreg]=0; movl $0,%eax movl $4,%ecx movl 8(%ebp),%edx imull %ecx,%edx movl $regs,%ecx addl %edx,%ecx movl %eax,(%ecx) movl %eax,%ecx # return reg_name[rname[oreg]]; movl $4,%ecx movl $4,%eax movl 8(%ebp),%edx imull %eax,%edx movl $rname,%eax addl %edx,%eax movl (%eax),%eax imull %ecx,%eax movl $reg_name,%ecx addl %eax,%ecx movl (%ecx),%ecx # } movl %ecx,%eax _547: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _551: .size div_setup,_551-div_setup # # div_cleanup(char *orn) # div_cleanup # 9994 # { .align 2 .globl div_cleanup div_cleanup: .type div_cleanup,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # if (orn==dvi_push) movl dvi_push,%eax movl 8(%ebp),%ecx subl %eax,%ecx jne _553 # printf("\taddl $4,%%esp\n"); .section .rodata _554: .string "\011addl $4,%%esp\n" .text lea _554,%ecx pushl %ecx call printf addl $4,%esp # } _553: _552: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _555: .size div_cleanup,_555-div_cleanup # # void # shift(char *op, int reg) # shift # 561 # 561 # { .align 2 .globl shift shift: .type shift,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # if (reg>=0) { movl $0,%eax movl 12(%ebp),%ecx subl %eax,%ecx jl _557 # use_register(lreg,REG_ECX,1); movl $1,%ecx pushl %ecx movl $2,%ecx pushl %ecx movl lreg,%ecx pushl %ecx call use_register addl $12,%esp # } else { jmp _558 _557: # use_register(dreg,REG_ECX,0); movl $0,%eax pushl %eax movl $2,%eax pushl %eax movl dreg,%eax pushl %eax call use_register addl $12,%esp # printf("\tpopl %%ecx\n"); .section .rodata _559: .string "\011popl %%ecx\n" .text lea _559,%eax pushl %eax call printf addl $4,%esp # } # printf("\t%s %%cl,%s\n",op,crn); _558: movl crn,%eax pushl %eax movl 8(%ebp),%eax pushl %eax .section .rodata _560: .string "\011%s %%cl,%s\n" .text lea _560,%eax pushl %eax call printf addl $12,%esp # } _556: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _561: .size shift,_561-shift # # void # ld_indexx(int byte, int n, char *xrn) # ld_indexx # 566 # 566 # 566 # { .align 2 .globl ld_indexx ld_indexx: .type ld_indexx,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # char *op; # # op = byte ? "movsbl" : "movl"; subl $4,%esp cmpl $0,8(%ebp) je _563 .section .rodata _564: .string "movsbl" .text lea _564,%eax jmp _565 _563: .section .rodata _566: .string "movl" .text lea _566,%eax _565: movl %eax,-16(%ebp) # if (n) cmpl $0,12(%ebp) je _567 # printf("\t%s %d(%s),%s\n",op,n,xrn,crn); movl crn,%eax pushl %eax movl 16(%ebp),%eax pushl %eax movl 12(%ebp),%eax pushl %eax movl -16(%ebp),%eax pushl %eax .section .rodata _568: .string "\011%s %d(%s),%s\n" .text lea _568,%eax pushl %eax call printf addl $20,%esp # else jmp _569 _567: # printf("\t%s (%s),%s\n",op,xrn,crn); movl crn,%eax pushl %eax movl 16(%ebp),%eax pushl %eax movl -16(%ebp),%eax pushl %eax .section .rodata _570: .string "\011%s (%s),%s\n" .text lea _570,%eax pushl %eax call printf addl $16,%esp # } _569: _562: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _571: .size ld_indexx,_571-ld_indexx # # void # st_indexx(int byte, int n, char *xrn) # st_indexx # 571 # 571 # 571 # { .align 2 .globl st_indexx st_indexx: .type st_indexx,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # char *op; # # op = byte ? "movb" : "movl"; subl $4,%esp cmpl $0,8(%ebp) je _573 .section .rodata _574: .string "movb" .text lea _574,%eax jmp _575 _573: .section .rodata _576: .string "movl" .text lea _576,%eax _575: movl %eax,-16(%ebp) # if (n) cmpl $0,12(%ebp) je _577 # printf("\t%s %s,%d(%s)\n",op,crn,n,xrn); movl 16(%ebp),%eax pushl %eax movl 12(%ebp),%eax pushl %eax movl crn,%eax pushl %eax movl -16(%ebp),%eax pushl %eax .section .rodata _578: .string "\011%s %s,%d(%s)\n" .text lea _578,%eax pushl %eax call printf addl $20,%esp # else jmp _579 _577: # printf("\t%s %s,(%s)\n",op,crn,xrn); movl 16(%ebp),%eax pushl %eax movl crn,%eax pushl %eax movl -16(%ebp),%eax pushl %eax .section .rodata _580: .string "\011%s %s,(%s)\n" .text lea _580,%eax pushl %eax call printf addl $16,%esp # } _579: _572: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _581: .size st_indexx,_581-st_indexx # # void # indexy(char *op, char *gvar) # indexy # 576 # 576 # { .align 2 .globl indexy indexy: .type indexy,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # printf("\t%s %s,%s\n",op,crn,gvar); movl 12(%ebp),%eax pushl %eax movl crn,%eax pushl %eax movl 8(%ebp),%eax pushl %eax .section .rodata _583: .string "\011%s %s,%s\n" .text lea _583,%eax pushl %eax call printf addl $16,%esp # } _582: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _584: .size indexy,_584-indexy # # void # cmpdimm(int e, int csreg) # cmpdimm # 581 # 581 # { .align 2 .globl cmpdimm cmpdimm: .type cmpdimm,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # /* used in dosiwtch() */ # use_register(creg,csreg,0); movl $0,%eax pushl %eax movl 12(%ebp),%eax pushl %eax movl creg,%eax pushl %eax call use_register addl $12,%esp # printf("\tcmpl $%d,%s\n",e,crn); movl crn,%eax pushl %eax movl 8(%ebp),%eax pushl %eax .section .rodata _586: .string "\011cmpl $%d,%s\n" .text lea _586,%eax pushl %eax call printf addl $12,%esp # } _585: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _587: .size cmpdimm,_587-cmpdimm # # void # opening(char *filename) # opening # 596 # { .align 2 .globl opening opening: .type opening,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # printf("\t.file \"%s\"\n",filename); movl 8(%ebp),%eax pushl %eax .section .rodata _589: .string "\011.file \"%s\"\n" .text lea _589,%eax pushl %eax call printf addl $8,%esp # printf("\t.version\t\"01.01\"\n"); .section .rodata _590: .string "\011.version\011\"01.01\"\n" .text lea _590,%eax pushl %eax call printf addl $4,%esp # printf("gcc2_compiled.:\n"); .section .rodata _591: .string "gcc2_compiled.:\n" .text lea _591,%eax pushl %eax call printf addl $4,%esp # printf(".text\n"); .section .rodata _592: .string ".text\n" .text lea _592,%eax pushl %eax call printf addl $4,%esp # emit_init(); call emit_init # } _588: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _593: .size opening,_593-opening # # void # closing(void) # closing # 601 # { .align 2 .globl closing closing: .type closing,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # global_table(); call global_table # printf("\t.ident \"Micro-C compiled\"\n"); .section .rodata _595: .string "\011.ident \"Micro-C compiled\"\n" .text lea _595,%eax pushl %eax call printf addl $4,%esp # } _594: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _596: .size closing,_596-closing # # void # jmp_label(int l) # jmp_label # 611 # { .align 2 .globl jmp_label jmp_label: .type jmp_label,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # printf("\tjmp\t_%d\n",l); movl 8(%ebp),%eax pushl %eax .section .rodata _598: .string "\011jmp\011_%d\n" .text lea _598,%eax pushl %eax call printf addl $8,%esp # } _597: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _599: .size jmp_label,_599-jmp_label # # void # jmp_eq_label(int l) # jmp_eq_label # 616 # { .align 2 .globl jmp_eq_label jmp_eq_label: .type jmp_eq_label,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # printf("\tje\t_%d\n",l); movl 8(%ebp),%eax pushl %eax .section .rodata _601: .string "\011je\011_%d\n" .text lea _601,%eax pushl %eax call printf addl $8,%esp # } _600: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _602: .size jmp_eq_label,_602-jmp_eq_label # # void # rexpr(int e1, int l1, char *s) # rexpr # 621 # 621 # 621 # { .align 2 .globl rexpr rexpr: .type rexpr,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # g_expr(list3(SUB,cadr(e1),caddr(e1))); movl 8(%ebp),%eax pushl %eax call caddr addl $4,%esp pushl %eax movl 8(%ebp),%eax pushl %eax call cadr addl $4,%esp pushl %eax movl $31,%eax pushl %eax call list3 addl $12,%esp pushl %eax call g_expr addl $4,%esp # printf("\tj%s\t_%d\n",s,l1); movl 12(%ebp),%eax pushl %eax movl 16(%ebp),%eax pushl %eax .section .rodata _604: .string "\011j%s\011_%d\n" .text lea _604,%eax pushl %eax call printf addl $12,%esp # } _603: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _605: .size rexpr,_605-rexpr # # void # jcond(int l, char cond) # jcond # 626 # 626 # { .align 2 .globl jcond jcond: .type jcond,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # printf("\tj%s\t_%d\n",cond?"ne":"e",l); movl 8(%ebp),%eax pushl %eax cmpb $0,12(%ebp) je _607 .section .rodata _608: .string "ne" .text lea _608,%eax jmp _609 _607: .section .rodata _610: .string "e" .text lea _610,%eax _609: pushl %eax .section .rodata _611: .string "\011j%s\011_%d\n" .text lea _611,%eax pushl %eax call printf addl $12,%esp # } _606: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _612: .size jcond,_612-jcond # # void # jmp(int l) # jmp # 631 # { .align 2 .globl jmp jmp: .type jmp,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # control=0; movl $0,%eax movl %eax,control # printf("\tjmp\t_%d\n",l); movl 8(%ebp),%eax pushl %eax .section .rodata _614: .string "\011jmp\011_%d\n" .text lea _614,%eax pushl %eax call printf addl $8,%esp # /* align? */ # } _613: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _615: .size jmp,_615-jmp # # int # fwdlabel(void) # fwdlabel # 721 # { .align 2 .globl fwdlabel fwdlabel: .type fwdlabel,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # return labelno++; movl $labelno,%eax movl (%eax),%ecx addl $1,(%eax) # } movl %ecx,%eax _616: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _617: .size fwdlabel,_617-fwdlabel # # void # fwddef(int l) # fwddef # 726 # { .align 2 .globl fwddef fwddef: .type fwddef,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # control=1; movl $1,%eax movl %eax,control # printf("_%d:\n",l); movl 8(%ebp),%eax pushl %eax .section .rodata _619: .string "_%d:\n" .text lea _619,%eax pushl %eax call printf addl $8,%esp # } _618: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _620: .size fwddef,_620-fwddef # # int # backdef(void) # backdef # 736 # { .align 2 .globl backdef backdef: .type backdef,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # control=1; movl $1,%eax movl %eax,control # printf("_%d:\n",labelno); movl labelno,%eax pushl %eax .section .rodata _622: .string "_%d:\n" .text lea _622,%eax pushl %eax call printf addl $8,%esp # return labelno++; movl $labelno,%eax movl (%eax),%ecx addl $1,(%eax) # } movl %ecx,%eax _621: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _623: .size backdef,_623-backdef # # void # def_label(int cslabel, int dlabel) # def_label # 636 # 636 # { .align 2 .globl def_label def_label: .type def_label,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # int fl; # # fl = 0; subl $4,%esp movl $0,%eax movl %eax,-16(%ebp) # if (control) { cmpl $0,control je _625 # jmp(fl=fwdlabel()); call fwdlabel movl %eax,-16(%ebp) pushl %eax call jmp addl $4,%esp # } # fwddef(cslabel); _625: movl 8(%ebp),%eax pushl %eax call fwddef addl $4,%esp # if (dlabel) cmpl $0,12(%ebp) je _626 # jmp(dlabel); movl 12(%ebp),%eax pushl %eax call jmp addl $4,%esp # if (fl) { _626: cmpl $0,-16(%ebp) je _627 # fwddef(fl); movl -16(%ebp),%eax pushl %eax call fwddef addl $4,%esp # } # } _627: _624: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _628: .size def_label,_628-def_label # # void # gen_comment(char *s) # gen_comment # 641 # { .align 2 .globl gen_comment gen_comment: .type gen_comment,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # printf("# %s",s); movl 8(%ebp),%eax pushl %eax .section .rodata _630: .string "# %s" .text lea _630,%eax pushl %eax call printf addl $8,%esp # } _629: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _631: .size gen_comment,_631-gen_comment # # void # gen_source(char *s) # gen_source # 646 # { .align 2 .globl gen_source gen_source: .type gen_source,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # printf("%s",s); movl 8(%ebp),%eax pushl %eax .section .rodata _633: .string "%s" .text lea _633,%eax pushl %eax call printf addl $8,%esp # } _632: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _634: .size gen_source,_634-gen_source # # void # code_enter(char *name) # code_enter # 651 # { .align 2 .globl code_enter code_enter: .type code_enter,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # disp_offset = code_disp_offset; movl code_disp_offset,%eax movl %eax,disp_offset # emit_init(); call emit_init # printf("\t.align 4\n"); .section .rodata _636: .string "\011.align 4\n" .text lea _636,%eax pushl %eax call printf addl $4,%esp # if (stmode!=STATIC) movl $-10,%eax movl stmode,%ecx subl %eax,%ecx je _637 # printf(".globl %s\n",name); movl 8(%ebp),%ecx pushl %ecx .section .rodata _638: .string ".globl %s\n" .text lea _638,%ecx pushl %ecx call printf addl $8,%esp # printf("\t.type\t%s,@function\n",name); _637: movl 8(%ebp),%eax pushl %eax .section .rodata _639: .string "\011.type\011%s,@function\n" .text lea _639,%eax pushl %eax call printf addl $8,%esp # printf("%s:\n",name); movl 8(%ebp),%eax pushl %eax .section .rodata _640: .string "%s:\n" .text lea _640,%eax pushl %eax call printf addl $8,%esp # } _635: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _641: .size code_enter,_641-code_enter # # void # code_enter1(int disp) # code_enter1 # 0 # { .align 2 .globl code_enter1 code_enter1: .type code_enter1,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # if(disp) { cmpl $0,8(%ebp) je _643 # printf("\tsubl $%d,%%esp\n",-disp); movl 8(%ebp),%eax negl %eax pushl %eax .section .rodata _644: .string "\011subl $%d,%%esp\n" .text lea _644,%eax pushl %eax call printf addl $8,%esp # } # } _643: _642: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _645: .size code_enter1,_645-code_enter1 # # void # code_leave(char *name) # code_leave # 656 # { .align 2 .globl code_leave code_leave: .type code_leave,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # local_table(); call local_table # printf("_%d:\n",labelno); movl labelno,%eax pushl %eax .section .rodata _647: .string "_%d:\n" .text lea _647,%eax pushl %eax call printf addl $8,%esp # printf("\t.size\t%s,_%d-%s\n",name,labelno,name); movl 8(%ebp),%eax pushl %eax movl labelno,%eax pushl %eax movl 8(%ebp),%eax pushl %eax .section .rodata _648: .string "\011.size\011%s,_%d-%s\n" .text lea _648,%eax pushl %eax call printf addl $16,%esp # labelno++; movl $labelno,%eax movl (%eax),%ecx addl $1,(%eax) # } movl %ecx,%eax _646: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _649: .size code_leave,_649-code_leave # # void # enter(char *name) # enter # 661 # { .align 2 .globl enter enter: .type enter,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # disp_offset = func_disp_offset; movl func_disp_offset,%eax movl %eax,disp_offset # emit_init(); call emit_init # printf("\t.align 2\n"); .section .rodata _651: .string "\011.align 2\n" .text lea _651,%eax pushl %eax call printf addl $4,%esp # if (stmode!=STATIC) movl $-10,%eax movl stmode,%ecx subl %eax,%ecx je _652 # printf(".globl %s\n",name); movl 8(%ebp),%ecx pushl %ecx .section .rodata _653: .string ".globl %s\n" .text lea _653,%ecx pushl %ecx call printf addl $8,%esp # printf("%s:\n",name); _652: movl 8(%ebp),%eax pushl %eax .section .rodata _654: .string "%s:\n" .text lea _654,%eax pushl %eax call printf addl $8,%esp # printf("\t.type\t%s,@function\n",name); movl 8(%ebp),%eax pushl %eax .section .rodata _655: .string "\011.type\011%s,@function\n" .text lea _655,%eax pushl %eax call printf addl $8,%esp # printf("\tpushl %%ebp\n"); .section .rodata _656: .string "\011pushl %%ebp\n" .text lea _656,%eax pushl %eax call printf addl $4,%esp # printf("\tmovl %%esp,%%ebp\n"); .section .rodata _657: .string "\011movl %%esp,%%ebp\n" .text lea _657,%eax pushl %eax call printf addl $4,%esp # printf("\tpushl %%ebx\n"); .section .rodata _658: .string "\011pushl %%ebx\n" .text lea _658,%eax pushl %eax call printf addl $4,%esp # printf("\tpushl %%ecx\n"); .section .rodata _659: .string "\011pushl %%ecx\n" .text lea _659,%eax pushl %eax call printf addl $4,%esp # printf("\tpushl %%edx\n"); .section .rodata _660: .string "\011pushl %%edx\n" .text lea _660,%eax pushl %eax call printf addl $4,%esp # if (REGISTERS6) { jmp _661 # printf("\tpushl %%edi\n"); .section .rodata _662: .string "\011pushl %%edi\n" .text lea _662,%eax pushl %eax call printf addl $4,%esp # printf("\tpushl %%esi\n"); .section .rodata _663: .string "\011pushl %%esi\n" .text lea _663,%eax pushl %eax call printf addl $4,%esp # } # } _661: _650: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _664: .size enter,_664-enter # # void # enter1(int disp) # enter1 # 666 # { .align 2 .globl enter1 enter1: .type enter1,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # if(disp) printf("\tsubl $%d,%%esp\n",-disp); cmpl $0,8(%ebp) je _666 movl 8(%ebp),%eax negl %eax pushl %eax .section .rodata _667: .string "\011subl $%d,%%esp\n" .text lea _667,%eax pushl %eax call printf addl $8,%esp # } _666: _665: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _668: .size enter1,_668-enter1 # # void # leave(int control, char *name) # leave # 0 # 0 # { .align 2 .globl leave leave: .type leave,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # if (control) cmpl $0,8(%ebp) je _670 # use_register(creg,REG_EAX,1); movl $1,%eax pushl %eax movl $0,%eax pushl %eax movl creg,%eax pushl %eax call use_register addl $12,%esp # if (retcont) { _670: cmpl $0,retcont je _671 # if (control) cmpl $0,8(%ebp) je _672 # jmp(retlabel); movl retlabel,%eax pushl %eax call jmp addl $4,%esp # fwddef(retcont); _672: movl retcont,%eax pushl %eax call fwddef addl $4,%esp # use_register(creg,REG_EAX,0); movl $0,%eax pushl %eax movl $0,%eax pushl %eax movl creg,%eax pushl %eax call use_register addl $12,%esp # printf("\tmovl %s,%s\n",reg_name[REG_ESI],crn); movl crn,%eax pushl %eax movl $16,%eax movl $reg_name,%ecx addl %eax,%ecx movl (%ecx),%ecx pushl %ecx .section .rodata _673: .string "\011movl %s,%s\n" .text lea _673,%ecx pushl %ecx call printf addl $12,%esp # /* printf("\tleave\n"); */ # } # fwddef(retlabel); _671: movl retlabel,%eax pushl %eax call fwddef addl $4,%esp # use_register(creg,REG_EAX,0); movl $0,%eax pushl %eax movl $0,%eax pushl %eax movl creg,%eax pushl %eax call use_register addl $12,%esp # if (REGISTERS6) { jmp _674 # printf("\tpopl %%esi\n"); .section .rodata _675: .string "\011popl %%esi\n" .text lea _675,%eax pushl %eax call printf addl $4,%esp # printf("\tpopl %%edi\n"); .section .rodata _676: .string "\011popl %%edi\n" .text lea _676,%eax pushl %eax call printf addl $4,%esp # } # /* if(disp) printf("\taddl $%d,%%esp\n",-disp); */ # printf("\tlea %d(%%ebp),%%esp\n",disp_offset); _674: movl disp_offset,%eax pushl %eax .section .rodata _677: .string "\011lea %d(%%ebp),%%esp\n" .text lea _677,%eax pushl %eax call printf addl $8,%esp # printf("\tpopl %%edx\n"); .section .rodata _678: .string "\011popl %%edx\n" .text lea _678,%eax pushl %eax call printf addl $4,%esp # printf("\tpopl %%ecx\n"); .section .rodata _679: .string "\011popl %%ecx\n" .text lea _679,%eax pushl %eax call printf addl $4,%esp # printf("\tpopl %%ebx\n"); .section .rodata _680: .string "\011popl %%ebx\n" .text lea _680,%eax pushl %eax call printf addl $4,%esp # printf("\tleave\n"); .section .rodata _681: .string "\011leave\n" .text lea _681,%eax pushl %eax call printf addl $4,%esp # printf("\tret\n"); .section .rodata _682: .string "\011ret\n" .text lea _682,%eax pushl %eax call printf addl $4,%esp # local_table(); call local_table # printf("_%d:\n",labelno); movl labelno,%eax pushl %eax .section .rodata _683: .string "_%d:\n" .text lea _683,%eax pushl %eax call printf addl $8,%esp # printf("\t.size\t%s,_%d-%s\n",name,labelno,name); movl 12(%ebp),%eax pushl %eax movl labelno,%eax pushl %eax movl 12(%ebp),%eax pushl %eax .section .rodata _684: .string "\011.size\011%s,_%d-%s\n" .text lea _684,%eax pushl %eax call printf addl $16,%esp # labelno++; movl $labelno,%eax movl (%eax),%ecx addl $1,(%eax) # } movl %ecx,%eax _669: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _685: .size leave,_685-leave # # # void # ret(void) # ret # 671 # { .align 2 .globl ret ret: .type ret,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # use_register(creg,REG_EAX,1); movl $1,%eax pushl %eax movl $0,%eax pushl %eax movl creg,%eax pushl %eax call use_register addl $12,%esp # jmp(retlabel); movl retlabel,%eax pushl %eax call jmp addl $4,%esp # } _686: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _687: .size ret,_687-ret # # void # gen_gdecl(char *n, int gpc) # gen_gdecl # 606 # 606 # { .align 2 .globl gen_gdecl gen_gdecl: .type gen_gdecl,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # /* # if (stmode!=STATIC) # printf(".globl %s\n",n); # */ # } _688: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _689: .size gen_gdecl,_689-gen_gdecl # # void # align(int t) # align # 0 # { .align 2 .globl align align: .type align,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # if (t!=CHAR) { movl $-2,%eax movl 8(%ebp),%ecx subl %eax,%ecx je _691 # if (data_alignment & 1) movl $1,%ecx movl data_alignment,%eax andl %ecx,%eax cmpl $0,%eax je _692 # printf("\t.align 2\n"); .section .rodata _693: .string "\011.align 2\n" .text lea _693,%eax pushl %eax call printf addl $4,%esp # data_alignment = 0; _692: movl $0,%eax movl %eax,data_alignment # } # } _691: _690: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _694: .size align,_694-align # # void # emit_data(int e, int t, NMTBL *n) # emit_data # 676 # 676 # 676 # { .align 2 .globl emit_data emit_data: .type emit_data,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # int l; # char *name; # name = n->nm; subl $8,%esp movl 16(%ebp),%eax movl (%eax),%eax movl %eax,-20(%ebp) # if(mode==GDECL) { /* global */ movl $1,%eax movl mode,%ecx subl %eax,%ecx jne _696 # if (n->dsp != -1) { movl $-1,%ecx movl $12,%eax movl 16(%ebp),%edx addl %eax,%edx movl (%edx),%edx subl %ecx,%edx je _697 # n->dsp = -1; /* initiallized flag */ movl $-1,%edx movl $12,%eax movl 16(%ebp),%ecx addl %eax,%ecx movl %edx,(%ecx) movl %edx,%ecx # printf(".globl\t%s\n",name); movl -20(%ebp),%ecx pushl %ecx .section .rodata _698: .string ".globl\011%s\n" .text lea _698,%ecx pushl %ecx call printf addl $8,%esp # data_mode(name); movl -20(%ebp),%eax pushl %eax call data_mode addl $4,%esp # align(t); movl 12(%ebp),%eax pushl %eax call align addl $4,%esp # printf("%s:\n",name); movl -20(%ebp),%eax pushl %eax .section .rodata _699: .string "%s:\n" .text lea _699,%eax pushl %eax call printf addl $8,%esp # } else { jmp _700 _697: # data_mode(0); movl $0,%eax pushl %eax call data_mode addl $4,%esp # } # if(car(e)==CONST) { _700: movl $7,%eax movl 8(%ebp),%ecx pushl %ecx xchg %ecx,%eax call car addl $4,%esp subl %ecx,%eax jne _701 # if (t==CHAR) { movl $-2,%eax movl 12(%ebp),%ecx subl %eax,%ecx jne _702 # printf("\t.byte %d\n",cadr(e)); movl 8(%ebp),%ecx pushl %ecx call cadr addl $4,%esp pushl %eax .section .rodata _703: .string "\011.byte %d\n" .text lea _703,%eax pushl %eax call printf addl $8,%esp # if (data_alignment>0) movl $0,%eax movl data_alignment,%ecx subl %eax,%ecx jle _704 # data_alignment++; movl $data_alignment,%ecx movl (%ecx),%eax addl $1,(%ecx) # gpc += 1; _704: movl $1,%eax movl $gpc,%ecx pushl %ecx # assop movl (%ecx),%ecx addl %eax,%ecx popl %ebx # assop movl %ecx,(%ebx) # } else { jmp _705 _702: # printf("\t.long %d\n",cadr(e)); movl 8(%ebp),%ecx pushl %ecx call cadr addl $4,%esp pushl %eax .section .rodata _706: .string "\011.long %d\n" .text lea _706,%eax pushl %eax call printf addl $8,%esp # gpc += int_size; movl int_size,%eax movl $gpc,%ecx pushl %ecx # assop movl (%ecx),%ecx addl %eax,%ecx popl %ebx # assop movl %ecx,(%ebx) # } # } else if(t!=CHAR) { _705: jmp _707 _701: movl $-2,%ecx movl 12(%ebp),%eax subl %ecx,%eax je _708 # gpc += int_size; movl int_size,%eax movl $gpc,%ecx pushl %ecx # assop movl (%ecx),%ecx addl %eax,%ecx popl %ebx # assop movl %ecx,(%ebx) # if(car(e)==ADDRESS&&car(cadr(e))==GVAR) { movl $12,%ecx movl 8(%ebp),%eax pushl %eax call car addl $4,%esp subl %ecx,%eax jne _709 movl $1,%eax movl 8(%ebp),%ecx pushl %ecx xchg %ecx,%eax call cadr addl $4,%esp pushl %eax call car addl $4,%esp subl %ecx,%eax jne _709 # printf("\t.long %s\n",caddr(cadr(e))); movl 8(%ebp),%eax pushl %eax call cadr addl $4,%esp pushl %eax call caddr addl $4,%esp pushl %eax .section .rodata _710: .string "\011.long %s\n" .text lea _710,%eax pushl %eax call printf addl $8,%esp # } else if(car(e)==FNAME) { jmp _711 _709: movl $8,%eax movl 8(%ebp),%ecx pushl %ecx xchg %ecx,%eax call car addl $4,%esp subl %ecx,%eax jne _712 # printf("\t.long %s\n",((NMTBL *)cadr(e))->nm); movl 8(%ebp),%eax pushl %eax call cadr addl $4,%esp movl (%eax),%eax pushl %eax .section .rodata _713: .string "\011.long %s\n" .text lea _713,%eax pushl %eax call printf addl $8,%esp # } else if(car(e)==STRING) { jmp _714 _712: movl $-27,%eax movl 8(%ebp),%ecx pushl %ecx xchg %ecx,%eax call car addl $4,%esp subl %ecx,%eax jne _715 # if (car(n->ty)!=ARRAY || cadr(n->ty)!=CHAR) { movl $-5,%eax movl $8,%ecx movl 16(%ebp),%edx addl %ecx,%edx movl (%edx),%edx pushl %edx xchg %edx,%eax call car addl $4,%esp subl %edx,%eax jne _717 movl $-2,%eax movl $8,%ecx movl 16(%ebp),%edx addl %ecx,%edx movl (%edx),%edx pushl %edx xchg %edx,%eax call cadr addl $4,%esp subl %edx,%eax je _716 _717: # l = fwdlabel(); call fwdlabel movl %eax,-16(%ebp) # printf("\t.long _%d\n",l); movl -16(%ebp),%eax pushl %eax .section .rodata _718: .string "\011.long _%d\n" .text lea _718,%eax pushl %eax call printf addl $8,%esp # printf(".section\t.rodata\n"); .section .rodata _719: .string ".section\011.rodata\n" .text lea _719,%eax pushl %eax call printf addl $4,%esp # printf("_%d:\n",l); movl -16(%ebp),%eax pushl %eax .section .rodata _720: .string "_%d:\n" .text lea _720,%eax pushl %eax call printf addl $8,%esp # output_mode = RODATA_EMIT_MODE; movl $2,%eax movl %eax,output_mode # } # ascii((char *)cadr(e)); _716: movl 8(%ebp),%eax pushl %eax call cadr addl $4,%esp pushl %eax call ascii addl $4,%esp # } else error(TYERR); jmp _721 _715: movl $15,%eax pushl %eax call error addl $4,%esp # } _721: _714: _711: # } else { _708: _707: jmp _722 _696: # /* if (n->sc!=LVAR) { error(TYERR); return; } */ # if(car(e)==CONST) { movl $7,%eax movl 8(%ebp),%ecx pushl %ecx xchg %ecx,%eax call car addl $4,%esp subl %ecx,%eax jne _723 # printf("\tmovl $%d,%s\n",cadr(e),crn); movl crn,%eax pushl %eax movl 8(%ebp),%eax pushl %eax call cadr addl $4,%esp pushl %eax .section .rodata _724: .string "\011movl $%d,%s\n" .text lea _724,%eax pushl %eax call printf addl $12,%esp # printf("\t%s %s,%d(%%ebp)\n",t==CHAR?"movsbl":"movl",crn,n->dsp); movl $12,%eax movl 16(%ebp),%ecx addl %eax,%ecx movl (%ecx),%ecx pushl %ecx movl crn,%ecx pushl %ecx movl $-2,%ecx movl 12(%ebp),%eax subl %ecx,%eax jne _725 .section .rodata _726: .string "movsbl" .text lea _726,%eax jmp _727 _725: .section .rodata _728: .string "movl" .text lea _728,%eax _727: pushl %eax .section .rodata _729: .string "\011%s %s,%d(%%ebp)\n" .text lea _729,%eax pushl %eax call printf addl $16,%esp # } else if(t!=CHAR) { jmp _730 _723: movl $-2,%eax movl 12(%ebp),%ecx subl %eax,%ecx je _731 # if(car(e)==ADDRESS&&car(cadr(e))==GVAR) movl $12,%ecx movl 8(%ebp),%eax pushl %eax call car addl $4,%esp subl %ecx,%eax jne _732 movl $1,%eax movl 8(%ebp),%ecx pushl %ecx xchg %ecx,%eax call cadr addl $4,%esp pushl %eax call car addl $4,%esp subl %ecx,%eax jne _732 # printf("\tlea %s,%s\n",caddr(e),crn); movl crn,%eax pushl %eax movl 8(%ebp),%eax pushl %eax call caddr addl $4,%esp pushl %eax .section .rodata _733: .string "\011lea %s,%s\n" .text lea _733,%eax pushl %eax call printf addl $12,%esp # else if(car(e)==FNAME) jmp _734 _732: movl $8,%eax movl 8(%ebp),%ecx pushl %ecx xchg %ecx,%eax call car addl $4,%esp subl %ecx,%eax jne _735 # printf("\tlea %s,%s\n",((NMTBL *)cadr(e))->nm,crn); movl crn,%eax pushl %eax movl 8(%ebp),%eax pushl %eax call cadr addl $4,%esp movl (%eax),%eax pushl %eax .section .rodata _736: .string "\011lea %s,%s\n" .text lea _736,%eax pushl %eax call printf addl $12,%esp # else if(car(e)==STRING) { jmp _737 _735: movl $-27,%eax movl 8(%ebp),%ecx pushl %ecx xchg %ecx,%eax call car addl $4,%esp subl %ecx,%eax jne _738 # string(e); movl 8(%ebp),%eax pushl %eax call string addl $4,%esp # } else error(TYERR); jmp _739 _738: movl $15,%eax pushl %eax call error addl $4,%esp # printf("\tmovl %s,%d(%%ebp)\n",crn,n->dsp); _739: _737: _734: movl $12,%eax movl 16(%ebp),%ecx addl %eax,%ecx movl (%ecx),%ecx pushl %ecx movl crn,%ecx pushl %ecx .section .rodata _740: .string "\011movl %s,%d(%%ebp)\n" .text lea _740,%ecx pushl %ecx call printf addl $12,%esp # } # } _731: _730: # } _722: _695: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _741: .size emit_data,_741-emit_data # # void # emit_data_closing(NMTBL *n) # emit_data_closing # 0 # { .align 2 .globl emit_data_closing emit_data_closing: .type emit_data_closing,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # int lb; # if (mode=GDECL) { subl $4,%esp movl $1,%eax movl %eax,mode cmpl $0,%eax je _743 # data_mode(0); movl $0,%eax pushl %eax call data_mode addl $4,%esp # lb=fwdlabel(); call fwdlabel movl %eax,-16(%ebp) # printf("_%d:\n",lb); movl -16(%ebp),%eax pushl %eax .section .rodata _744: .string "_%d:\n" .text lea _744,%eax pushl %eax call printf addl $8,%esp # printf("\t.size\t%s,_%d-%s\n",n->nm,lb,n->nm); movl 8(%ebp),%eax movl (%eax),%eax pushl %eax movl -16(%ebp),%eax pushl %eax movl 8(%ebp),%eax movl (%eax),%eax pushl %eax .section .rodata _745: .string "\011.size\011%s,_%d-%s\n" .text lea _745,%eax pushl %eax call printf addl $16,%esp # } # } _743: _742: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _746: .size emit_data_closing,_746-emit_data_closing # # void # global_table(void) # global_table # 586 # { .align 2 .globl global_table global_table: .type global_table,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # NMTBL *n; # for(n=ntable;n < &ntable[GSYMS];n++) { subl $4,%esp movl $ntable,%eax movl %eax,-16(%ebp) _749: movl $144000,%eax movl $ntable,%ecx addl %eax,%ecx movl -16(%ebp),%eax subl %ecx,%eax jae _748 # if (n->sc == GVAR && n->dsp != -1) { movl $1,%eax movl $4,%ecx movl -16(%ebp),%edx addl %ecx,%edx movl (%edx),%edx subl %eax,%edx jne _751 movl $-1,%edx movl $12,%eax movl -16(%ebp),%ecx addl %eax,%ecx movl (%ecx),%ecx subl %edx,%ecx je _751 # /* n->dsp = -1 means initialized global */ # printf(".comm %s,%d\n",n->nm,size(n->ty)); movl $8,%ecx movl -16(%ebp),%eax addl %ecx,%eax movl (%eax),%eax pushl %eax call size addl $4,%esp pushl %eax movl -16(%ebp),%eax movl (%eax),%eax pushl %eax .section .rodata _752: .string ".comm %s,%d\n" .text lea _752,%eax pushl %eax call printf addl $12,%esp # } # } _751: # } _750: lea -16(%ebp),%eax movl (%eax),%ecx addl $16,(%eax) jmp _749 _748: movl %ecx,%eax _747: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _753: .size global_table,_753-global_table # # void # local_table(void) # local_table # 591 # { .align 2 .globl local_table local_table: .type local_table,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # NMTBL *n; # /* static local variables */ # for(n=ntable+GSYMS;n < &ntable[GSYMS+LSYMS];n++) { subl $4,%esp movl $144000,%eax movl $ntable,%ecx addl %eax,%ecx movl %ecx,-16(%ebp) _756: movl $152000,%ecx movl $ntable,%eax addl %ecx,%eax movl -16(%ebp),%ecx subl %eax,%ecx jae _755 # if (n->sc == GVAR) { movl $1,%ecx movl $4,%eax movl -16(%ebp),%edx addl %eax,%edx movl (%edx),%edx subl %ecx,%edx jne _758 # printf(".lcomm %s,%d\n",n->nm,size(n->ty)); movl $8,%edx movl -16(%ebp),%eax addl %edx,%eax movl (%eax),%eax pushl %eax call size addl $4,%esp pushl %eax movl -16(%ebp),%eax movl (%eax),%eax pushl %eax .section .rodata _759: .string ".lcomm %s,%d\n" .text lea _759,%eax pushl %eax call printf addl $12,%esp # } # } _758: # } _757: lea -16(%ebp),%eax movl (%eax),%ecx addl $16,(%eax) jmp _756 _755: movl %ecx,%eax _754: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _760: .size local_table,_760-local_table # # void # text_mode(void) # text_mode # 681 # { .align 2 .globl text_mode text_mode: .type text_mode,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # if (output_mode!=TEXT_EMIT_MODE) { movl $0,%eax movl output_mode,%ecx subl %eax,%ecx je _762 # printf(".text\n"); .section .rodata _763: .string ".text\n" .text lea _763,%ecx pushl %ecx call printf addl $4,%esp # printf("\t.align 2\n"); .section .rodata _764: .string "\011.align 2\n" .text lea _764,%eax pushl %eax call printf addl $4,%esp # output_mode = TEXT_EMIT_MODE; movl $0,%eax movl %eax,output_mode # } # } _762: _761: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _765: .size text_mode,_765-text_mode # # void # data_mode(char *name) # data_mode # 686 # { .align 2 .globl data_mode data_mode: .type data_mode,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # if (output_mode!=DATA_EMIT_MODE) { movl $1,%eax movl output_mode,%ecx subl %eax,%ecx je _767 # printf(".data\n"); .section .rodata _768: .string ".data\n" .text lea _768,%ecx pushl %ecx call printf addl $4,%esp # output_mode = DATA_EMIT_MODE; movl $1,%eax movl %eax,output_mode # } # if (name) _767: cmpl $0,8(%ebp) je _769 # printf("\t.type\t%s,@object\n",name); movl 8(%ebp),%eax pushl %eax .section .rodata _770: .string "\011.type\011%s,@object\n" .text lea _770,%eax pushl %eax call printf addl $8,%esp # } _769: _766: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _771: .size data_mode,_771-data_mode # # int # lvar(int l) # lvar # 701 # { .align 2 .globl lvar lvar: .type lvar,@function pushl %ebp movl %esp,%ebp pushl %ebx pushl %ecx pushl %edx # if (l<0) { movl $0,%eax movl 8(%ebp),%ecx subl %eax,%ecx jge _773 # if (fnptr->sc==CODE) movl $-39,%ecx movl $4,%eax movl fnptr,%edx addl %eax,%edx movl (%edx),%edx subl %ecx,%edx jne _774 # return l+code_disp_offset; movl 8(%ebp),%edx movl code_disp_offset,%eax addl %edx,%eax # else jmp _772 _774: # return l+disp_offset; movl 8(%ebp),%eax movl disp_offset,%ecx addl %eax,%ecx # } else { movl %ecx,%eax jmp _772 _773: # return l+arg_offset; movl 8(%ebp),%eax movl arg_offset,%ecx addl %eax,%ecx # } movl %ecx,%eax jmp _772 # } _772: lea -12(%ebp),%esp popl %edx popl %ecx popl %ebx leave ret _775: .size lvar,_775-lvar # # /* end */ .comm glineno,4 .comm blabel,4 .comm retcont,4 .comm symval,4 .comm cslabel,4 .comm ntable,152000 .comm ac,4 .comm av,4 .comm ch,4 .comm fnptr,4 .comm ilabel,4 .comm gfree,4 .comm rname,40 .comm init_vars,4 .comm debug,4 .comm retpending,4 .comm filep,4 .comm __sstderr,96 .comm __sstdout,96 .comm filestack,36 .comm clabel,4 .comm stmode,4 .comm reg_stack,40 .comm mflag,4 .comm lfree,4 .comm labelno,4 .comm MAX_REGISTER_VAR,4 .comm dlabel,4 .comm lrn,4 .comm gpc,4 .comm chptrsave,4 .comm chptr,4 .comm lineno,4 .comm lsrc,4 .comm crn,4 .comm reg_sp,4 .comm lreg,4 .comm cheap,256000 .comm ac2,4 .comm csvalue,4 .comm drn,4 .comm xreg,4 .comm chk,4 .comm chsave,4 .comm retlabel,4 .comm type,4 .comm __sstdin,96 .comm sptr,4 .comm mode,4 .comm sym,4 .comm obuf,4 .comm code_arg_offset,4 .comm reg_name_l,16 .comm name,4 .comm control,4 .comm gnptr,4 .comm creg,4 .comm linebuf,4096 .comm regs,40 .comm stat_no,4 .comm namebuf,4096 .comm reg_name,32 .comm nptr,4 .comm cheapp,4 .comm heap,40000 .comm hash,4 .comm reg_var,4 .comm asmf,4 .comm disp,4 .comm args,4 .comm dreg,4 .comm csvalue1,4 .ident "Micro-C compiled"