1
0
mirror of https://github.com/golang/go synced 2024-11-25 06:57:58 -07:00

make 6a, 6c, 6g, 6l, libmach_amd64 build on 64-bit gcc.

these guys really really want long to be 32-bits,
so ,s/long/int32/ (and then manual fixup).
still passes all tests.

(i started out looking for just those longs that
needed to be int32 instead, and it was just too hard
to track them down one by one.)

the longs were rare enough that i don't think
it will cause integration problems.

R=ken
OCL=13787
CL=13789
This commit is contained in:
Russ Cox 2008-08-03 17:25:15 -07:00
parent 851100683e
commit 9aad9fef76
60 changed files with 793 additions and 784 deletions

View File

@ -29,14 +29,14 @@
struct coffsect struct coffsect
{ {
char name[8]; char name[8];
ulong phys; uint32 phys;
ulong virt; uint32 virt;
ulong size; uint32 size;
ulong fptr; uint32 fptr;
ulong fptrreloc; uint32 fptrreloc;
ulong fptrlineno; uint32 fptrlineno;
ulong nrelocnlineno; uint32 nrelocnlineno;
ulong flags; uint32 flags;
}; };
/* /*
@ -46,26 +46,26 @@ struct mipsexec
{ {
short mmagic; /* (0x160) mips magic number */ short mmagic; /* (0x160) mips magic number */
short nscns; /* (unused) number of sections */ short nscns; /* (unused) number of sections */
long timdat; /* (unused) time & date stamp */ int32 timdat; /* (unused) time & date stamp */
long symptr; /* offset to symbol table */ int32 symptr; /* offset to symbol table */
long nsyms; /* size of symbol table */ int32 nsyms; /* size of symbol table */
short opthdr; /* (0x38) sizeof(optional hdr) */ short opthdr; /* (0x38) sizeof(optional hdr) */
short pcszs; /* flags */ short pcszs; /* flags */
short amagic; /* see above */ short amagic; /* see above */
short vstamp; /* version stamp */ short vstamp; /* version stamp */
long tsize; /* text size in bytes */ int32 tsize; /* text size in bytes */
long dsize; /* initialized data */ int32 dsize; /* initialized data */
long bsize; /* uninitialized data */ int32 bsize; /* uninitialized data */
long mentry; /* entry pt. */ int32 mentry; /* entry pt. */
long text_start; /* base of text used for this file */ int32 text_start; /* base of text used for this file */
long data_start; /* base of data used for this file */ int32 data_start; /* base of data used for this file */
long bss_start; /* base of bss used for this file */ int32 bss_start; /* base of bss used for this file */
long gprmask; /* general purpose register mask */ int32 gprmask; /* general purpose register mask */
union{ union{
long cprmask[4]; /* co-processor register masks */ int32 cprmask[4]; /* co-processor register masks */
long pcsize; int32 pcsize;
}; };
long gp_value; /* the gp value used for this object */ int32 gp_value; /* the gp value used for this object */
}; };
struct mips4kexec struct mips4kexec
@ -80,64 +80,64 @@ struct sparcexec
{ {
short sjunk; /* dynamic bit and version number */ short sjunk; /* dynamic bit and version number */
short smagic; /* 0407 */ short smagic; /* 0407 */
ulong stext; uint32 stext;
ulong sdata; uint32 sdata;
ulong sbss; uint32 sbss;
ulong ssyms; uint32 ssyms;
ulong sentry; uint32 sentry;
ulong strsize; uint32 strsize;
ulong sdrsize; uint32 sdrsize;
}; };
struct nextexec struct nextexec
{ {
/* UNUSED /* UNUSED
struct nexthdr{ struct nexthdr{
ulong nmagic; uint32 nmagic;
ulong ncputype; uint32 ncputype;
ulong ncpusubtype; uint32 ncpusubtype;
ulong nfiletype; uint32 nfiletype;
ulong ncmds; uint32 ncmds;
ulong nsizeofcmds; uint32 nsizeofcmds;
ulong nflags; uint32 nflags;
}; };
struct nextcmd{ struct nextcmd{
ulong cmd; uint32 cmd;
ulong cmdsize; uint32 cmdsize;
uchar segname[16]; uchar segname[16];
ulong vmaddr; uint32 vmaddr;
ulong vmsize; uint32 vmsize;
ulong fileoff; uint32 fileoff;
ulong filesize; uint32 filesize;
ulong maxprot; uint32 maxprot;
ulong initprot; uint32 initprot;
ulong nsects; uint32 nsects;
ulong flags; uint32 flags;
}textc; }textc;
struct nextsect{ struct nextsect{
char sectname[16]; char sectname[16];
char segname[16]; char segname[16];
ulong addr; uint32 addr;
ulong size; uint32 size;
ulong offset; uint32 offset;
ulong align; uint32 align;
ulong reloff; uint32 reloff;
ulong nreloc; uint32 nreloc;
ulong flags; uint32 flags;
ulong reserved1; uint32 reserved1;
ulong reserved2; uint32 reserved2;
}texts; }texts;
struct nextcmd datac; struct nextcmd datac;
struct nextsect datas; struct nextsect datas;
struct nextsect bsss; struct nextsect bsss;
struct nextsym{ struct nextsym{
ulong cmd; uint32 cmd;
ulong cmdsize; uint32 cmdsize;
ulong symoff; uint32 symoff;
ulong nsyms; uint32 nsyms;
ulong spoff; uint32 spoff;
ulong pcoff; uint32 pcoff;
}symc; }symc;
*/ */
}; };
@ -146,20 +146,20 @@ struct i386exec
{ {
/* UNUSED /* UNUSED
struct i386coff{ struct i386coff{
ulong isectmagic; uint32 isectmagic;
ulong itime; uint32 itime;
ulong isyms; uint32 isyms;
ulong insyms; uint32 insyms;
ulong iflags; uint32 iflags;
}; };
struct i386hdr{ struct i386hdr{
ulong imagic; uint32 imagic;
ulong itextsize; uint32 itextsize;
ulong idatasize; uint32 idatasize;
ulong ibsssize; uint32 ibsssize;
ulong ientry; uint32 ientry;
ulong itextstart; uint32 itextstart;
ulong idatastart; uint32 idatastart;
}; };
struct coffsect itexts; struct coffsect itexts;
struct coffsect idatas; struct coffsect idatas;

View File

@ -42,14 +42,14 @@
typedef struct Exec Exec; typedef struct Exec Exec;
struct Exec struct Exec
{ {
long magic; /* magic number */ int32 magic; /* magic number */
long text; /* size of text segment */ int32 text; /* size of text segment */
long data; /* size of initialized data */ int32 data; /* size of initialized data */
long bss; /* size of uninitialized data */ int32 bss; /* size of uninitialized data */
long syms; /* size of symbol table */ int32 syms; /* size of symbol table */
long entry; /* entry point */ int32 entry; /* entry point */
long spsz; /* size of pc/sp offset table */ int32 spsz; /* size of pc/sp offset table */
long pcsz; /* size of pc/line number table */ int32 pcsz; /* size of pc/line number table */
}; };
#define HDR_MAGIC 0x00008000 /* header expansion */ #define HDR_MAGIC 0x00008000 /* header expansion */
@ -263,8 +263,8 @@ struct Mach{
char *name; char *name;
int mtype; /* machine type code */ int mtype; /* machine type code */
Reglist *reglist; /* register set */ Reglist *reglist; /* register set */
long regsize; /* sizeof registers in bytes */ int32 regsize; /* sizeof registers in bytes */
long fpregsize; /* sizeof fp registers in bytes */ int32 fpregsize; /* sizeof fp registers in bytes */
char *pc; /* pc name */ char *pc; /* pc name */
char *sp; /* sp name */ char *sp; /* sp name */
char *link; /* link register name */ char *link; /* link register name */
@ -291,12 +291,12 @@ struct Machdata { /* Machine-dependent debugger support */
short bpsize; /* size of break point instr. */ short bpsize; /* size of break point instr. */
ushort (*swab)(ushort); /* ushort to local byte order */ ushort (*swab)(ushort); /* ushort to local byte order */
ulong (*swal)(ulong); /* ulong to local byte order */ uint32 (*swal)(uint32); /* uint32 to local byte order */
uvlong (*swav)(uvlong); /* uvlong to local byte order */ uvlong (*swav)(uvlong); /* uvlong to local byte order */
int (*ctrace)(Map*, uvlong, uvlong, uvlong, Tracer); /* C traceback */ int (*ctrace)(Map*, uvlong, uvlong, uvlong, Tracer); /* C traceback */
uvlong (*findframe)(Map*, uvlong, uvlong, uvlong, uvlong);/* frame finder */ uvlong (*findframe)(Map*, uvlong, uvlong, uvlong, uvlong);/* frame finder */
char* (*excep)(Map*, Rgetter); /* last exception */ char* (*excep)(Map*, Rgetter); /* last exception */
ulong (*bpfix)(uvlong); /* breakpoint fixup */ uint32 (*bpfix)(uvlong); /* breakpoint fixup */
int (*sftos)(char*, int, void*); /* single precision float */ int (*sftos)(char*, int, void*); /* single precision float */
int (*dftos)(char*, int, void*); /* double precision float */ int (*dftos)(char*, int, void*); /* double precision float */
int (*foll)(Map*, uvlong, Rgetter, uvlong*);/* follow set */ int (*foll)(Map*, uvlong, Rgetter, uvlong*);/* follow set */
@ -315,7 +315,7 @@ typedef struct Fhdr
uchar hdrsz; /* header size */ uchar hdrsz; /* header size */
uchar _magic; /* _MAGIC() magic */ uchar _magic; /* _MAGIC() magic */
uchar spare; uchar spare;
long magic; /* magic number */ int32 magic; /* magic number */
uvlong txtaddr; /* text address */ uvlong txtaddr; /* text address */
vlong txtoff; /* start of text in file */ vlong txtoff; /* start of text in file */
uvlong dataddr; /* start of data segment */ uvlong dataddr; /* start of data segment */
@ -324,12 +324,12 @@ typedef struct Fhdr
uvlong entry; /* entry point */ uvlong entry; /* entry point */
vlong sppcoff; /* offset of sp-pc table in file */ vlong sppcoff; /* offset of sp-pc table in file */
vlong lnpcoff; /* offset of line number-pc table in file */ vlong lnpcoff; /* offset of line number-pc table in file */
long txtsz; /* text size */ int32 txtsz; /* text size */
long datsz; /* size of data seg */ int32 datsz; /* size of data seg */
long bsssz; /* size of bss */ int32 bsssz; /* size of bss */
long symsz; /* size of symbol table */ int32 symsz; /* size of symbol table */
long sppcsz; /* size of sp-pc table */ int32 sppcsz; /* size of sp-pc table */
long lnpcsz; /* size of line number-pc table */ int32 lnpcsz; /* size of line number-pc table */
} Fhdr; } Fhdr;
extern int asstype; /* dissembler type - machdata.c */ extern int asstype; /* dissembler type - machdata.c */
@ -340,14 +340,14 @@ int beieee80ftos(char*, int, void*);
int beieeesftos(char*, int, void*); int beieeesftos(char*, int, void*);
int beieeedftos(char*, int, void*); int beieeedftos(char*, int, void*);
ushort beswab(ushort); ushort beswab(ushort);
ulong beswal(ulong); uint32 beswal(uint32);
uvlong beswav(uvlong); uvlong beswav(uvlong);
uvlong ciscframe(Map*, uvlong, uvlong, uvlong, uvlong); uvlong ciscframe(Map*, uvlong, uvlong, uvlong, uvlong);
int cisctrace(Map*, uvlong, uvlong, uvlong, Tracer); int cisctrace(Map*, uvlong, uvlong, uvlong, Tracer);
int crackhdr(int fd, Fhdr*); int crackhdr(int fd, Fhdr*);
uvlong file2pc(char*, long); uvlong file2pc(char*, int32);
int fileelem(Sym**, uchar *, char*, int); int fileelem(Sym**, uchar *, char*, int);
long fileline(char*, int, uvlong); int32 fileline(char*, int, uvlong);
int filesym(int, char*, int); int filesym(int, char*, int);
int findlocal(Symbol*, char*, Symbol*); int findlocal(Symbol*, char*, Symbol*);
int findseg(Map*, char*); int findseg(Map*, char*);
@ -356,23 +356,23 @@ int fnbound(uvlong, uvlong*);
int fpformat(Map*, Reglist*, char*, int, int); int fpformat(Map*, Reglist*, char*, int, int);
int get1(Map*, uvlong, uchar*, int); int get1(Map*, uvlong, uchar*, int);
int get2(Map*, uvlong, ushort*); int get2(Map*, uvlong, ushort*);
int get4(Map*, uvlong, ulong*); int get4(Map*, uvlong, uint32*);
int get8(Map*, uvlong, uvlong*); int get8(Map*, uvlong, uvlong*);
int geta(Map*, uvlong, uvlong*); int geta(Map*, uvlong, uvlong*);
int getauto(Symbol*, int, int, Symbol*); int getauto(Symbol*, int, int, Symbol*);
Sym* getsym(int); Sym* getsym(int);
int globalsym(Symbol *, int); int globalsym(Symbol *, int);
char* _hexify(char*, ulong, int); char* _hexify(char*, uint32, int);
int ieeesftos(char*, int, ulong); int ieeesftos(char*, int, uint32);
int ieeedftos(char*, int, ulong, ulong); int ieeedftos(char*, int, uint32, uint32);
int isar(Biobuf*); int isar(Biobuf*);
int leieee80ftos(char*, int, void*); int leieee80ftos(char*, int, void*);
int leieeesftos(char*, int, void*); int leieeesftos(char*, int, void*);
int leieeedftos(char*, int, void*); int leieeedftos(char*, int, void*);
ushort leswab(ushort); ushort leswab(ushort);
ulong leswal(ulong); uint32 leswal(uint32);
uvlong leswav(uvlong); uvlong leswav(uvlong);
uvlong line2addr(long, uvlong, uvlong); uvlong line2addr(int32, uvlong, uvlong);
Map* loadmap(Map*, int, Fhdr*); Map* loadmap(Map*, int, Fhdr*);
int localaddr(Map*, char*, char*, uvlong*, Rgetter); int localaddr(Map*, char*, char*, uvlong*, Rgetter);
int localsym(Symbol*, int); int localsym(Symbol*, int);
@ -384,10 +384,10 @@ Map* newmap(Map*, int);
void objtraverse(void(*)(Sym*, void*), void*); void objtraverse(void(*)(Sym*, void*), void*);
int objtype(Biobuf*, char**); int objtype(Biobuf*, char**);
uvlong pc2sp(uvlong); uvlong pc2sp(uvlong);
long pc2line(uvlong); int32 pc2line(uvlong);
int put1(Map*, uvlong, uchar*, int); int put1(Map*, uvlong, uchar*, int);
int put2(Map*, uvlong, ushort); int put2(Map*, uvlong, ushort);
int put4(Map*, uvlong, ulong); int put4(Map*, uvlong, uint32);
int put8(Map*, uvlong, uvlong); int put8(Map*, uvlong, uvlong);
int puta(Map*, uvlong, uvlong); int puta(Map*, uvlong, uvlong);
int readar(Biobuf*, int, vlong, int); int readar(Biobuf*, int, vlong, int);
@ -395,7 +395,7 @@ int readobj(Biobuf*, int);
uvlong riscframe(Map*, uvlong, uvlong, uvlong, uvlong); uvlong riscframe(Map*, uvlong, uvlong, uvlong, uvlong);
int risctrace(Map*, uvlong, uvlong, uvlong, Tracer); int risctrace(Map*, uvlong, uvlong, uvlong, Tracer);
int setmap(Map*, int, uvlong, uvlong, vlong, char*); int setmap(Map*, int, uvlong, uvlong, vlong, char*);
Sym* symbase(long*); Sym* symbase(int32*);
int syminit(int, Fhdr*); int syminit(int, Fhdr*);
int symoff(char*, int, uvlong, int); int symoff(char*, int, uvlong, int);
void textseg(uvlong, Fhdr*); void textseg(uvlong, Fhdr*);

View File

@ -173,6 +173,16 @@ typedef intptr_t intptr;
typedef uint32_t u32int; typedef uint32_t u32int;
typedef int32_t s32int; typedef int32_t s32int;
typedef s8int int8;
typedef u8int uint8;
typedef s16int int16;
typedef u16int uint16;
typedef s32int int32;
typedef u32int uint32;
typedef s64int int64;
typedef u64int uint64;
#undef _NEEDUCHAR #undef _NEEDUCHAR
#undef _NEEDUSHORT #undef _NEEDUSHORT
#undef _NEEDUINT #undef _NEEDUINT

View File

@ -28,26 +28,26 @@
struct Ureg struct Ureg
{ {
ulong di; /* general registers */ uint32 di; /* general registers */
ulong si; /* ... */ uint32 si; /* ... */
ulong bp; /* ... */ uint32 bp; /* ... */
ulong nsp; uint32 nsp;
ulong bx; /* ... */ uint32 bx; /* ... */
ulong dx; /* ... */ uint32 dx; /* ... */
ulong cx; /* ... */ uint32 cx; /* ... */
ulong ax; /* ... */ uint32 ax; /* ... */
ulong gs; /* data segments */ uint32 gs; /* data segments */
ulong fs; /* ... */ uint32 fs; /* ... */
ulong es; /* ... */ uint32 es; /* ... */
ulong ds; /* ... */ uint32 ds; /* ... */
ulong trap; /* trap type */ uint32 trap; /* trap type */
ulong ecode; /* error code (or zero) */ uint32 ecode; /* error code (or zero) */
ulong pc; /* pc */ uint32 pc; /* pc */
ulong cs; /* old context */ uint32 cs; /* old context */
ulong flags; /* old flags */ uint32 flags; /* old flags */
union { union {
ulong usp; uint32 usp;
ulong sp; uint32 sp;
}; };
ulong ss; /* old stack segment */ uint32 ss; /* old stack segment */
}; };

View File

@ -32,7 +32,6 @@
#include <libc.h> #include <libc.h>
#include <bio.h> #include <bio.h>
#include "../6l/6.out.h" #include "../6l/6.out.h"
#include "compat.h"
#ifndef EXTERN #ifndef EXTERN
@ -119,7 +118,7 @@ struct Hist
{ {
Hist* link; Hist* link;
char* name; char* name;
long line; int32 line;
vlong offset; vlong offset;
}; };
#define H ((Hist*)0) #define H ((Hist*)0)
@ -145,24 +144,24 @@ EXTERN char* include[NINCLUDE];
EXTERN Io* iofree; EXTERN Io* iofree;
EXTERN Io* ionext; EXTERN Io* ionext;
EXTERN Io* iostack; EXTERN Io* iostack;
EXTERN long lineno; EXTERN int32 lineno;
EXTERN int nerrors; EXTERN int nerrors;
EXTERN long nhunk; EXTERN int32 nhunk;
EXTERN int ninclude; EXTERN int ninclude;
EXTERN Gen nullgen; EXTERN Gen nullgen;
EXTERN char* outfile; EXTERN char* outfile;
EXTERN int pass; EXTERN int pass;
EXTERN char* pathname; EXTERN char* pathname;
EXTERN long pc; EXTERN int32 pc;
EXTERN int peekc; EXTERN int peekc;
EXTERN int sym; EXTERN int sym;
EXTERN char symb[NSYMB]; EXTERN char symb[NSYMB];
EXTERN int thechar; EXTERN int thechar;
EXTERN char* thestring; EXTERN char* thestring;
EXTERN long thunk; EXTERN int32 thunk;
EXTERN Biobuf obuf; EXTERN Biobuf obuf;
void* allocn(void*, long, long); void* allocn(void*, int32, int32);
void errorexit(void); void errorexit(void);
void pushio(void); void pushio(void);
void newio(void); void newio(void);
@ -170,7 +169,7 @@ void newfile(char*, int);
Sym* slookup(char*); Sym* slookup(char*);
Sym* lookup(void); Sym* lookup(void);
void syminit(Sym*); void syminit(Sym*);
long yylex(void); int32 yylex(void);
int getc(void); int getc(void);
int getnsc(void); int getnsc(void);
void unget(int); void unget(int);
@ -197,7 +196,7 @@ void maclin(void);
void macif(int); void macif(int);
void macend(void); void macend(void);
void dodefine(char*); void dodefine(char*);
void prfile(long); void prfile(int32);
void linehist(char*, int); void linehist(char*, int);
void gethunk(void); void gethunk(void);
void yyerror(char*, ...); void yyerror(char*, ...);

View File

@ -1102,7 +1102,7 @@ zname(char *n, int t, int s)
void void
zaddr(Gen *a, int s) zaddr(Gen *a, int s)
{ {
long l; int32 l;
int i, t; int i, t;
char *n; char *n;
Ieee e; Ieee e;

View File

@ -40,7 +40,7 @@ cgen(Node *n, Node *nn)
Prog *p1; Prog *p1;
Node nod, nod1, nod2, nod3, nod4; Node nod, nod1, nod2, nod3, nod4;
int o, hardleft; int o, hardleft;
long v, curs; int32 v, curs;
vlong c; vlong c;
if(debug['g']) { if(debug['g']) {
@ -1048,7 +1048,7 @@ cgen(Node *n, Node *nn)
diag(n, "DOT and no offset"); diag(n, "DOT and no offset");
break; break;
} }
nod.xoffset += (long)r->vconst; nod.xoffset += (int32)r->vconst;
nod.type = n->type; nod.type = n->type;
cgen(&nod, nn); cgen(&nod, nn);
break; break;
@ -1150,7 +1150,7 @@ void
reglcgen(Node *t, Node *n, Node *nn) reglcgen(Node *t, Node *n, Node *nn)
{ {
Node *r; Node *r;
long v; int32 v;
regialloc(t, n, nn); regialloc(t, n, nn);
if(n->op == OIND) { if(n->op == OIND) {
@ -1234,7 +1234,7 @@ boolgen(Node *n, int true, Node *nn)
int o; int o;
Prog *p1, *p2; Prog *p1, *p2;
Node *l, *r, nod, nod1; Node *l, *r, nod, nod1;
long curs; int32 curs;
if(debug['g']) { if(debug['g']) {
prtree(nn, "boolgen lhs"); prtree(nn, "boolgen lhs");
@ -1418,7 +1418,7 @@ boolgen(Node *n, int true, Node *nn)
} }
void void
sugen(Node *n, Node *nn, long w) sugen(Node *n, Node *nn, int32 w)
{ {
Prog *p1; Prog *p1;
Node nod0, nod1, nod2, nod3, nod4, *l, *r; Node nod0, nod1, nod2, nod3, nod4, *l, *r;
@ -1460,7 +1460,7 @@ sugen(Node *n, Node *nn, long w)
diag(n, "DOT and no offset"); diag(n, "DOT and no offset");
break; break;
} }
nod1.xoffset += (long)r->vconst; nod1.xoffset += (int32)r->vconst;
nod1.type = n->type; nod1.type = n->type;
sugen(&nod1, nn, w); sugen(&nod1, nn, w);
break; break;
@ -1846,7 +1846,7 @@ layout(Node *f, Node *t, int c, int cv, Node *cn)
int int
immconst(Node *n) immconst(Node *n)
{ {
long v; int32 v;
if(n->op != OCONST || !typechlpv[n->type->etype]) if(n->op != OCONST || !typechlpv[n->type->etype])
return 0; return 0;
@ -1916,22 +1916,22 @@ vaddr(Node *n, int a)
return 0; return 0;
} }
long int32
hi64v(Node *n) hi64v(Node *n)
{ {
if(align(0, types[TCHAR], Aarg1)) /* isbigendian */ if(align(0, types[TCHAR], Aarg1)) /* isbigendian */
return (long)(n->vconst) & ~0L; return (int32)(n->vconst) & ~0L;
else else
return (long)((uvlong)n->vconst>>32) & ~0L; return (int32)((uvlong)n->vconst>>32) & ~0L;
} }
long int32
lo64v(Node *n) lo64v(Node *n)
{ {
if(align(0, types[TCHAR], Aarg1)) /* isbigendian */ if(align(0, types[TCHAR], Aarg1)) /* isbigendian */
return (long)((uvlong)n->vconst>>32) & ~0L; return (int32)((uvlong)n->vconst>>32) & ~0L;
else else
return (long)(n->vconst) & ~0L; return (int32)(n->vconst) & ~0L;
} }
Node * Node *

View File

@ -41,7 +41,7 @@
#define T32 TN(32) #define T32 TN(32)
int int
multiplier(ulong d, int p, uvlong *mp) multiplier(uint32 d, int p, uvlong *mp)
{ {
int l; int l;
uvlong mlo, mhi, tlo, thi; uvlong mlo, mhi, tlo, thi;
@ -67,7 +67,7 @@ multiplier(ulong d, int p, uvlong *mp)
} }
int int
sdiv(ulong d, ulong *mp, int *sp) sdiv(uint32 d, uint32 *mp, int *sp)
{ {
int s; int s;
uvlong m; uvlong m;
@ -82,7 +82,7 @@ sdiv(ulong d, ulong *mp, int *sp)
} }
int int
udiv(ulong d, ulong *mp, int *sp, int *pp) udiv(uint32 d, uint32 *mp, int *sp, int *pp)
{ {
int p, s; int p, s;
uvlong m; uvlong m;
@ -113,7 +113,7 @@ void
sdivgen(Node *l, Node *r, Node *ax, Node *dx) sdivgen(Node *l, Node *r, Node *ax, Node *dx)
{ {
int a, s; int a, s;
ulong m; uint32 m;
vlong c; vlong c;
c = r->vconst; c = r->vconst;
@ -137,7 +137,7 @@ void
udivgen(Node *l, Node *r, Node *ax, Node *dx) udivgen(Node *l, Node *r, Node *ax, Node *dx)
{ {
int a, s, t; int a, s, t;
ulong m; uint32 m;
Node nod; Node nod;
a = udiv(r->vconst, &m, &s, &t); a = udiv(r->vconst, &m, &s, &t);
@ -184,7 +184,7 @@ sext(Node *d, Node *s, Node *l)
} }
void void
sdiv2(long c, int v, Node *l, Node *n) sdiv2(int32 c, int v, Node *l, Node *n)
{ {
Node nod; Node nod;
@ -206,7 +206,7 @@ sdiv2(long c, int v, Node *l, Node *n)
} }
void void
smod2(long c, int v, Node *l, Node *n) smod2(int32 c, int v, Node *l, Node *n)
{ {
Node nod; Node nod;

View File

@ -83,7 +83,7 @@ struct Prog
Adr from; Adr from;
Adr to; Adr to;
Prog* link; Prog* link;
long lineno; int32 lineno;
short as; short as;
}; };
#define P ((Prog*)0) #define P ((Prog*)0)
@ -92,7 +92,7 @@ struct Case
{ {
Case* link; Case* link;
vlong val; vlong val;
long label; int32 label;
char def; char def;
char isv; char isv;
}; };
@ -101,7 +101,7 @@ struct Case
struct C1 struct C1
{ {
vlong val; vlong val;
long label; int32 label;
}; };
struct Var struct Var
@ -114,8 +114,8 @@ struct Var
struct Reg struct Reg
{ {
long pc; int32 pc;
long rpo; /* reverse post ordering */ int32 rpo; /* reverse post ordering */
Bits set; Bits set;
Bits use1; Bits use1;
@ -128,11 +128,11 @@ struct Reg
Bits regdiff; Bits regdiff;
Bits act; Bits act;
long regu; int32 regu;
long loop; /* could be shorter */ int32 loop; /* could be shorter */
Reg* log5; Reg* log5;
long active; int32 active;
Reg* p1; Reg* p1;
Reg* p2; Reg* p2;
@ -161,26 +161,26 @@ struct Rgn
short regno; short regno;
}; };
EXTERN long breakpc; EXTERN int32 breakpc;
EXTERN long nbreak; EXTERN int32 nbreak;
EXTERN Case* cases; EXTERN Case* cases;
EXTERN Node constnode; EXTERN Node constnode;
EXTERN Node fconstnode; EXTERN Node fconstnode;
EXTERN Node vconstnode; EXTERN Node vconstnode;
EXTERN long continpc; EXTERN int32 continpc;
EXTERN long curarg; EXTERN int32 curarg;
EXTERN long cursafe; EXTERN int32 cursafe;
EXTERN Prog* firstp; EXTERN Prog* firstp;
EXTERN Prog* lastp; EXTERN Prog* lastp;
EXTERN long maxargsafe; EXTERN int32 maxargsafe;
EXTERN int mnstring; EXTERN int mnstring;
EXTERN Node* nodrat; EXTERN Node* nodrat;
EXTERN Node* nodret; EXTERN Node* nodret;
EXTERN Node* nodsafe; EXTERN Node* nodsafe;
EXTERN long nrathole; EXTERN int32 nrathole;
EXTERN long nstring; EXTERN int32 nstring;
EXTERN Prog* p; EXTERN Prog* p;
EXTERN long pc; EXTERN int32 pc;
EXTERN Node lregnode; EXTERN Node lregnode;
EXTERN Node qregnode; EXTERN Node qregnode;
EXTERN char string[NSNAME]; EXTERN char string[NSNAME];
@ -188,8 +188,8 @@ EXTERN Sym* symrathole;
EXTERN Node znode; EXTERN Node znode;
EXTERN Prog zprog; EXTERN Prog zprog;
EXTERN int reg[D_NONE]; EXTERN int reg[D_NONE];
EXTERN long exregoffset; EXTERN int32 exregoffset;
EXTERN long exfregoffset; EXTERN int32 exfregoffset;
EXTERN uchar typechlpv[NTYPE]; EXTERN uchar typechlpv[NTYPE];
#define BLOAD(r) band(bnot(r->refbehind), r->refahead) #define BLOAD(r) band(bnot(r->refbehind), r->refahead)
@ -214,8 +214,8 @@ EXTERN Bits params;
EXTERN Bits consts; EXTERN Bits consts;
EXTERN Bits addrs; EXTERN Bits addrs;
EXTERN long regbits; EXTERN int32 regbits;
EXTERN long exregbits; EXTERN int32 exregbits;
EXTERN int change; EXTERN int change;
EXTERN int suppress; EXTERN int suppress;
@ -225,9 +225,9 @@ EXTERN Reg* lastr;
EXTERN Reg zreg; EXTERN Reg zreg;
EXTERN Reg* freer; EXTERN Reg* freer;
EXTERN Var var[NVAR]; EXTERN Var var[NVAR];
EXTERN long* idom; EXTERN int32* idom;
EXTERN Reg** rpo2r; EXTERN Reg** rpo2r;
EXTERN long maxnr; EXTERN int32 maxnr;
extern char* anames[]; extern char* anames[];
@ -251,7 +251,7 @@ void reglcgen(Node*, Node*, Node*);
void lcgen(Node*, Node*); void lcgen(Node*, Node*);
void bcgen(Node*, int); void bcgen(Node*, int);
void boolgen(Node*, int, Node*); void boolgen(Node*, int, Node*);
void sugen(Node*, Node*, long); void sugen(Node*, Node*, int32);
int needreg(Node*, int); int needreg(Node*, int);
int hardconst(Node*); int hardconst(Node*);
int immconst(Node*); int immconst(Node*);
@ -272,7 +272,7 @@ void gclean(void);
void nextpc(void); void nextpc(void);
void gargs(Node*, Node*, Node*); void gargs(Node*, Node*, Node*);
void garg1(Node*, Node*, Node*, int, Node**); void garg1(Node*, Node*, Node*, int, Node**);
Node* nodconst(long); Node* nodconst(int32);
Node* nodfconst(double); Node* nodfconst(double);
Node* nodgconst(vlong, Type*); Node* nodgconst(vlong, Type*);
int nodreg(Node*, Node*, int); int nodreg(Node*, Node*, int);
@ -293,7 +293,7 @@ void gins(int a, Node*, Node*);
void gopcode(int, Type*, Node*, Node*); void gopcode(int, Type*, Node*, Node*);
int samaddr(Node*, Node*); int samaddr(Node*, Node*);
void gbranch(int); void gbranch(int);
void patch(Prog*, long); void patch(Prog*, int32);
int sconst(Node*); int sconst(Node*);
void gpseudo(int, Sym*, Node*); void gpseudo(int, Sym*, Node*);
@ -302,14 +302,14 @@ void gpseudo(int, Sym*, Node*);
*/ */
int swcmp(const void*, const void*); int swcmp(const void*, const void*);
void doswit(Node*); void doswit(Node*);
void swit1(C1*, int, long, Node*); void swit1(C1*, int, int32, Node*);
void cas(void); void cas(void);
void bitload(Node*, Node*, Node*, Node*, Node*); void bitload(Node*, Node*, Node*, Node*, Node*);
void bitstore(Node*, Node*, Node*, Node*, Node*); void bitstore(Node*, Node*, Node*, Node*, Node*);
long outstring(char*, long); int32 outstring(char*, int32);
void nullwarn(Node*, Node*); void nullwarn(Node*, Node*);
void sextern(Sym*, Node*, long, long); void sextern(Sym*, Node*, int32, int32);
void gextern(Sym*, Node*, long, long); void gextern(Sym*, Node*, int32, int32);
void outcode(void); void outcode(void);
void ieeedtod(Ieee*, double); void ieeedtod(Ieee*, double);
@ -334,12 +334,12 @@ void regopt(Prog*);
void addmove(Reg*, int, int, int); void addmove(Reg*, int, int, int);
Bits mkvar(Reg*, Adr*); Bits mkvar(Reg*, Adr*);
void prop(Reg*, Bits, Bits); void prop(Reg*, Bits, Bits);
void loopit(Reg*, long); void loopit(Reg*, int32);
void synch(Reg*, Bits); void synch(Reg*, Bits);
ulong allreg(ulong, Rgn*); uint32 allreg(uint32, Rgn*);
void paint1(Reg*, int); void paint1(Reg*, int);
ulong paint2(Reg*, int); uint32 paint2(Reg*, int);
void paint3(Reg*, int, long, int); void paint3(Reg*, int, int32, int);
void addreg(Adr*, int); void addreg(Adr*, int);
/* /*
@ -361,10 +361,10 @@ int copyau(Adr*, Adr*);
int copysub(Adr*, Adr*, Adr*, int); int copysub(Adr*, Adr*, Adr*, int);
int copysub1(Prog*, Adr*, Adr*, int); int copysub1(Prog*, Adr*, Adr*, int);
long RtoB(int); int32 RtoB(int);
long FtoB(int); int32 FtoB(int);
int BtoR(long); int BtoR(int32);
int BtoF(long); int BtoF(int32);
#define D_HI D_NONE #define D_HI D_NONE
#define D_LO D_NONE #define D_LO D_NONE
@ -383,8 +383,8 @@ int cond(int);
int com64(Node*); int com64(Node*);
void com64init(void); void com64init(void);
void bool64(Node*); void bool64(Node*);
long lo64v(Node*); int32 lo64v(Node*);
long hi64v(Node*); int32 hi64v(Node*);
Node* lo64(Node*); Node* lo64(Node*);
Node* hi64(Node*); Node* hi64(Node*);
@ -393,8 +393,8 @@ Node* hi64(Node*);
*/ */
void sdivgen(Node*, Node*, Node*, Node*); void sdivgen(Node*, Node*, Node*, Node*);
void udivgen(Node*, Node*, Node*, Node*); void udivgen(Node*, Node*, Node*, Node*);
void sdiv2(long, int, Node*, Node*); void sdiv2(int32, int, Node*, Node*);
void smod2(long, int, Node*, Node*); void smod2(int32, int, Node*, Node*);
void mulgen(Type*, Node*, Node*); void mulgen(Type*, Node*, Node*);
void genmuladd(Node*, Node*, int, Node*); void genmuladd(Node*, Node*, int, Node*);
void shiftit(Type*, Node*, Node*); void shiftit(Type*, Node*, Node*);

View File

@ -40,7 +40,7 @@ struct Malg
struct Mparam struct Mparam
{ {
ulong value; uint32 value;
char alg; char alg;
char neg; char neg;
char shift; char shift;
@ -64,10 +64,10 @@ static Malg malgs[] =
* return position of lowest 1 * return position of lowest 1
*/ */
int int
lowbit(ulong v) lowbit(uint32 v)
{ {
int s, i; int s, i;
ulong m; uint32 m;
s = 0; s = 0;
m = 0xFFFFFFFFUL; m = 0xFFFFFFFFUL;
@ -97,13 +97,13 @@ genmuladd(Node *d, Node *s, int m, Node *a)
} }
void void
mulparam(ulong m, Mparam *mp) mulparam(uint32 m, Mparam *mp)
{ {
int c, i, j, n, o, q, s; int c, i, j, n, o, q, s;
int bc, bi, bn, bo, bq, bs, bt; int bc, bi, bn, bo, bq, bs, bt;
char *p; char *p;
long u; int32 u;
ulong t; uint32 t;
bc = bq = 10; bc = bq = 10;
bi = bn = bo = bs = bt = 0; bi = bn = bo = bs = bt = 0;
@ -122,7 +122,7 @@ mulparam(ulong m, Mparam *mp)
u = -u; u = -u;
} }
n = lowbit(u); n = lowbit(u);
t = (ulong)u >> n; t = (uint32)u >> n;
switch(i) { switch(i) {
case 0: case 0:
if(t == 1) { if(t == 1) {
@ -321,9 +321,9 @@ m2(int a)
void void
shiftit(Type *t, Node *s, Node *d) shiftit(Type *t, Node *s, Node *d)
{ {
long c; int32 c;
c = (long)s->vconst & 31; c = (int32)s->vconst & 31;
switch(c) { switch(c) {
case 0: case 0:
break; break;
@ -336,7 +336,7 @@ shiftit(Type *t, Node *s, Node *d)
} }
static int static int
mulgen1(ulong v, Node *n) mulgen1(uint32 v, Node *n)
{ {
int i, o; int i, o;
Mparam *p; Mparam *p;

View File

@ -34,7 +34,7 @@ vlong
argsize(void) argsize(void)
{ {
Type *t; Type *t;
long s; int32 s;
//print("t=%T\n", thisfn); //print("t=%T\n", thisfn);
s = 0; s = 0;
@ -125,7 +125,7 @@ void
supgen(Node *n) supgen(Node *n)
{ {
int owarn; int owarn;
long spc; int32 spc;
Prog *sp; Prog *sp;
if(n == Z) if(n == Z)
@ -149,7 +149,7 @@ gen(Node *n)
Node *l, nod; Node *l, nod;
Prog *sp, *spc, *spb; Prog *sp, *spc, *spb;
Case *cn; Case *cn;
long sbc, scc; int32 sbc, scc;
int snbreak, sncontin; int snbreak, sncontin;
int f, o, oldreach; int f, o, oldreach;

View File

@ -47,7 +47,7 @@ doswit(Node *n)
{ {
Case *c; Case *c;
C1 *q, *iq; C1 *q, *iq;
long def, nc, i, isv; int32 def, nc, i, isv;
def = 0; def = 0;
nc = 0; nc = 0;
@ -74,7 +74,7 @@ doswit(Node *n)
if(isv) if(isv)
q->val = c->val; q->val = c->val;
else else
q->val = (long)c->val; /* cast ensures correct value for 32-bit switch on 64-bit architecture */ q->val = (int32)c->val; /* cast ensures correct value for 32-bit switch on 64-bit architecture */
q++; q++;
} }
qsort(iq, nc, sizeof(C1), swcmp); qsort(iq, nc, sizeof(C1), swcmp);
@ -101,12 +101,12 @@ cas(void)
cases = c; cases = c;
} }
long int32
outlstring(ushort *s, long n) outlstring(ushort *s, int32 n)
{ {
char buf[2]; char buf[2];
int c; int c;
long r; int32 r;
if(suppress) if(suppress)
return nstring; return nstring;
@ -164,5 +164,5 @@ ieeedtod(Ieee *ieee, double native)
fr = modf(fr*f, &ho); fr = modf(fr*f, &ho);
ieee->l = ho; ieee->l = ho;
ieee->l <<= 16; ieee->l <<= 16;
ieee->l |= (long)(fr*f); ieee->l |= (int32)(fr*f);
} }

View File

@ -66,13 +66,13 @@ regopt(Prog *p)
Reg *r, *r1, *r2; Reg *r, *r1, *r2;
Prog *p1; Prog *p1;
int i, z; int i, z;
long initpc, val, npc; int32 initpc, val, npc;
ulong vreg; uint32 vreg;
Bits bit; Bits bit;
struct struct
{ {
long m; int32 m;
long c; int32 c;
Reg* p; Reg* p;
} log5[6], *lp; } log5[6], *lp;
@ -721,10 +721,10 @@ addmove(Reg *r, int bn, int rn, int f)
print("%P\t.a%P\n", p, p1); print("%P\t.a%P\n", p, p1);
} }
ulong uint32
doregbits(int r) doregbits(int r)
{ {
ulong b; uint32 b;
b = 0; b = 0;
if(r >= D_INDIR) if(r >= D_INDIR)
@ -748,7 +748,7 @@ mkvar(Reg *r, Adr *a)
{ {
Var *v; Var *v;
int i, t, n, et, z; int i, t, n, et, z;
long o; int32 o;
Bits bit; Bits bit;
Sym *s; Sym *s;
@ -894,8 +894,8 @@ prop(Reg *r, Bits ref, Bits cal)
* such a node is a loop head. * such a node is a loop head.
* recursively, all preds with a greater rpo number are in the loop * recursively, all preds with a greater rpo number are in the loop
*/ */
long int32
postorder(Reg *r, Reg **rpo2r, long n) postorder(Reg *r, Reg **rpo2r, int32 n)
{ {
Reg *r1; Reg *r1;
@ -911,10 +911,10 @@ postorder(Reg *r, Reg **rpo2r, long n)
return n; return n;
} }
long int32
rpolca(long *idom, long rpo1, long rpo2) rpolca(int32 *idom, int32 rpo1, int32 rpo2)
{ {
long t; int32 t;
if(rpo1 == -1) if(rpo1 == -1)
return rpo2; return rpo2;
@ -935,7 +935,7 @@ rpolca(long *idom, long rpo1, long rpo2)
} }
int int
doms(long *idom, long r, long s) doms(int32 *idom, int32 r, int32 s)
{ {
while(s > r) while(s > r)
s = idom[s]; s = idom[s];
@ -943,9 +943,9 @@ doms(long *idom, long r, long s)
} }
int int
loophead(long *idom, Reg *r) loophead(int32 *idom, Reg *r)
{ {
long src; int32 src;
src = r->rpo; src = r->rpo;
if(r->p1 != R && doms(idom, src, r->p1->rpo)) if(r->p1 != R && doms(idom, src, r->p1->rpo))
@ -957,7 +957,7 @@ loophead(long *idom, Reg *r)
} }
void void
loopmark(Reg **rpo2r, long head, Reg *r) loopmark(Reg **rpo2r, int32 head, Reg *r)
{ {
if(r->rpo < head || r->active == head) if(r->rpo < head || r->active == head)
return; return;
@ -970,14 +970,14 @@ loopmark(Reg **rpo2r, long head, Reg *r)
} }
void void
loopit(Reg *r, long nr) loopit(Reg *r, int32 nr)
{ {
Reg *r1; Reg *r1;
long i, d, me; int32 i, d, me;
if(nr > maxnr) { if(nr > maxnr) {
rpo2r = alloc(nr * sizeof(Reg*)); rpo2r = alloc(nr * sizeof(Reg*));
idom = alloc(nr * sizeof(long)); idom = alloc(nr * sizeof(int32));
maxnr = nr; maxnr = nr;
} }
@ -1040,8 +1040,8 @@ synch(Reg *r, Bits dif)
} }
} }
ulong uint32
allreg(ulong b, Rgn *r) allreg(uint32 b, Rgn *r)
{ {
Var *v; Var *v;
int i; int i;
@ -1091,7 +1091,7 @@ paint1(Reg *r, int bn)
Reg *r1; Reg *r1;
Prog *p; Prog *p;
int z; int z;
ulong bb; uint32 bb;
z = bn/32; z = bn/32;
bb = 1L<<(bn%32); bb = 1L<<(bn%32);
@ -1162,10 +1162,10 @@ paint1(Reg *r, int bn)
} }
} }
ulong uint32
regset(Reg *r, ulong bb) regset(Reg *r, uint32 bb)
{ {
ulong b, set; uint32 b, set;
Adr v; Adr v;
int c; int c;
@ -1183,10 +1183,10 @@ regset(Reg *r, ulong bb)
return set; return set;
} }
ulong uint32
reguse(Reg *r, ulong bb) reguse(Reg *r, uint32 bb)
{ {
ulong b, set; uint32 b, set;
Adr v; Adr v;
int c; int c;
@ -1202,12 +1202,12 @@ reguse(Reg *r, ulong bb)
return set; return set;
} }
ulong uint32
paint2(Reg *r, int bn) paint2(Reg *r, int bn)
{ {
Reg *r1; Reg *r1;
int z; int z;
ulong bb, vreg, x; uint32 bb, vreg, x;
z = bn/32; z = bn/32;
bb = 1L << (bn%32); bb = 1L << (bn%32);
@ -1263,12 +1263,12 @@ paint2(Reg *r, int bn)
} }
void void
paint3(Reg *r, int bn, long rb, int rn) paint3(Reg *r, int bn, int32 rb, int rn)
{ {
Reg *r1; Reg *r1;
Prog *p; Prog *p;
int z; int z;
ulong bb; uint32 bb;
z = bn/32; z = bn/32;
bb = 1L << (bn%32); bb = 1L << (bn%32);
@ -1342,7 +1342,7 @@ addreg(Adr *a, int rn)
a->type = rn; a->type = rn;
} }
long int32
RtoB(int r) RtoB(int r)
{ {
@ -1352,7 +1352,7 @@ RtoB(int r)
} }
int int
BtoR(long b) BtoR(int32 b)
{ {
b &= 0xffffL; b &= 0xffffL;
@ -1367,7 +1367,7 @@ BtoR(long b)
* 17 X6 * 17 X6
* 18 X7 * 18 X7
*/ */
long int32
FtoB(int f) FtoB(int f)
{ {
if(f < FREGMIN || f > FREGEXT) if(f < FREGMIN || f > FREGEXT)
@ -1376,7 +1376,7 @@ FtoB(int f)
} }
int int
BtoF(long b) BtoF(int32 b)
{ {
b &= 0x70000L; b &= 0x70000L;

View File

@ -31,7 +31,7 @@
#include "gc.h" #include "gc.h"
void void
swit1(C1 *q, int nc, long def, Node *n) swit1(C1 *q, int nc, int32 def, Node *n)
{ {
C1 *r; C1 *r;
int i; int i;
@ -70,7 +70,7 @@ void
bitload(Node *b, Node *n1, Node *n2, Node *n3, Node *nn) bitload(Node *b, Node *n1, Node *n2, Node *n3, Node *nn)
{ {
int sh; int sh;
long v; int32 v;
Node *l; Node *l;
/* /*
@ -108,7 +108,7 @@ bitload(Node *b, Node *n1, Node *n2, Node *n3, Node *nn)
void void
bitstore(Node *b, Node *n1, Node *n2, Node *n3, Node *nn) bitstore(Node *b, Node *n1, Node *n2, Node *n3, Node *nn)
{ {
long v; int32 v;
Node nod; Node nod;
int sh; int sh;
@ -132,10 +132,10 @@ bitstore(Node *b, Node *n1, Node *n2, Node *n3, Node *nn)
regfree(n3); regfree(n3);
} }
long int32
outstring(char *s, long n) outstring(char *s, int32 n)
{ {
long r; int32 r;
if(suppress) if(suppress)
return nstring; return nstring;
@ -158,9 +158,9 @@ outstring(char *s, long n)
} }
void void
sextern(Sym *s, Node *a, long o, long w) sextern(Sym *s, Node *a, int32 o, int32 w)
{ {
long e, lw; int32 e, lw;
for(e=0; e<w; e+=NSNAME) { for(e=0; e<w; e+=NSNAME) {
lw = NSNAME; lw = NSNAME;
@ -175,7 +175,7 @@ sextern(Sym *s, Node *a, long o, long w)
} }
void void
gextern(Sym *s, Node *a, long o, long w) gextern(Sym *s, Node *a, int32 o, int32 w)
{ {
if(0 && a->op == OCONST && typev[a->type->etype]) { if(0 && a->op == OCONST && typev[a->type->etype]) {
gpseudo(ADATA, s, lo64(a)); gpseudo(ADATA, s, lo64(a));
@ -382,7 +382,7 @@ void
zname(Biobuf *b, Sym *s, int t) zname(Biobuf *b, Sym *s, int t)
{ {
char *n; char *n;
ulong sig; uint32 sig;
if(debug['T'] && t == D_EXTERN && s->sig != SIGDONE && s->type != types[TENUM] && s != symrathole){ if(debug['T'] && t == D_EXTERN && s->sig != SIGDONE && s->type != types[TENUM] && s != symrathole){
sig = sign(s); sig = sign(s);
@ -411,7 +411,7 @@ zname(Biobuf *b, Sym *s, int t)
void void
zaddr(Biobuf *b, Adr *a, int s) zaddr(Biobuf *b, Adr *a, int s)
{ {
long l; int32 l;
int i, t; int i, t;
char *n; char *n;
Ieee e; Ieee e;
@ -488,10 +488,10 @@ zaddr(Biobuf *b, Adr *a, int s)
Bputc(b, a->type); Bputc(b, a->type);
} }
long int32
align(long i, Type *t, int op) align(int32 i, Type *t, int op)
{ {
long o; int32 o;
Type *v; Type *v;
int w; int w;
@ -556,8 +556,8 @@ align(long i, Type *t, int op)
return o; return o;
} }
long int32
maxround(long max, long v) maxround(int32 max, int32 v)
{ {
v += SZ_VLONG-1; v += SZ_VLONG-1;
if(v > max) if(v > max)

View File

@ -186,7 +186,7 @@ nextpc(void)
void void
gargs(Node *n, Node *tn1, Node *tn2) gargs(Node *n, Node *tn1, Node *tn2)
{ {
long regs; int32 regs;
Node fnxargs[20], *fnxp; Node fnxargs[20], *fnxp;
regs = cursafe; regs = cursafe;
@ -276,13 +276,13 @@ Node*
nodgconst(vlong v, Type *t) nodgconst(vlong v, Type *t)
{ {
if(!typev[t->etype]) if(!typev[t->etype])
return nodconst((long)v); return nodconst((int32)v);
vconstnode.vconst = v; vconstnode.vconst = v;
return &vconstnode; return &vconstnode;
} }
Node* Node*
nodconst(long v) nodconst(int32 v)
{ {
constnode.vconst = v; constnode.vconst = v;
return &constnode; return &constnode;
@ -475,7 +475,7 @@ regind(Node *n, Node *nn)
void void
naddr(Node *n, Adr *a) naddr(Node *n, Adr *a)
{ {
long v; int32 v;
a->type = D_NONE; a->type = D_NONE;
if(n == Z) if(n == Z)
@ -1031,7 +1031,7 @@ gmove(Node *f, Node *t)
return; return;
/* /*
* ulong to float * uvlong to float
*/ */
case CASE( TUVLONG, TDOUBLE): case CASE( TUVLONG, TDOUBLE):
case CASE( TUVLONG, TFLOAT): case CASE( TUVLONG, TFLOAT):
@ -1143,7 +1143,7 @@ void
doindex(Node *n) doindex(Node *n)
{ {
Node nod, nod1; Node nod, nod1;
long v; int32 v;
if(debug['Y']) if(debug['Y'])
prtree(n, "index"); prtree(n, "index");
@ -1447,7 +1447,7 @@ gbranch(int o)
} }
void void
patch(Prog *op, long pc) patch(Prog *op, int32 pc)
{ {
op->to.offset = pc; op->to.offset = pc;
@ -1473,7 +1473,7 @@ gpseudo(int a, Sym *s, Node *n)
int int
sconst(Node *n) sconst(Node *n)
{ {
long v; int32 v;
if(n->op == OCONST && !typefd[n->type->etype]) { if(n->op == OCONST && !typefd[n->type->etype]) {
v = n->vconst; v = n->vconst;
@ -1483,10 +1483,10 @@ sconst(Node *n)
return 0; return 0;
} }
long int32
exreg(Type *t) exreg(Type *t)
{ {
long o; int32 o;
if(typechlpv[t->etype]) { if(typechlpv[t->etype]) {
if(exregoffset <= REGEXT-4) if(exregoffset <= REGEXT-4)
@ -1521,7 +1521,7 @@ schar ewidth[NTYPE] =
-1, /*[TUNION]*/ -1, /*[TUNION]*/
SZ_INT, /*[TENUM]*/ SZ_INT, /*[TENUM]*/
}; };
long ncast[NTYPE] = int32 ncast[NTYPE] =
{ {
0, /*[TXXX]*/ 0, /*[TXXX]*/
BCHAR|BUCHAR, /*[TCHAR]*/ BCHAR|BUCHAR, /*[TCHAR]*/

View File

@ -24,7 +24,7 @@ static int wmax = 8; // max rounding
/* /*
* additionally, go declares several platform-specific type aliases: * additionally, go declares several platform-specific type aliases:
* ushort, short, uint, int, ulong, long, float, and double. The bit * ushort, short, uint, int, uint32, int32, float, and double. The bit
*/ */
static char* static char*
typedefs[] = typedefs[] =
@ -47,8 +47,8 @@ typedefs[] =
}; };
ulong uint32
rnd(ulong o, ulong r) rnd(uint32 o, uint32 r)
{ {
if(r > wmax) if(r > wmax)
r = wmax; r = wmax;
@ -62,7 +62,7 @@ void
offmod(Type *t) offmod(Type *t)
{ {
Type *f; Type *f;
long o; int32 o;
o = 0; o = 0;
for(f=t->type; f!=T; f=f->down) { for(f=t->type; f!=T; f=f->down) {
@ -75,11 +75,11 @@ offmod(Type *t)
} }
} }
ulong uint32
widstruct(Type *t, ulong o, int flag) widstruct(Type *t, uint32 o, int flag)
{ {
Type *f; Type *f;
long w; int32 w;
for(f=t->type; f!=T; f=f->down) { for(f=t->type; f!=T; f=f->down) {
if(f->etype != TFIELD) if(f->etype != TFIELD)
@ -100,7 +100,7 @@ widstruct(Type *t, ulong o, int flag)
void void
dowidth(Type *t) dowidth(Type *t)
{ {
ulong w; uint32 w;
w = 0; w = 0;
if(t == T) if(t == T)

View File

@ -244,7 +244,7 @@ agen(Node *n, Node *res)
{ {
Node *nl, *nr; Node *nl, *nr;
Node n1, n2, n3, tmp; Node n1, n2, n3, tmp;
ulong w; uint32 w;
Type *t; Type *t;
if(debug['g']) { if(debug['g']) {
@ -576,10 +576,10 @@ ret:
} }
void void
sgen(Node *n, Node *ns, ulong w) sgen(Node *n, Node *ns, uint32 w)
{ {
Node nodl, nodr; Node nodl, nodr;
long c; int32 c;
if(debug['g']) { if(debug['g']) {
dump("\nsgen-res", ns); dump("\nsgen-res", ns);

View File

@ -22,7 +22,7 @@ compile(Node *fn)
Plist *pl; Plist *pl;
Node nod1; Node nod1;
Prog *ptxt; Prog *ptxt;
long lno; int32 lno;
if(newproc == N) { if(newproc == N) {
newproc = nod(ONAME, N, N); newproc = nod(ONAME, N, N);
@ -90,7 +90,7 @@ allocparams(void)
Iter list; Iter list;
Type *t; Type *t;
Node *n; Node *n;
ulong w; uint32 w;
/* /*
* allocate (set xoffset) the stack * allocate (set xoffset) the stack
@ -120,7 +120,7 @@ allocparams(void)
void void
gen(Node *n) gen(Node *n)
{ {
long lno; int32 lno;
Prog *scontin, *sbreak; Prog *scontin, *sbreak;
Prog *p1, *p2, *p3; Prog *p1, *p2, *p3;
Sym *s; Sym *s;
@ -305,7 +305,7 @@ agen_inter(Node *n, Node *res)
Node nodo, nodr, nodt; Node nodo, nodr, nodt;
Sym *s; Sym *s;
char *e; char *e;
long o,lno; int32 o,lno;
lno = setlineno(n); lno = setlineno(n);
@ -420,7 +420,7 @@ swgen(Node *n)
Node n1, tmp; Node n1, tmp;
Case *s0, *se, *s; Case *s0, *se, *s;
Prog *p1, *dflt; Prog *p1, *dflt;
long lno; int32 lno;
int any; int any;
Iter save1, save2; Iter save1, save2;
@ -791,7 +791,7 @@ cgen_asop(Node *n)
{ {
Node n1, n2, n3, n4; Node n1, n2, n3, n4;
Node *nl, *nr; Node *nl, *nr;
long lno; int32 lno;
nl = n->left; nl = n->left;
nr = n->right; nr = n->right;
@ -837,7 +837,7 @@ cgen_as(Node *nl, Node *nr, int op)
{ {
Node nc, n1; Node nc, n1;
Type *tl; Type *tl;
ulong w, c; uint32 w, c;
if(nl == N) if(nl == N)
return; return;

View File

@ -34,8 +34,8 @@ struct Addr
struct Prog struct Prog
{ {
short as; // opcode short as; // opcode
ulong loc; // pc offset in this func uint32 loc; // pc offset in this func
ulong lineno; // source line that generated this uint32 lineno; // source line that generated this
Addr from; // src address Addr from; // src address
Addr to; // dst address Addr to; // dst address
Prog* link; // next instruction in this func Prog* link; // next instruction in this func
@ -57,8 +57,8 @@ struct Sig
{ {
char* name; char* name;
Sym* sym; Sym* sym;
ulong hash; uint32 hash;
long offset; int32 offset;
Sig* link; Sig* link;
}; };
@ -87,14 +87,14 @@ EXTERN Plist* plast;
EXTERN Pool* poolist; EXTERN Pool* poolist;
EXTERN Pool* poolast; EXTERN Pool* poolast;
EXTERN Biobuf* bout; EXTERN Biobuf* bout;
EXTERN long dynloc; EXTERN int32 dynloc;
EXTERN uchar reg[D_NONE]; EXTERN uchar reg[D_NONE];
EXTERN ushort txt[NTYPE*NTYPE]; EXTERN ushort txt[NTYPE*NTYPE];
EXTERN long maxround; EXTERN int32 maxround;
EXTERN long widthptr; EXTERN int32 widthptr;
EXTERN Sym* symstringo; // string objects EXTERN Sym* symstringo; // string objects
EXTERN long stringo; // size of string objects EXTERN int32 stringo; // size of string objects
EXTERN long pcloc; // instruction counter EXTERN int32 pcloc; // instruction counter
EXTERN String emptystring; EXTERN String emptystring;
extern char* anames[]; extern char* anames[];
EXTERN Hist* hist; EXTERN Hist* hist;
@ -134,7 +134,7 @@ void agen(Node*, Node*);
void igen(Node*, Node*, Node*); void igen(Node*, Node*, Node*);
vlong fieldoffset(Type*, Node*); vlong fieldoffset(Type*, Node*);
void bgen(Node*, int, Prog*); void bgen(Node*, int, Prog*);
void sgen(Node*, Node*, ulong); void sgen(Node*, Node*, uint32);
void gmove(Node*, Node*); void gmove(Node*, Node*);
Prog* gins(int, Node*, Node*); Prog* gins(int, Node*, Node*);
int samaddr(Node*, Node*); int samaddr(Node*, Node*);
@ -205,4 +205,4 @@ void outhist(Biobuf*);
* align * align
*/ */
void dowidth(Type*); void dowidth(Type*);
ulong rnd(ulong, ulong); uint32 rnd(uint32, uint32);

View File

@ -759,7 +759,7 @@ gmove(Node *f, Node *t)
return; return;
/* /*
* ulong to float * uvlong to float
*/ */
case CASE(TUINT64, TFLOAT64): case CASE(TUINT64, TFLOAT64):
case CASE(TUINT64, TFLOAT32): case CASE(TUINT64, TFLOAT32):
@ -972,7 +972,7 @@ Prog*
gins(int as, Node *f, Node *t) gins(int as, Node *f, Node *t)
{ {
// Node nod; // Node nod;
// long v; // int32 v;
Prog *p; Prog *p;
// if(f != N && f->op == OINDEX) { // if(f != N && f->op == OINDEX) {
@ -1660,7 +1660,7 @@ void
tempname(Node *n, Type *t) tempname(Node *n, Type *t)
{ {
Sym *s; Sym *s;
ulong w; uint32 w;
if(t == T) { if(t == T) {
yyerror("tempname called with nil type"); yyerror("tempname called with nil type");
@ -1785,7 +1785,7 @@ void
setmaxarg(Type *t) setmaxarg(Type *t)
{ {
Type *to; Type *to;
long w; int32 w;
to = *getoutarg(t); to = *getoutarg(t);
w = to->width; w = to->width;

View File

@ -76,7 +76,7 @@ Dconv(Fmt *fp)
char str[40], s[20]; char str[40], s[20];
Addr *a; Addr *a;
int i; int i;
ulong d1, d2; uint32 d1, d2;
a = va_arg(fp->args, Addr*); a = va_arg(fp->args, Addr*);
i = a->type; i = a->type;

View File

@ -193,7 +193,7 @@ zname(Biobuf *b, Sym *s, int t)
void void
zaddr(Biobuf *b, Addr *a, int s) zaddr(Biobuf *b, Addr *a, int s)
{ {
long l; int32 l;
int i, t; int i, t;
char *n; char *n;
Ieee e; Ieee e;
@ -359,7 +359,7 @@ ieeedtod(Ieee *ieee, double native)
fr = modf(fr*f, &ho); fr = modf(fr*f, &ho);
ieee->l = ho; ieee->l = ho;
ieee->l <<= 16; ieee->l <<= 16;
ieee->l |= (long)(fr*f); ieee->l |= (int32)(fr*f);
} }
void void
@ -409,7 +409,7 @@ dumpstrings(void)
Pool *l; Pool *l;
Prog *p; Prog *p;
Addr ac, ao; Addr ac, ao;
long wi; int32 wi;
if(poolist == nil) if(poolist == nil)
return; return;

View File

@ -852,8 +852,8 @@ enum
typedef struct ieee Ieee; typedef struct ieee Ieee;
struct ieee struct ieee
{ {
long l; /* contains ls-man 0xffffffff */ int32 l; /* contains ls-man 0xffffffff */
long h; /* contains sign 0x80000000 int32 h; /* contains sign 0x80000000
exp 0x7ff00000 exp 0x7ff00000
ms-man 0x000fffff */ ms-man 0x000fffff */
}; };

View File

@ -32,7 +32,7 @@
#define Dbufslop 100 #define Dbufslop 100
#define PADDR(a) ((ulong)(a) & ~0x80000000) #define PADDR(a) ((uint32)(a) & ~0x80000000)
vlong vlong
entryvalue(void) entryvalue(void)
@ -73,7 +73,7 @@ wput(ushort w)
} }
void void
lput(long l) lput(int32 l)
{ {
cput(l>>24); cput(l>>24);
cput(l>>16); cput(l>>16);
@ -89,7 +89,7 @@ llput(vlong v)
} }
void void
lputl(long l) lputl(int32 l)
{ {
cput(l); cput(l);
cput(l>>8); cput(l>>8);
@ -120,7 +120,7 @@ void
asmb(void) asmb(void)
{ {
Prog *p; Prog *p;
long v, magic; int32 v, magic;
int a; int a;
uchar *op1; uchar *op1;
vlong vl, va, fo, w; vlong vl, va, fo, w;
@ -595,11 +595,11 @@ outa(int n, uchar *cast, uchar *map, vlong l)
} }
void void
datblk(long s, long n) datblk(int32 s, int32 n)
{ {
Prog *p; Prog *p;
uchar *cast; uchar *cast;
long l, fl, j; int32 l, fl, j;
vlong o; vlong o;
int i, c; int i, c;
@ -747,7 +747,7 @@ vputl(vlong v)
void void
machseg(char *name, vlong vaddr, vlong vsize, vlong foff, vlong fsize, machseg(char *name, vlong vaddr, vlong vsize, vlong foff, vlong fsize,
ulong prot1, ulong prot2, ulong nsect, ulong flag) uint32 prot1, uint32 prot2, uint32 nsect, uint32 flag)
{ {
lputl(25); /* segment 64 */ lputl(25); /* segment 64 */
lputl(72 + 80*nsect); lputl(72 + 80*nsect);
@ -763,7 +763,7 @@ machseg(char *name, vlong vaddr, vlong vsize, vlong foff, vlong fsize,
} }
void void
machsymseg(ulong foffset, ulong fsize) machsymseg(uint32 foffset, uint32 fsize)
{ {
lputl(3); /* obsolete gdb debug info */ lputl(3); /* obsolete gdb debug info */
lputl(16); /* size of symseg command */ lputl(16); /* size of symseg command */
@ -772,8 +772,8 @@ machsymseg(ulong foffset, ulong fsize)
} }
void void
machsect(char *name, char *seg, vlong addr, vlong size, ulong off, machsect(char *name, char *seg, vlong addr, vlong size, uint32 off,
ulong align, ulong reloc, ulong nreloc, ulong flag) uint32 align, uint32 reloc, uint32 nreloc, uint32 flag)
{ {
strnput(name, 16); strnput(name, 16);
strnput(seg, 16); strnput(seg, 16);
@ -807,10 +807,10 @@ machstack(vlong e)
lputl(0); lputl(0);
} }
ulong uint32
machheadr(void) machheadr(void)
{ {
ulong a; uint32 a;
a = 8; /* a.out header */ a = 8; /* a.out header */
a += 18; /* page zero seg */ a += 18; /* page zero seg */
@ -828,10 +828,10 @@ machheadr(void)
return a*4; return a*4;
} }
ulong uint32
linuxheadr(void) linuxheadr(void)
{ {
ulong a; uint32 a;
a = 64; /* a.out header */ a = 64; /* a.out header */
@ -870,8 +870,8 @@ linuxphdr(int type, int flags, vlong foff,
} }
void void
linuxshdr(char *name, ulong type, vlong flags, vlong addr, vlong off, linuxshdr(char *name, uint32 type, vlong flags, vlong addr, vlong off,
vlong size, ulong link, ulong info, vlong align, vlong entsize) vlong size, uint32 link, uint32 info, vlong align, vlong entsize)
{ {
lputl(stroffset); lputl(stroffset);
lputl(type); lputl(type);

View File

@ -88,7 +88,7 @@ struct Prog
Prog* link; Prog* link;
Prog* pcond; /* work on this */ Prog* pcond; /* work on this */
vlong pc; vlong pc;
long line; int32 line;
uchar mark; /* work on these */ uchar mark; /* work on these */
uchar back; uchar back;
@ -100,7 +100,7 @@ struct Auto
{ {
Sym* asym; Sym* asym;
Auto* link; Auto* link;
long aoffset; int32 aoffset;
short type; short type;
}; };
struct Sym struct Sym
@ -113,7 +113,7 @@ struct Sym
uchar subtype; uchar subtype;
ushort file; ushort file;
vlong value; vlong value;
long sig; int32 sig;
Sym* link; Sym* link;
}; };
struct Optab struct Optab
@ -274,14 +274,14 @@ EXTERN union
#pragma varargck type "R" int #pragma varargck type "R" int
#pragma varargck type "S" char* #pragma varargck type "S" char*
EXTERN long HEADR; EXTERN int32 HEADR;
EXTERN long HEADTYPE; EXTERN int32 HEADTYPE;
EXTERN vlong INITDAT; EXTERN vlong INITDAT;
EXTERN long INITRND; EXTERN int32 INITRND;
EXTERN vlong INITTEXT; EXTERN vlong INITTEXT;
EXTERN char* INITENTRY; /* entry point */ EXTERN char* INITENTRY; /* entry point */
EXTERN Biobuf bso; EXTERN Biobuf bso;
EXTERN long bsssize; EXTERN int32 bsssize;
EXTERN int cbc; EXTERN int cbc;
EXTERN char* cbp; EXTERN char* cbp;
EXTERN char* pcstr; EXTERN char* pcstr;
@ -319,19 +319,19 @@ EXTERN uchar and[30];
EXTERN int reg[D_NONE]; EXTERN int reg[D_NONE];
EXTERN int regrex[D_NONE+1]; EXTERN int regrex[D_NONE+1];
EXTERN Prog* lastp; EXTERN Prog* lastp;
EXTERN long lcsize; EXTERN int32 lcsize;
EXTERN int nerrors; EXTERN int nerrors;
EXTERN long nhunk; EXTERN int32 nhunk;
EXTERN long nsymbol; EXTERN int32 nsymbol;
EXTERN char* noname; EXTERN char* noname;
EXTERN char* outfile; EXTERN char* outfile;
EXTERN vlong pc; EXTERN vlong pc;
EXTERN long spsize; EXTERN int32 spsize;
EXTERN Sym* symlist; EXTERN Sym* symlist;
EXTERN long symsize; EXTERN int32 symsize;
EXTERN Prog* textp; EXTERN Prog* textp;
EXTERN vlong textsize; EXTERN vlong textsize;
EXTERN long thunk; EXTERN int32 thunk;
EXTERN int version; EXTERN int version;
EXTERN Prog zprg; EXTERN Prog zprg;
EXTERN int dtype; EXTERN int dtype;
@ -344,7 +344,7 @@ EXTERN int imports, nimports;
EXTERN int exports, nexports; EXTERN int exports, nexports;
EXTERN char* EXPTAB; EXTERN char* EXPTAB;
EXTERN Prog undefp; EXTERN Prog undefp;
EXTERN ulong stroffset; EXTERN uint32 stroffset;
EXTERN vlong textstksiz; EXTERN vlong textstksiz;
EXTERN vlong textarg; EXTERN vlong textarg;
@ -359,7 +359,7 @@ int Dconv(Fmt*);
int Pconv(Fmt*); int Pconv(Fmt*);
int Rconv(Fmt*); int Rconv(Fmt*);
int Sconv(Fmt*); int Sconv(Fmt*);
void addhist(long, int); void addhist(int32, int);
Prog* appendp(Prog*); Prog* appendp(Prog*);
void asmb(void); void asmb(void);
void asmdyn(void); void asmdyn(void);
@ -372,38 +372,38 @@ Prog* brchain(Prog*);
Prog* brloop(Prog*); Prog* brloop(Prog*);
void buildop(void); void buildop(void);
void cflush(void); void cflush(void);
void ckoff(Sym*, long); void ckoff(Sym*, int32);
Prog* copyp(Prog*); Prog* copyp(Prog*);
double cputime(void); double cputime(void);
void datblk(long, long); void datblk(int32, int32);
void diag(char*, ...); void diag(char*, ...);
void dodata(void); void dodata(void);
void doinit(void); void doinit(void);
void doprof1(void); void doprof1(void);
void doprof2(void); void doprof2(void);
void dostkoff(void); void dostkoff(void);
void dynreloc(Sym*, ulong, int); void dynreloc(Sym*, uint32, int);
vlong entryvalue(void); vlong entryvalue(void);
void errorexit(void); void errorexit(void);
void export(void); void export(void);
int find1(long, int); int find1(int32, int);
int find2(long, int); int find2(int32, int);
void follow(void); void follow(void);
void addstachmark(void); void addstachmark(void);
void gethunk(void); void gethunk(void);
void histtoauto(void); void histtoauto(void);
double ieeedtod(Ieee*); double ieeedtod(Ieee*);
long ieeedtof(Ieee*); int32 ieeedtof(Ieee*);
void import(void); void import(void);
void ldobj(int, long, char*); void ldobj(int, int32, char*);
void loadlib(void); void loadlib(void);
void listinit(void); void listinit(void);
Sym* lookup(char*, int); Sym* lookup(char*, int);
void lput(long); void lput(int32);
void lputl(long); void lputl(int32);
void main(int, char*[]); void main(int, char*[]);
void mkfwd(void); void mkfwd(void);
void* mysbrk(ulong); void* mysbrk(uint32);
void nuxiinit(void); void nuxiinit(void);
void objfile(char*); void objfile(char*);
int opsize(Prog*); int opsize(Prog*);
@ -412,7 +412,7 @@ Prog* prg(void);
void parsetextconst(vlong); void parsetextconst(vlong);
void readundefs(char*, int); void readundefs(char*, int);
int relinv(int); int relinv(int);
long reuse(Prog*, Sym*); int32 reuse(Prog*, Sym*);
vlong rnd(vlong, vlong); vlong rnd(vlong, vlong);
void span(void); void span(void);
void undef(void); void undef(void);
@ -424,18 +424,18 @@ void xfol(Prog*);
int zaddr(uchar*, Adr*, Sym*[]); int zaddr(uchar*, Adr*, Sym*[]);
void zerosig(char*); void zerosig(char*);
void machseg(char*, vlong, vlong, vlong, vlong, ulong, ulong, ulong, ulong); void machseg(char*, vlong, vlong, vlong, vlong, uint32, uint32, uint32, uint32);
void machsymseg(ulong, ulong); void machsymseg(uint32, uint32);
void machsect(char*, char*, vlong, vlong, ulong, ulong, ulong, ulong, ulong); void machsect(char*, char*, vlong, vlong, uint32, uint32, uint32, uint32, uint32);
void machstack(vlong); void machstack(vlong);
ulong machheadr(void); uint32 machheadr(void);
ulong linuxheadr(void); uint32 linuxheadr(void);
void linuxphdr(int type, int flags, vlong foff, void linuxphdr(int type, int flags, vlong foff,
vlong vaddr, vlong paddr, vlong vaddr, vlong paddr,
vlong filesize, vlong memsize, vlong align); vlong filesize, vlong memsize, vlong align);
void linuxshdr(char *name, ulong type, vlong flags, vlong addr, vlong off, void linuxshdr(char *name, uint32 type, vlong flags, vlong addr, vlong off,
vlong size, ulong link, ulong info, vlong align, vlong entsize); vlong size, uint32 link, uint32 info, vlong align, vlong entsize);
int linuxstrtable(void); int linuxstrtable(void);

View File

@ -421,7 +421,7 @@ void
loadlib(void) loadlib(void)
{ {
int i; int i;
long h; int32 h;
Sym *s; Sym *s;
loop: loop:
@ -453,7 +453,7 @@ errorexit(void)
void void
objfile(char *file) objfile(char *file)
{ {
long off, esym, cnt, l; int32 off, esym, cnt, l;
int f, work; int f, work;
Sym *s; Sym *s;
char magbuf[SARMAG]; char magbuf[SARMAG];
@ -561,7 +561,7 @@ int
zaddr(uchar *p, Adr *a, Sym *h[]) zaddr(uchar *p, Adr *a, Sym *h[])
{ {
int c, t, i; int c, t, i;
long l; int32 l;
Sym *s; Sym *s;
Auto *u; Auto *u;
@ -579,7 +579,7 @@ zaddr(uchar *p, Adr *a, Sym *h[])
if(t & T_OFFSET) { if(t & T_OFFSET) {
/* /*
* Hack until Charles fixes the compiler. * Hack until Charles fixes the compiler.
a->offset = (long)(p[c] | (p[c+1]<<8) | (p[c+2]<<16) | (p[c+3]<<24)); a->offset = (int32)(p[c] | (p[c+1]<<8) | (p[c+2]<<16) | (p[c+3]<<24));
*/ */
l = p[c] | (p[c+1]<<8) | (p[c+2]<<16) | (p[c+3]<<24); l = p[c] | (p[c+1]<<8) | (p[c+2]<<16) | (p[c+3]<<24);
a->offset = l; a->offset = l;
@ -707,7 +707,7 @@ addlib(char *obj)
} }
void void
addhist(long line, int type) addhist(int32 line, int type)
{ {
Auto *u; Auto *u;
Sym *s; Sym *s;
@ -808,14 +808,14 @@ readsome(int f, uchar *buf, uchar *good, uchar *stop, int max)
} }
void void
ldobj(int f, long c, char *pn) ldobj(int f, int32 c, char *pn)
{ {
vlong ipc; vlong ipc;
Prog *p, *t; Prog *p, *t;
uchar *bloc, *bsize, *stop; uchar *bloc, *bsize, *stop;
int v, o, r, skip, mode; int v, o, r, skip, mode;
Sym *h[NSYM], *s, *di; Sym *h[NSYM], *s, *di;
ulong sig; uint32 sig;
static int files; static int files;
static char **filen; static char **filen;
char **nfilen; char **nfilen;
@ -1230,7 +1230,7 @@ lookup(char *symb, int v)
{ {
Sym *s; Sym *s;
char *p; char *p;
long h; int32 h;
int l, c; int l, c;
h = v; h = v;
@ -1298,7 +1298,7 @@ void
doprof1(void) doprof1(void)
{ {
Sym *s; Sym *s;
long n; int32 n;
Prog *p, *q; Prog *p, *q;
if(debug['v']) if(debug['v'])
@ -1487,7 +1487,7 @@ nuxiinit(void)
} }
int int
find1(long l, int c) find1(int32 l, int c)
{ {
char *p; char *p;
int i; int i;
@ -1500,7 +1500,7 @@ find1(long l, int c)
} }
int int
find2(long l, int c) find2(int32 l, int c)
{ {
short *p; short *p;
int i; int i;
@ -1515,11 +1515,11 @@ find2(long l, int c)
return 0; return 0;
} }
long int32
ieeedtof(Ieee *e) ieeedtof(Ieee *e)
{ {
int exp; int exp;
long v; int32 v;
if(e->h == 0) if(e->h == 0)
return 0; return 0;

View File

@ -36,7 +36,7 @@ dodata(void)
int i; int i;
Sym *s; Sym *s;
Prog *p; Prog *p;
long t, u; int32 t, u;
if(debug['v']) if(debug['v'])
Bprint(&bso, "%5.2f dodata\n", cputime()); Bprint(&bso, "%5.2f dodata\n", cputime());
@ -297,7 +297,7 @@ void
markstk(Prog *l) markstk(Prog *l)
{ {
Prog *p0, *p, *q, *r; Prog *p0, *p, *q, *r;
long i, n, line; int32 i, n, line;
Sym *s; Sym *s;
version++; version++;
@ -438,10 +438,10 @@ doinit(void)
void void
patch(void) patch(void)
{ {
long c; int32 c;
Prog *p, *q; Prog *p, *q;
Sym *s; Sym *s;
long vexit; int32 vexit;
if(debug['v']) if(debug['v'])
Bprint(&bso, "%5.2f mkfwd\n", cputime()); Bprint(&bso, "%5.2f mkfwd\n", cputime());
@ -517,7 +517,7 @@ mkfwd(void)
{ {
Prog *p; Prog *p;
int i; int i;
long dwn[LOG], cnt[LOG]; int32 dwn[LOG], cnt[LOG];
Prog *lst[LOG]; Prog *lst[LOG];
for(i=0; i<LOG; i++) { for(i=0; i<LOG; i++) {
@ -566,7 +566,7 @@ void
dostkoff(void) dostkoff(void)
{ {
Prog *p, *q; Prog *p, *q;
long autoffset, deltasp; int32 autoffset, deltasp;
int a, f, curframe, curbecome, maxbecome, pcsize; int a, f, curframe, curbecome, maxbecome, pcsize;
Prog *pmorestack; Prog *pmorestack;
Sym *symmorestack; Sym *symmorestack;
@ -882,7 +882,7 @@ import(void)
} }
void void
ckoff(Sym *s, long v) ckoff(Sym *s, int32 v)
{ {
if(v < 0 || v >= 1<<Roffset) if(v < 0 || v >= 1<<Roffset)
diag("relocation offset %ld for %s out of range", v, s->name); diag("relocation offset %ld for %s out of range", v, s->name);
@ -954,13 +954,13 @@ export(void)
/* Bprint(&bso, "EXPORT: %s sig=%lux t=%d\n", s->name, s->sig, s->type); */ /* Bprint(&bso, "EXPORT: %s sig=%lux t=%d\n", s->name, s->sig, s->type); */
/* signature */ /* signature */
p = newdata(et, off, sizeof(long), D_EXTERN); p = newdata(et, off, sizeof(int32), D_EXTERN);
off += sizeof(long); off += sizeof(int32);
p->to.offset = s->sig; p->to.offset = s->sig;
/* address */ /* address */
p = newdata(et, off, sizeof(long), D_EXTERN); p = newdata(et, off, sizeof(int32), D_EXTERN);
off += sizeof(long); off += sizeof(int32);
p->to.type = D_ADDR; p->to.type = D_ADDR;
p->to.index = D_EXTERN; p->to.index = D_EXTERN;
p->to.sym = s; p->to.sym = s;
@ -982,8 +982,8 @@ export(void)
} }
/* name */ /* name */
p = newdata(et, off, sizeof(long), D_EXTERN); p = newdata(et, off, sizeof(int32), D_EXTERN);
off += sizeof(long); off += sizeof(int32);
p->to.type = D_ADDR; p->to.type = D_ADDR;
p->to.index = D_STATIC; p->to.index = D_STATIC;
p->to.sym = str; p->to.sym = str;
@ -997,8 +997,8 @@ export(void)
} }
for(i = 0; i < 3; i++){ for(i = 0; i < 3; i++){
newdata(et, off, sizeof(long), D_EXTERN); newdata(et, off, sizeof(int32), D_EXTERN);
off += sizeof(long); off += sizeof(int32);
} }
et->value = off; et->value = off;
if(sv == 0) if(sv == 0)

View File

@ -37,7 +37,7 @@ void
span(void) span(void)
{ {
Prog *p, *q; Prog *p, *q;
long v; int32 v;
vlong c, idat; vlong c, idat;
int m, n, again; int m, n, again;
@ -267,7 +267,7 @@ asmlc(void)
{ {
vlong oldpc; vlong oldpc;
Prog *p; Prog *p;
long oldlc, v, s; int32 oldlc, v, s;
oldpc = INITTEXT; oldpc = INITTEXT;
oldlc = 0; oldlc = 0;
@ -346,7 +346,7 @@ int
oclass(Adr *a) oclass(Adr *a)
{ {
vlong v; vlong v;
long l; int32 l;
if(a->type >= D_INDIR || a->index != D_NONE) { if(a->type >= D_INDIR || a->index != D_NONE) {
if(a->index != D_NONE && a->scale == 0) { if(a->index != D_NONE && a->scale == 0) {
@ -623,7 +623,7 @@ bad:
} }
static void static void
put4(long v) put4(int32 v)
{ {
if(dlm && curp != P && reloca != nil){ if(dlm && curp != P && reloca != nil){
dynreloc(reloca->sym, curp->pc + andptr - &and[0], 1); dynreloc(reloca->sym, curp->pc + andptr - &and[0], 1);
@ -692,7 +692,7 @@ vaddr(Adr *a)
static void static void
asmandsz(Adr *a, int r, int rex, int m64) asmandsz(Adr *a, int r, int rex, int m64)
{ {
long v; int32 v;
int t; int t;
Adr aa; Adr aa;
@ -1638,7 +1638,7 @@ struct Reloc
int n; int n;
int t; int t;
uchar *m; uchar *m;
ulong *a; uint32 *a;
}; };
Reloc rels; Reloc rels;
@ -1648,26 +1648,26 @@ grow(Reloc *r)
{ {
int t; int t;
uchar *m, *nm; uchar *m, *nm;
ulong *a, *na; uint32 *a, *na;
t = r->t; t = r->t;
r->t += 64; r->t += 64;
m = r->m; m = r->m;
a = r->a; a = r->a;
r->m = nm = malloc(r->t*sizeof(uchar)); r->m = nm = malloc(r->t*sizeof(uchar));
r->a = na = malloc(r->t*sizeof(ulong)); r->a = na = malloc(r->t*sizeof(uint32));
memmove(nm, m, t*sizeof(uchar)); memmove(nm, m, t*sizeof(uchar));
memmove(na, a, t*sizeof(ulong)); memmove(na, a, t*sizeof(uint32));
free(m); free(m);
free(a); free(a);
} }
void void
dynreloc(Sym *s, ulong v, int abs) dynreloc(Sym *s, uint32 v, int abs)
{ {
int i, k, n; int i, k, n;
uchar *m; uchar *m;
ulong *a; uint32 *a;
Reloc *r; Reloc *r;
if(s->type == SUNDEF) if(s->type == SUNDEF)
@ -1712,7 +1712,7 @@ asmdyn()
{ {
int i, n, t, c; int i, n, t, c;
Sym *s; Sym *s;
ulong la, ra, *a; uint32 la, ra, *a;
vlong off; vlong off;
uchar *m; uchar *m;
Reloc *r; Reloc *r;

View File

@ -124,7 +124,7 @@ acidinit(void)
} }
void void
acidmember(Type *t, long off, int flag) acidmember(Type *t, int32 off, int flag)
{ {
Sym *s, *s1; Sym *s, *s1;
Type *l; Type *l;

View File

@ -91,7 +91,7 @@ int
bnum(Bits a) bnum(Bits a)
{ {
int i; int i;
long b; int32 b;
for(i=0; i<BITS; i++) for(i=0; i<BITS; i++)
if(b = a.b[i]) if(b = a.b[i])

View File

@ -65,10 +65,10 @@ typedef struct Bits Bits;
#define MASK(n) (SIGN(n)|(SIGN(n)-1)) #define MASK(n) (SIGN(n)|(SIGN(n)-1))
#define BITS 5 #define BITS 5
#define NVAR (BITS*sizeof(ulong)*8) #define NVAR (BITS*sizeof(uint32)*8)
struct Bits struct Bits
{ {
ulong b[BITS]; uint32 b[BITS];
}; };
struct Node struct Node
@ -76,9 +76,9 @@ struct Node
Node* left; Node* left;
Node* right; Node* right;
void* label; void* label;
long pc; int32 pc;
int reg; int reg;
long xoffset; int32 xoffset;
double fconst; /* fp constant */ double fconst; /* fp constant */
vlong vconst; /* non fp const */ vlong vconst; /* non fp const */
char* cstring; /* character string */ char* cstring; /* character string */
@ -86,7 +86,7 @@ struct Node
Sym* sym; Sym* sym;
Type* type; Type* type;
long lineno; int32 lineno;
uchar op; uchar op;
uchar oldop; uchar oldop;
uchar xcast; uchar xcast;
@ -106,8 +106,8 @@ struct Sym
Type* suetag; Type* suetag;
Type* tenum; Type* tenum;
char* macro; char* macro;
long varlineno; int32 varlineno;
long offset; int32 offset;
vlong vconst; vlong vconst;
double fconst; double fconst;
Node* label; Node* label;
@ -135,8 +135,8 @@ struct Decl
Decl* link; Decl* link;
Sym* sym; Sym* sym;
Type* type; Type* type;
long varlineno; int32 varlineno;
long offset; int32 offset;
short val; short val;
ushort block; ushort block;
uchar class; uchar class;
@ -151,9 +151,9 @@ struct Type
Funct* funct; Funct* funct;
Type* link; Type* link;
Type* down; Type* down;
long width; int32 width;
long offset; int32 offset;
long lineno; int32 lineno;
uchar shift; uchar shift;
uchar nbits; uchar nbits;
uchar etype; uchar etype;
@ -166,7 +166,7 @@ struct Type
struct Init /* general purpose initialization */ struct Init /* general purpose initialization */
{ {
int code; int code;
ulong value; uint32 value;
char* s; char* s;
}; };
@ -190,8 +190,8 @@ struct Hist
{ {
Hist* link; Hist* link;
char* name; char* name;
long line; int32 line;
long offset; int32 offset;
}; };
#define H ((Hist*)0) #define H ((Hist*)0)
EXTERN Hist* hist; EXTERN Hist* hist;
@ -445,12 +445,12 @@ EXTERN struct
} en; } en;
EXTERN int autobn; EXTERN int autobn;
EXTERN long autoffset; EXTERN int32 autoffset;
EXTERN int blockno; EXTERN int blockno;
EXTERN Decl* dclstack; EXTERN Decl* dclstack;
EXTERN char debug[256]; EXTERN char debug[256];
EXTERN Hist* ehist; EXTERN Hist* ehist;
EXTERN long firstbit; EXTERN int32 firstbit;
EXTERN Sym* firstarg; EXTERN Sym* firstarg;
EXTERN Type* firstargtype; EXTERN Type* firstargtype;
EXTERN Decl* firstdcl; EXTERN Decl* firstdcl;
@ -461,16 +461,16 @@ EXTERN char* include[20];
EXTERN Io* iofree; EXTERN Io* iofree;
EXTERN Io* ionext; EXTERN Io* ionext;
EXTERN Io* iostack; EXTERN Io* iostack;
EXTERN long lastbit; EXTERN int32 lastbit;
EXTERN char lastclass; EXTERN char lastclass;
EXTERN Type* lastdcl; EXTERN Type* lastdcl;
EXTERN long lastfield; EXTERN int32 lastfield;
EXTERN Type* lasttype; EXTERN Type* lasttype;
EXTERN long lineno; EXTERN int32 lineno;
EXTERN long nearln; EXTERN int32 nearln;
EXTERN int nerrors; EXTERN int nerrors;
EXTERN int newflag; EXTERN int newflag;
EXTERN long nhunk; EXTERN int32 nhunk;
EXTERN int ninclude; EXTERN int ninclude;
EXTERN Node* nodproto; EXTERN Node* nodproto;
EXTERN Node* nodcast; EXTERN Node* nodcast;
@ -479,7 +479,7 @@ EXTERN Biobuf diagbuf;
EXTERN char* outfile; EXTERN char* outfile;
EXTERN char* pathname; EXTERN char* pathname;
EXTERN int peekc; EXTERN int peekc;
EXTERN long stkoff; EXTERN int32 stkoff;
EXTERN Type* strf; EXTERN Type* strf;
EXTERN Type* strl; EXTERN Type* strl;
EXTERN char symb[NSYMB]; EXTERN char symb[NSYMB];
@ -490,7 +490,7 @@ EXTERN Type* tufield;
EXTERN int thechar; EXTERN int thechar;
EXTERN char* thestring; EXTERN char* thestring;
EXTERN Type* thisfn; EXTERN Type* thisfn;
EXTERN long thunk; EXTERN int32 thunk;
EXTERN Type* types[NTYPE]; EXTERN Type* types[NTYPE];
EXTERN Type* fntypes[NTYPE]; EXTERN Type* fntypes[NTYPE];
EXTERN Node* initlist; EXTERN Node* initlist;
@ -508,10 +508,10 @@ extern char *onames[], *tnames[], *gnames[];
extern char *cnames[], *qnames[], *bnames[]; extern char *cnames[], *qnames[], *bnames[];
extern uchar tab[NTYPE][NTYPE]; extern uchar tab[NTYPE][NTYPE];
extern uchar comrel[], invrel[], logrel[]; extern uchar comrel[], invrel[], logrel[];
extern long ncast[], tadd[], tand[]; extern int32 ncast[], tadd[], tand[];
extern long targ[], tasadd[], tasign[], tcast[]; extern int32 targ[], tasadd[], tasign[], tcast[];
extern long tdot[], tfunct[], tindir[], tmul[]; extern int32 tdot[], tfunct[], tindir[], tmul[];
extern long tnot[], trel[], tsub[]; extern int32 tnot[], trel[], tsub[];
extern uchar typeaf[]; extern uchar typeaf[];
extern uchar typefd[]; extern uchar typefd[];
@ -533,10 +533,10 @@ extern uchar typechlpfd[];
EXTERN uchar* typeword; EXTERN uchar* typeword;
EXTERN uchar* typecmplx; EXTERN uchar* typecmplx;
extern ulong thash1; extern uint32 thash1;
extern ulong thash2; extern uint32 thash2;
extern ulong thash3; extern uint32 thash3;
extern ulong thash[]; extern uint32 thash[];
/* /*
* compat.c/unix.c/windows.c * compat.c/unix.c/windows.c
@ -551,7 +551,7 @@ int myexec(char*, char*[]);
int mydup(int, int); int mydup(int, int);
int myfork(void); int myfork(void);
int mypipe(int*); int mypipe(int*);
void* mysbrk(ulong); void* mysbrk(uint32);
/* /*
* parser * parser
@ -562,25 +562,25 @@ int mpatov(char*, vlong*);
/* /*
* lex.c * lex.c
*/ */
void* allocn(void*, long, long); void* allocn(void*, int32, int32);
void* alloc(long); void* alloc(int32);
void cinit(void); void cinit(void);
int compile(char*, char**, int); int compile(char*, char**, int);
void errorexit(void); void errorexit(void);
int filbuf(void); int filbuf(void);
int getc(void); int getc(void);
long getr(void); int32 getr(void);
int getnsc(void); int getnsc(void);
Sym* lookup(void); Sym* lookup(void);
void main(int, char*[]); void main(int, char*[]);
void newfile(char*, int); void newfile(char*, int);
void newio(void); void newio(void);
void pushio(void); void pushio(void);
long escchar(long, int, int); int32 escchar(int32, int, int);
Sym* slookup(char*); Sym* slookup(char*);
void syminit(Sym*); void syminit(Sym*);
void unget(int); void unget(int);
long yylex(void); int32 yylex(void);
int Lconv(Fmt*); int Lconv(Fmt*);
int Tconv(Fmt*); int Tconv(Fmt*);
int FNconv(Fmt*); int FNconv(Fmt*);
@ -595,7 +595,7 @@ void setinclude(char*);
void dodefine(char*); void dodefine(char*);
void domacro(void); void domacro(void);
Sym* getsym(void); Sym* getsym(void);
long getnsn(void); int32 getnsn(void);
void linehist(char*, int); void linehist(char*, int);
void macdef(void); void macdef(void);
void macprag(void); void macprag(void);
@ -609,9 +609,9 @@ void macund(void);
/* /*
* dcl.c * dcl.c
*/ */
Node* doinit(Sym*, Type*, long, Node*); Node* doinit(Sym*, Type*, int32, Node*);
Type* tcopy(Type*); Type* tcopy(Type*);
Node* init1(Sym*, Type*, long, int); Node* init1(Sym*, Type*, int32, int);
Node* newlist(Node*, Node*); Node* newlist(Node*, Node*);
void adecl(int, Type*, Sym*); void adecl(int, Type*, Sym*);
int anyproto(Node*); int anyproto(Node*);
@ -632,16 +632,16 @@ void pdecl(int, Type*, Sym*);
Decl* push(void); Decl* push(void);
Decl* push1(Sym*); Decl* push1(Sym*);
Node* revertdcl(void); Node* revertdcl(void);
long xround(long, int); int32 xround(int32, int);
int rsametype(Type*, Type*, int, int); int rsametype(Type*, Type*, int, int);
int sametype(Type*, Type*); int sametype(Type*, Type*);
ulong sign(Sym*); uint32 sign(Sym*);
ulong signature(Type*); uint32 signature(Type*);
void suallign(Type*); void suallign(Type*);
void tmerge(Type*, Sym*); void tmerge(Type*, Sym*);
void walkparam(Node*, int); void walkparam(Node*, int);
void xdecl(int, Type*, Sym*); void xdecl(int, Type*, Sym*);
Node* contig(Sym*, Node*, long); Node* contig(Sym*, Node*, int32);
/* /*
* com.c * com.c
@ -678,12 +678,12 @@ void dclfunct(Type*, Sym*);
*/ */
void arith(Node*, int); void arith(Node*, int);
int deadheads(Node*); int deadheads(Node*);
Type* dotsearch(Sym*, Type*, Node*, long*); Type* dotsearch(Sym*, Type*, Node*, int32*);
long dotoffset(Type*, Type*, Node*); int32 dotoffset(Type*, Type*, Node*);
void gethunk(void); void gethunk(void);
Node* invert(Node*); Node* invert(Node*);
int bitno(long); int bitno(int32);
void makedot(Node*, Type*, long); void makedot(Node*, Type*, int32);
int mixedasop(Type*, Type*); int mixedasop(Type*, Type*);
Node* new(int, Node*, Node*); Node* new(int, Node*, Node*);
Node* new1(int, Node*, Node*); Node* new1(int, Node*, Node*);
@ -693,12 +693,12 @@ void prtree(Node*, char*);
void prtree1(Node*, int, int); void prtree1(Node*, int, int);
void relcon(Node*, Node*); void relcon(Node*, Node*);
int relindex(int); int relindex(int);
int simpleg(long); int simpleg(int32);
Type* garbt(Type*, long); Type* garbt(Type*, int32);
int simplec(long); int simplec(int32);
Type* simplet(long); Type* simplet(int32);
int stcompat(Node*, Type*, Type*, long[]); int stcompat(Node*, Type*, Type*, int32[]);
int tcompat(Node*, Type*, Type*, long[]); int tcompat(Node*, Type*, Type*, int32[]);
void tinit(void); void tinit(void);
Type* typ(int, Type*); Type* typ(int, Type*);
Type* copytyp(Type*); Type* copytyp(Type*);
@ -708,9 +708,9 @@ int side(Node*);
int vconst(Node*); int vconst(Node*);
int xlog2(uvlong); int xlog2(uvlong);
int vlog(Node*); int vlog(Node*);
int topbit(ulong); int topbit(uint32);
void simplifyshift(Node*); void simplifyshift(Node*);
long typebitor(long, long); int32 typebitor(int32, int32);
void diag(Node*, char*, ...); void diag(Node*, char*, ...);
void warn(Node*, char*, ...); void warn(Node*, char*, ...);
void yyerror(char*, ...); void yyerror(char*, ...);
@ -755,15 +755,15 @@ void pragincomplete(void);
*/ */
void codgen(Node*, Node*); void codgen(Node*, Node*);
void gclean(void); void gclean(void);
void gextern(Sym*, Node*, long, long); void gextern(Sym*, Node*, int32, int32);
void ginit(void); void ginit(void);
long outstring(char*, long); int32 outstring(char*, int32);
long outlstring(ushort*, long); int32 outlstring(ushort*, int32);
void sextern(Sym*, Node*, long, long); void sextern(Sym*, Node*, int32, int32);
void xcom(Node*); void xcom(Node*);
long exreg(Type*); int32 exreg(Type*);
long align(long, Type*, int); int32 align(int32, Type*, int);
long maxround(long, long); int32 maxround(int32, int32);
extern schar ewidth[]; extern schar ewidth[];
@ -788,8 +788,8 @@ int machcap(Node*);
#pragma varargck argpos yyerror 1 #pragma varargck argpos yyerror 1
#pragma varargck type "F" Node* #pragma varargck type "F" Node*
#pragma varargck type "L" long #pragma varargck type "L" int32
#pragma varargck type "Q" long #pragma varargck type "Q" int32
#pragma varargck type "O" int #pragma varargck type "O" int
#pragma varargck type "T" Type* #pragma varargck type "T" Type*
#pragma varargck type "|" int #pragma varargck type "|" int

View File

@ -48,9 +48,9 @@
struct struct
{ {
char* s; char* s;
long l; int32 l;
} sval; } sval;
long lval; int32 lval;
double dval; double dval;
vlong vval; vlong vval;
} }
@ -198,7 +198,7 @@ adlist:
} }
'=' init '=' init
{ {
long w; int32 w;
w = $1->sym->type->width; w = $1->sym->type->width;
$$ = doinit($1->sym, $1->type, 0L, $4); $$ = doinit($1->sym, $1->type, 0L, $4);

View File

@ -839,7 +839,7 @@ int
tcomd(Node *n) tcomd(Node *n)
{ {
Type *t; Type *t;
long o; int32 o;
o = 0; o = 0;
t = dotsearch(n->sym, n->left->type->link, n, &o); t = dotsearch(n->sym, n->left->type->link, n, &o);

View File

@ -35,7 +35,7 @@ dodecl(void (*f)(int,Type*,Sym*), int c, Type *t, Node *n)
{ {
Sym *s; Sym *s;
Node *n1; Node *n1;
long v; int32 v;
nearln = lineno; nearln = lineno;
lastfield = 0; lastfield = 0;
@ -183,7 +183,7 @@ tcopy(Type *t)
} }
Node* Node*
doinit(Sym *s, Type *t, long o, Node *a) doinit(Sym *s, Type *t, int32 o, Node *a)
{ {
Node *n; Node *n;
@ -312,11 +312,11 @@ isstruct(Node *a, Type *t)
} }
Node* Node*
init1(Sym *s, Type *t, long o, int exflag) init1(Sym *s, Type *t, int32 o, int exflag)
{ {
Node *a, *l, *r, nod; Node *a, *l, *r, nod;
Type *t1; Type *t1;
long e, w, so, mw; int32 e, w, so, mw;
a = peekinit(); a = peekinit();
if(a == Z) if(a == Z)
@ -552,7 +552,7 @@ void
suallign(Type *t) suallign(Type *t)
{ {
Type *l; Type *l;
long o, w; int32 o, w;
o = 0; o = 0;
switch(t->etype) { switch(t->etype) {
@ -616,8 +616,8 @@ suallign(Type *t)
} }
} }
long int32
xround(long v, int w) xround(int32 v, int w)
{ {
int r; int r;
@ -1057,12 +1057,12 @@ sigind(Type *t, Typetab *tt)
return -1; return -1;
} }
static ulong static uint32
signat(Type *t, Typetab *tt) signat(Type *t, Typetab *tt)
{ {
int i; int i;
Type *t1; Type *t1;
long s; int32 s;
s = 0; s = 0;
for(; t; t=t->link) { for(; t; t=t->link) {
@ -1095,10 +1095,10 @@ signat(Type *t, Typetab *tt)
return s; return s;
} }
ulong uint32
signature(Type *t) signature(Type *t)
{ {
ulong s; uint32 s;
Typetab tt; Typetab tt;
tt.n = 0; tt.n = 0;
@ -1108,10 +1108,10 @@ signature(Type *t)
return s; return s;
} }
ulong uint32
sign(Sym *s) sign(Sym *s)
{ {
ulong v; uint32 v;
Type *t; Type *t;
if(s->sig == SIGINTERN) if(s->sig == SIGINTERN)
@ -1313,7 +1313,7 @@ pdecl(int c, Type *t, Sym *s)
void void
xdecl(int c, Type *t, Sym *s) xdecl(int c, Type *t, Sym *s)
{ {
long o; int32 o;
o = 0; o = 0;
switch(c) { switch(c) {
@ -1538,7 +1538,7 @@ doenum(Sym *s, Node *n)
} }
void void
symadjust(Sym *s, Node *n, long del) symadjust(Sym *s, Node *n, int32 del)
{ {
switch(n->op) { switch(n->op) {
@ -1564,10 +1564,10 @@ symadjust(Sym *s, Node *n, long del)
} }
Node* Node*
contig(Sym *s, Node *n, long v) contig(Sym *s, Node *n, int32 v)
{ {
Node *p, *r, *q, *m; Node *p, *r, *q, *m;
long w; int32 w;
Type *zt; Type *zt;
if(debug['i']) { if(debug['i']) {

View File

@ -394,7 +394,7 @@ Sym*
lookup(void) lookup(void)
{ {
Sym *s; Sym *s;
ulong h; uint32 h;
char *p; char *p;
int c, n; int c, n;
@ -404,7 +404,7 @@ lookup(void)
h += *p++; h += *p++;
} }
n = (p - symb) + 1; n = (p - symb) + 1;
if((long)h < 0) if((int32)h < 0)
h = ~h; h = ~h;
h %= NHASH; h %= NHASH;
c = symb[0]; c = symb[0];
@ -453,11 +453,11 @@ enum
Numflt = 1<<4, Numflt = 1<<4,
}; };
long int32
yylex(void) yylex(void)
{ {
vlong vv; vlong vv;
long c, c1, t; int32 c, c1, t;
char *cp; char *cp;
Rune rune; Rune rune;
Sym *s; Sym *s;
@ -1019,7 +1019,7 @@ getc(void)
return c; return c;
} }
long int32
getr(void) getr(void)
{ {
int c, i; int c, i;
@ -1079,10 +1079,10 @@ unget(int c)
lineno--; lineno--;
} }
long int32
escchar(long e, int longflg, int escflg) escchar(int32 e, int longflg, int escflg)
{ {
long c, l; int32 c, l;
int i; int i;
loop: loop:
@ -1335,14 +1335,14 @@ Lconv(Fmt *fp)
struct struct
{ {
Hist* incl; /* start of this include file */ Hist* incl; /* start of this include file */
long idel; /* delta line number to apply to include */ int32 idel; /* delta line number to apply to include */
Hist* line; /* start of this #line directive */ Hist* line; /* start of this #line directive */
long ldel; /* delta line number to apply to #line */ int32 ldel; /* delta line number to apply to #line */
} a[HISTSZ]; } a[HISTSZ];
long l, d; int32 l, d;
int i, n; int i, n;
l = va_arg(fp->args, long); l = va_arg(fp->args, int32);
n = 0; n = 0;
for(h = hist; h != H; h = h->link) { for(h = hist; h != H; h = h->link) {
if(l < h->line) if(l < h->line)
@ -1402,7 +1402,7 @@ Tconv(Fmt *fp)
char str[STRINGSZ+20], s[STRINGSZ+20]; char str[STRINGSZ+20], s[STRINGSZ+20];
Type *t, *t1; Type *t, *t1;
int et; int et;
long n; int32 n;
str[0] = 0; str[0] = 0;
for(t = va_arg(fp->args, Type*); t != T; t = t->link) { for(t = va_arg(fp->args, Type*); t != T; t = t->link) {
@ -1472,11 +1472,11 @@ int
Qconv(Fmt *fp) Qconv(Fmt *fp)
{ {
char str[STRINGSZ+20], *s; char str[STRINGSZ+20], *s;
long b; int32 b;
int i; int i;
str[0] = 0; str[0] = 0;
for(b = va_arg(fp->args, long); b;) { for(b = va_arg(fp->args, int32); b;) {
i = bitno(b); i = bitno(b);
if(str[0]) if(str[0])
strcat(str, " "); strcat(str, " ");

View File

@ -76,7 +76,7 @@ gethunk(void)
} }
void* void*
alloc(long n) alloc(int32 n)
{ {
void *p; void *p;
@ -93,7 +93,7 @@ alloc(long n)
} }
void* void*
allocn(void *p, long on, long n) allocn(void *p, int32 on, int32 n)
{ {
void *q; void *q;
@ -204,7 +204,7 @@ Sym*
lookup(void) lookup(void)
{ {
Sym *s; Sym *s;
long h; int32 h;
char *p; char *p;
int c, l; int c, l;
@ -242,7 +242,7 @@ ISALPHA(int c)
return 0; return 0;
} }
long int32
yylex(void) yylex(void)
{ {
int c, c1; int c, c1;
@ -665,11 +665,11 @@ yyerror(char *a, ...)
} }
void void
prfile(long l) prfile(int32 l)
{ {
int i, n; int i, n;
Hist a[HISTSZ], *h; Hist a[HISTSZ], *h;
long d; int32 d;
n = 0; n = 0;
for(h = hist; h != H; h = h->link) { for(h = hist; h != H; h = h->link) {
@ -729,5 +729,5 @@ ieeedtod(Ieee *ieee, double native)
fr = modf(fr*f, &ho); fr = modf(fr*f, &ho);
ieee->l = ho; ieee->l = ho;
ieee->l <<= 16; ieee->l <<= 16;
ieee->l |= (long)(fr*f); ieee->l |= (int32)(fr*f);
} }

View File

@ -30,10 +30,10 @@
#define VARMAC 0x80 #define VARMAC 0x80
long int32
getnsn(void) getnsn(void)
{ {
long n; int32 n;
int c; int c;
c = getnsc(); c = getnsc();
@ -138,7 +138,7 @@ dodefine(char *cp)
{ {
Sym *s; Sym *s;
char *p; char *p;
long l; int32 l;
strcpy(symb, cp); strcpy(symb, cp);
p = strchr(symb, '='); p = strchr(symb, '=');
@ -604,7 +604,7 @@ maclin(void)
{ {
char *cp; char *cp;
int c; int c;
long n; int32 n;
n = getnsn(); n = getnsn();
c = getc(); c = getc();

View File

@ -95,7 +95,7 @@ void
supgen(Node *n) supgen(Node *n)
{ {
int owarn; int owarn;
long spc; int32 spc;
Prog *sp; Prog *sp;
if(n == Z) if(n == Z)
@ -119,7 +119,7 @@ gen(Node *n)
Node *l, nod; Node *l, nod;
Prog *sp, *spc, *spb; Prog *sp, *spc, *spb;
Case *cn; Case *cn;
long sbc, scc; int32 sbc, scc;
int snbreak, sncontin; int snbreak, sncontin;
int f, o, oldreach; int f, o, oldreach;

View File

@ -125,7 +125,7 @@ pickleinit(void)
} }
void void
picklemember(Type *t, long off) picklemember(Type *t, int32 off)
{ {
Sym *s, *s1; Sym *s, *s1;
static int picklecharinit = 0; static int picklecharinit = 0;

View File

@ -47,7 +47,7 @@ doswit(Node *n)
{ {
Case *c; Case *c;
C1 *q, *iq; C1 *q, *iq;
long def, nc, i, isv; int32 def, nc, i, isv;
def = 0; def = 0;
nc = 0; nc = 0;
@ -74,7 +74,7 @@ doswit(Node *n)
if(isv) if(isv)
q->val = c->val; q->val = c->val;
else else
q->val = (long)c->val; /* cast ensures correct value for 32-bit switch on 64-bit architecture */ q->val = (int32)c->val; /* cast ensures correct value for 32-bit switch on 64-bit architecture */
q++; q++;
} }
qsort(iq, nc, sizeof(C1), swcmp); qsort(iq, nc, sizeof(C1), swcmp);
@ -101,12 +101,12 @@ cas(void)
cases = c; cases = c;
} }
long int32
outlstring(ushort *s, long n) outlstring(ushort *s, int32 n)
{ {
char buf[2]; char buf[2];
int c; int c;
long r; int32 r;
if(suppress) if(suppress)
return nstring; return nstring;
@ -164,5 +164,5 @@ ieeedtod(Ieee *ieee, double native)
fr = modf(fr*f, &ho); fr = modf(fr*f, &ho);
ieee->l = ho; ieee->l = ho;
ieee->l <<= 16; ieee->l <<= 16;
ieee->l |= (long)(fr*f); ieee->l |= (int32)(fr*f);
} }

View File

@ -174,7 +174,7 @@ copytyp(Type *t)
} }
Type* Type*
garbt(Type *t, long b) garbt(Type *t, int32 b)
{ {
Type *t1; Type *t1;
@ -187,7 +187,7 @@ garbt(Type *t, long b)
} }
int int
simpleg(long b) simpleg(int32 b)
{ {
b &= BGARB; b &= BGARB;
@ -203,7 +203,7 @@ simpleg(long b)
} }
int int
simplec(long b) simplec(int32 b)
{ {
b &= BCLASS; b &= BCLASS;
@ -230,7 +230,7 @@ simplec(long b)
} }
Type* Type*
simplet(long b) simplet(int32 b)
{ {
b &= ~BCLASS & ~BGARB; b &= ~BCLASS & ~BGARB;
@ -299,10 +299,10 @@ simplet(long b)
} }
int int
stcompat(Node *n, Type *t1, Type *t2, long ttab[]) stcompat(Node *n, Type *t1, Type *t2, int32 ttab[])
{ {
int i; int i;
ulong b; uint32 b;
i = 0; i = 0;
if(t2 != T) if(t2 != T)
@ -326,7 +326,7 @@ stcompat(Node *n, Type *t1, Type *t2, long ttab[])
} }
int int
tcompat(Node *n, Type *t1, Type *t2, long ttab[]) tcompat(Node *n, Type *t1, Type *t2, int32 ttab[])
{ {
if(stcompat(n, t1, t2, ttab)) { if(stcompat(n, t1, t2, ttab)) {
@ -342,7 +342,7 @@ tcompat(Node *n, Type *t1, Type *t2, long ttab[])
} }
void void
makedot(Node *n, Type *t, long o) makedot(Node *n, Type *t, int32 o)
{ {
Node *n1, *n2; Node *n1, *n2;
@ -389,7 +389,7 @@ makedot(Node *n, Type *t, long o)
} }
Type* Type*
dotsearch(Sym *s, Type *t, Node *n, long *off) dotsearch(Sym *s, Type *t, Node *n, int32 *off)
{ {
Type *t1, *xt, *rt; Type *t1, *xt, *rt;
@ -441,12 +441,12 @@ ambig:
return xt; return xt;
} }
long int32
dotoffset(Type *st, Type *lt, Node *n) dotoffset(Type *st, Type *lt, Node *n)
{ {
Type *t; Type *t;
Sym *g; Sym *g;
long o, o1; int32 o, o1;
o = -1; o = -1;
/* /*
@ -574,7 +574,7 @@ typeext(Type *st, Node *l)
{ {
Type *lt; Type *lt;
Node *n1, *n2; Node *n1, *n2;
long o; int32 o;
lt = l->type; lt = l->type;
if(lt == T) if(lt == T)
@ -689,7 +689,7 @@ arith(Node *n, int f)
Type *t1, *t2; Type *t1, *t2;
int i, j, k; int i, j, k;
Node *n1; Node *n1;
long w; int32 w;
t1 = n->left->type; t1 = n->left->type;
if(n->right == Z) if(n->right == Z)
@ -799,7 +799,7 @@ bad:
void void
simplifyshift(Node *n) simplifyshift(Node *n)
{ {
ulong c3; uint32 c3;
int o, s1, s2, c1, c2; int o, s1, s2, c1, c2;
if(!typechlp[n->type->etype]) if(!typechlp[n->type->etype])
@ -1078,7 +1078,7 @@ bad:
} }
int int
topbit(ulong v) topbit(uint32 v)
{ {
int i; int i;
@ -1160,7 +1160,7 @@ invert(Node *n)
} }
int int
bitno(long b) bitno(int32 b)
{ {
int i; int i;
@ -1171,10 +1171,10 @@ bitno(long b)
return 0; return 0;
} }
long int32
typebitor(long a, long b) typebitor(int32 a, int32 b)
{ {
long c; int32 c;
c = a | b; c = a | b;
if(a & b) if(a & b)
@ -1277,10 +1277,10 @@ fatal(Node *n, char *fmt, ...)
errorexit(); errorexit();
} }
ulong thash1 = 0x2edab8c9; uint32 thash1 = 0x2edab8c9;
ulong thash2 = 0x1dc74fb8; uint32 thash2 = 0x1dc74fb8;
ulong thash3 = 0x1f241331; uint32 thash3 = 0x1f241331;
ulong thash[NALLTYPES]; uint32 thash[NALLTYPES];
Init thashinit[] = Init thashinit[] =
{ {
TXXX, 0x17527bbd, 0, TXXX, 0x17527bbd, 0,
@ -1618,7 +1618,7 @@ int typesuinit[] =
TSTRUCT, TUNION, -1, TSTRUCT, TUNION, -1,
}; };
long tasign[NTYPE]; int32 tasign[NTYPE];
Init tasigninit[] = Init tasigninit[] =
{ {
TCHAR, BNUMBER, 0, TCHAR, BNUMBER, 0,
@ -1639,7 +1639,7 @@ Init tasigninit[] =
-1, 0, 0, -1, 0, 0,
}; };
long tasadd[NTYPE]; int32 tasadd[NTYPE];
Init tasaddinit[] = Init tasaddinit[] =
{ {
TCHAR, BNUMBER, 0, TCHAR, BNUMBER, 0,
@ -1658,7 +1658,7 @@ Init tasaddinit[] =
-1, 0, 0, -1, 0, 0,
}; };
long tcast[NTYPE]; int32 tcast[NTYPE];
Init tcastinit[] = Init tcastinit[] =
{ {
TCHAR, BNUMBER|BIND|BVOID, 0, TCHAR, BNUMBER|BIND|BVOID, 0,
@ -1680,7 +1680,7 @@ Init tcastinit[] =
-1, 0, 0, -1, 0, 0,
}; };
long tadd[NTYPE]; int32 tadd[NTYPE];
Init taddinit[] = Init taddinit[] =
{ {
TCHAR, BNUMBER|BIND, 0, TCHAR, BNUMBER|BIND, 0,
@ -1699,7 +1699,7 @@ Init taddinit[] =
-1, 0, 0, -1, 0, 0,
}; };
long tsub[NTYPE]; int32 tsub[NTYPE];
Init tsubinit[] = Init tsubinit[] =
{ {
TCHAR, BNUMBER, 0, TCHAR, BNUMBER, 0,
@ -1718,7 +1718,7 @@ Init tsubinit[] =
-1, 0, 0, -1, 0, 0,
}; };
long tmul[NTYPE]; int32 tmul[NTYPE];
Init tmulinit[] = Init tmulinit[] =
{ {
TCHAR, BNUMBER, 0, TCHAR, BNUMBER, 0,
@ -1736,7 +1736,7 @@ Init tmulinit[] =
-1, 0, 0, -1, 0, 0,
}; };
long tand[NTYPE]; int32 tand[NTYPE];
Init tandinit[] = Init tandinit[] =
{ {
TCHAR, BINTEGER, 0, TCHAR, BINTEGER, 0,
@ -1752,7 +1752,7 @@ Init tandinit[] =
-1, 0, 0, -1, 0, 0,
}; };
long trel[NTYPE]; int32 trel[NTYPE];
Init trelinit[] = Init trelinit[] =
{ {
TCHAR, BNUMBER, 0, TCHAR, BNUMBER, 0,
@ -1771,27 +1771,27 @@ Init trelinit[] =
-1, 0, 0, -1, 0, 0,
}; };
long tfunct[1] = int32 tfunct[1] =
{ {
BFUNC, BFUNC,
}; };
long tindir[1] = int32 tindir[1] =
{ {
BIND, BIND,
}; };
long tdot[1] = int32 tdot[1] =
{ {
BSTRUCT|BUNION, BSTRUCT|BUNION,
}; };
long tnot[1] = int32 tnot[1] =
{ {
BNUMBER|BIND, BNUMBER|BIND,
}; };
long targ[1] = int32 targ[1] =
{ {
BNUMBER|BIND|BSTRUCT|BUNION, BNUMBER|BIND|BSTRUCT|BUNION,
}; };

View File

@ -107,7 +107,7 @@ void
evconst(Node *n) evconst(Node *n)
{ {
Node *nl, *nr; Node *nl, *nr;
long len; int32 len;
String *str; String *str;
int wl, wr; int wl, wr;
@ -378,7 +378,7 @@ defaultlit(Node *n)
int int
cmpslit(Node *l, Node *r) cmpslit(Node *l, Node *r)
{ {
long l1, l2, i, m; int32 l1, l2, i, m;
char *s1, *s2; char *s1, *s2;
l1 = l->val.sval->len; l1 = l->val.sval->len;

View File

@ -919,7 +919,7 @@ fninit(Node *n)
Node *done, *any; Node *done, *any;
Node *a, *fn, *r; Node *a, *fn, *r;
Iter iter; Iter iter;
ulong h; uint32 h;
Sym *s; Sym *s;
r = N; r = N;

View File

@ -273,7 +273,7 @@ void
dumpexport(void) dumpexport(void)
{ {
Dcl *d; Dcl *d;
long lno; int32 lno;
lno = lineno; lno = lineno;

View File

@ -52,7 +52,7 @@ enum
typedef struct String String; typedef struct String String;
struct String struct String
{ {
long len; int32 len;
char s[3]; // variable char s[3]; // variable
}; };
@ -83,7 +83,7 @@ struct Type
uchar outnamed; uchar outnamed;
Sym* sym; Sym* sym;
long vargen; // unique name for OTYPE/ONAME int32 vargen; // unique name for OTYPE/ONAME
// most nodes // most nodes
Type* type; Type* type;
@ -100,7 +100,7 @@ struct Type
vlong argwid; vlong argwid;
// TARRAY // TARRAY
long bound; int32 bound;
}; };
#define T ((Type*)0) #define T ((Type*)0)
@ -142,8 +142,8 @@ struct Node
Sym* fsym; // import Sym* fsym; // import
Sym* psym; // import Sym* psym; // import
Sym* sym; // various Sym* sym; // various
long vargen; // unique name for OTYPE/ONAME int32 vargen; // unique name for OTYPE/ONAME
long lineno; int32 lineno;
vlong xoffset; vlong xoffset;
}; };
#define N ((Node*)0) #define N ((Node*)0)
@ -167,8 +167,8 @@ struct Sym
Type* forwtype; // TPTR iff forward declared Type* forwtype; // TPTR iff forward declared
void* label; // pointer to Prog* of label void* label; // pointer to Prog* of label
vlong offset; // stack location if automatic vlong offset; // stack location if automatic
long lexical; int32 lexical;
long vargen; // unique variable number int32 vargen; // unique variable number
Sym* link; Sym* link;
}; };
#define S ((Sym*)0) #define S ((Sym*)0)
@ -180,7 +180,7 @@ struct Dcl
Sym* dsym; // for printing only Sym* dsym; // for printing only
Node* dnode; // oname Node* dnode; // oname
Type* dtype; // otype Type* dtype; // otype
long lineno; int32 lineno;
Dcl* forw; Dcl* forw;
Dcl* back; // sentinel has pointer to last Dcl* back; // sentinel has pointer to last
@ -202,8 +202,8 @@ struct Hist
{ {
Hist* link; Hist* link;
char* name; char* name;
long line; int32 line;
long offset; int32 offset;
}; };
#define H ((Hist*)0) #define H ((Hist*)0)
@ -341,14 +341,14 @@ struct Io
{ {
char* infile; char* infile;
Biobuf* bin; Biobuf* bin;
long ilineno; int32 ilineno;
int peekc; int peekc;
char* cp; // used for content when bin==nil char* cp; // used for content when bin==nil
}; };
EXTERN Io curio; EXTERN Io curio;
EXTERN Io pushedio; EXTERN Io pushedio;
EXTERN long lineno; EXTERN int32 lineno;
EXTERN char* pathname; EXTERN char* pathname;
EXTERN Hist* hist; EXTERN Hist* hist;
EXTERN Hist* ehist; EXTERN Hist* ehist;
@ -394,12 +394,12 @@ EXTERN int inimportsys;
EXTERN Node* booltrue; EXTERN Node* booltrue;
EXTERN Node* boolfalse; EXTERN Node* boolfalse;
EXTERN ulong iota; EXTERN uint32 iota;
EXTERN Node* lastconst; EXTERN Node* lastconst;
EXTERN long vargen; EXTERN int32 vargen;
EXTERN long exportgen; EXTERN int32 exportgen;
EXTERN long maxarg; EXTERN int32 maxarg;
EXTERN long stksize; EXTERN int32 stksize;
EXTERN ushort blockgen; // max block number EXTERN ushort blockgen; // max block number
EXTERN ushort block; // current block number EXTERN ushort block; // current block number
@ -410,8 +410,8 @@ EXTERN char* context;
EXTERN int thechar; EXTERN int thechar;
EXTERN char* thestring; EXTERN char* thestring;
EXTERN char* hunk; EXTERN char* hunk;
EXTERN long nhunk; EXTERN int32 nhunk;
EXTERN long thunk; EXTERN int32 thunk;
/* /*
* y.tab.c * y.tab.c
@ -426,10 +426,10 @@ void setfilename(char*);
void importfile(Val*); void importfile(Val*);
void cannedimports(void); void cannedimports(void);
void unimportfile(); void unimportfile();
long yylex(void); int32 yylex(void);
void lexinit(void); void lexinit(void);
char* lexname(int); char* lexname(int);
long getr(void); int32 getr(void);
int getnsc(void); int getnsc(void);
int escchar(int, int*, vlong*); int escchar(int, int*, vlong*);
int getc(void); int getc(void);
@ -446,17 +446,17 @@ int mpatov(char*, vlong*);
* subr.c * subr.c
*/ */
void myexit(int); void myexit(int);
void* mal(long); void* mal(int32);
void* remal(void*, long, long); void* remal(void*, int32, int32);
void errorexit(void); void errorexit(void);
ulong stringhash(char*); uint32 stringhash(char*);
Sym* lookup(char*); Sym* lookup(char*);
Sym* pkglookup(char*, char*); Sym* pkglookup(char*, char*);
void yyerror(char*, ...); void yyerror(char*, ...);
void warn(char*, ...); void warn(char*, ...);
void fatal(char*, ...); void fatal(char*, ...);
void linehist(char*, long); void linehist(char*, int32);
long setlineno(Node*); int32 setlineno(Node*);
Node* nod(int, Node*, Node*); Node* nod(int, Node*, Node*);
Node* list(Node*, Node*); Node* list(Node*, Node*);
Type* typ(int); Type* typ(int);
@ -473,11 +473,11 @@ int isbytearray(Type*);
int eqtype(Type*, Type*, int); int eqtype(Type*, Type*, int);
void argtype(Node*, Type*); void argtype(Node*, Type*);
int eqargs(Type*, Type*); int eqargs(Type*, Type*);
ulong typehash(Type*, int); uint32 typehash(Type*, int);
void frame(int); void frame(int);
Node* literal(long); Node* literal(int32);
Node* dobad(void); Node* dobad(void);
Node* nodintconst(long); Node* nodintconst(int32);
void ullmancalc(Node*); void ullmancalc(Node*);
void badtype(int, Type*, Type*); void badtype(int, Type*, Type*);
Type* ptrto(Type*); Type* ptrto(Type*);
@ -583,7 +583,7 @@ Node* ascompatet(int, Node**, Type**, int);
Node* ascompatte(int, Type**, Node**, int); Node* ascompatte(int, Type**, Node**, int);
int ascompat(Type*, Type*); int ascompat(Type*, Type*);
Node* prcompat(Node*); Node* prcompat(Node*);
Node* nodpanic(long); Node* nodpanic(int32);
Node* newcompat(Node*); Node* newcompat(Node*);
Node* stringop(Node*, int); Node* stringop(Node*, int);
Type* fixmap(Type*); Type* fixmap(Type*);
@ -616,6 +616,6 @@ void proglist(void);
int optopop(int); int optopop(int);
void dumpobj(void); void dumpobj(void);
void dowidth(Type*); void dowidth(Type*);
void argspace(long); void argspace(int32);
Node* nodarg(Type*, int); Node* nodarg(Type*, int);
void nodconst(Node*, Type*, vlong); void nodconst(Node*, Type*, vlong);

View File

@ -198,7 +198,7 @@ importfile(Val *f)
{ {
Biobuf *imp; Biobuf *imp;
char *file; char *file;
long c; int32 c;
char *p; char *p;
int len; int len;
@ -283,7 +283,7 @@ cannedimports(void)
inimportsys = 1; inimportsys = 1;
} }
long int32
yylex(void) yylex(void)
{ {
int c, c1; int c, c1;
@ -335,8 +335,8 @@ l0:
case '"': case '"':
/* "..." */ /* "..." */
strcpy(namebuf, "\"<string>\""); strcpy(namebuf, "\"<string>\"");
cp = mal(sizeof(long)); cp = mal(sizeof(int32));
c1 = 4; c1 = sizeof(int32);
caseq: caseq:
for(;;) { for(;;) {
@ -359,8 +359,8 @@ l0:
case '`': case '`':
/* `...` */ /* `...` */
strcpy(namebuf, "`<string>`"); strcpy(namebuf, "`<string>`");
cp = mal(sizeof(long)); cp = mal(sizeof(int32));
c1 = 4; c1 = sizeof(int32);
casebq: casebq:
for(;;) { for(;;) {
@ -385,7 +385,7 @@ l0:
break; break;
} }
*(long*)cp = c1-4; // length *(int32*)cp = c1-sizeof(int32); // length
do { do {
cp = remal(cp, c1, 1); cp = remal(cp, c1, 1);
cp[c1++] = 0; cp[c1++] = 0;
@ -781,7 +781,7 @@ ungetc(int c)
lineno--; lineno--;
} }
long int32
getr(void) getr(void)
{ {
int c, i; int c, i;
@ -1212,7 +1212,7 @@ void
mkpackage(char* pkg) mkpackage(char* pkg)
{ {
Sym *s; Sym *s;
long h; int32 h;
char *p; char *p;
if(bout != nil) { if(bout != nil) {

View File

@ -10,7 +10,7 @@ int mpatov(char *s, vlong *v);
enum enum
{ {
Mpscale = 29, /* safely smaller than bits in a long */ Mpscale = 29, /* safely smaller than bits in a int32 */
Mpprec = 36, /* Mpscale*Mpprec sb > largest fp exp */ Mpprec = 36, /* Mpscale*Mpprec sb > largest fp exp */
Mpbase = 1L<<Mpscale, Mpbase = 1L<<Mpscale,
}; };
@ -18,7 +18,7 @@ enum
typedef typedef
struct struct
{ {
long a[Mpprec]; int32 a[Mpprec];
char ovf; char ovf;
} Mp; } Mp;
@ -169,7 +169,7 @@ static int
mptof(Mp *a, double *d) mptof(Mp *a, double *d)
{ {
double f, g; double f, g;
long x, *a1; int32 x, *a1;
int i; int i;
if(a->ovf) if(a->ovf)
@ -200,7 +200,7 @@ static void
mpadd(Mp *a, Mp *b) mpadd(Mp *a, Mp *b)
{ {
int i, c; int i, c;
long x, *a1, *b1; int32 x, *a1, *b1;
if(b->ovf) if(b->ovf)
a->ovf = 1; a->ovf = 1;

View File

@ -61,7 +61,7 @@ fatal(char *fmt, ...)
} }
void void
linehist(char *file, long off) linehist(char *file, int32 off)
{ {
Hist *h; Hist *h;
char *cp; char *cp;
@ -96,10 +96,10 @@ linehist(char *file, long off)
ehist = h; ehist = h;
} }
long int32
setlineno(Node *n) setlineno(Node *n)
{ {
long lno; int32 lno;
lno = lineno; lno = lineno;
if(n != N && n->op != ONAME) { if(n != N && n->op != ONAME) {
@ -113,10 +113,10 @@ setlineno(Node *n)
return lno; return lno;
} }
ulong uint32
stringhash(char *p) stringhash(char *p)
{ {
long h; int32 h;
int c; int c;
h = 0; h = 0;
@ -139,7 +139,7 @@ Sym*
lookup(char *p) lookup(char *p)
{ {
Sym *s; Sym *s;
ulong h; uint32 h;
int c; int c;
h = stringhash(p) % NHASH; h = stringhash(p) % NHASH;
@ -171,7 +171,7 @@ Sym*
pkglookup(char *p, char *k) pkglookup(char *p, char *k)
{ {
Sym *s; Sym *s;
ulong h; uint32 h;
int c; int c;
h = stringhash(p) % NHASH; h = stringhash(p) % NHASH;
@ -204,7 +204,7 @@ void
gethunk(void) gethunk(void)
{ {
char *h; char *h;
long nh; int32 nh;
nh = NHUNK; nh = NHUNK;
if(thunk >= 10L*NHUNK) if(thunk >= 10L*NHUNK)
@ -220,11 +220,11 @@ gethunk(void)
} }
void* void*
mal(long n) mal(int32 n)
{ {
void *p; void *p;
while((ulong)hunk & MAXALIGN) { while((uintptr)hunk & MAXALIGN) {
hunk++; hunk++;
nhunk--; nhunk--;
} }
@ -239,7 +239,7 @@ mal(long n)
} }
void* void*
remal(void *p, long on, long n) remal(void *p, int32 on, int32 n)
{ {
void *q; void *q;
@ -307,7 +307,7 @@ dobad(void)
} }
Node* Node*
nodintconst(long v) nodintconst(int32 v)
{ {
Node *c; Node *c;
@ -702,15 +702,15 @@ Lconv(Fmt *fp)
struct struct
{ {
Hist* incl; /* start of this include file */ Hist* incl; /* start of this include file */
long idel; /* delta line number to apply to include */ int32 idel; /* delta line number to apply to include */
Hist* line; /* start of this #line directive */ Hist* line; /* start of this #line directive */
long ldel; /* delta line number to apply to #line */ int32 ldel; /* delta line number to apply to #line */
} a[HISTSZ]; } a[HISTSZ];
long lno, d; int32 lno, d;
int i, n; int i, n;
Hist *h; Hist *h;
lno = va_arg(fp->args, long); lno = va_arg(fp->args, int32);
n = 0; n = 0;
for(h=hist; h!=H; h=h->link) { for(h=hist; h!=H; h=h->link) {
@ -1463,10 +1463,10 @@ eqargs(Type *t1, Type *t2)
return 1; return 1;
} }
ulong uint32
typehash(Type *at, int d) typehash(Type *at, int d)
{ {
ulong h; uint32 h;
Type *t; Type *t;
if(at == T) if(at == T)
@ -1524,7 +1524,7 @@ ptrto(Type *t)
} }
Node* Node*
literal(long v) literal(int32 v)
{ {
Node *n; Node *n;

View File

@ -44,7 +44,7 @@ walktype(Node *n, int top)
Type *t; Type *t;
Sym *s; Sym *s;
int et, cl, cr; int et, cl, cr;
long lno; int32 lno;
lno = setlineno(n); lno = setlineno(n);
@ -1042,7 +1042,7 @@ walkselect(Node *sel)
Node *n, *oc, *on, *r; Node *n, *oc, *on, *r;
Node *var, *bod, *res; Node *var, *bod, *res;
int count; int count;
long lno; int32 lno;
lno = setlineno(sel); lno = setlineno(sel);
@ -1459,7 +1459,7 @@ loop:
} }
Node* Node*
nodpanic(long lineno) nodpanic(int32 lineno)
{ {
Node *n, *on; Node *n, *on;
@ -1513,7 +1513,7 @@ Node*
stringop(Node *n, int top) stringop(Node *n, int top)
{ {
Node *r, *c, *on; Node *r, *c, *on;
long l; int32 l;
switch(n->op) { switch(n->op) {
default: default:

View File

@ -116,7 +116,7 @@ addr(Biobuf *bp)
{ {
Addr a; Addr a;
int t; int t;
long l; int32 l;
vlong off; vlong off;
off = 0; off = 0;

View File

@ -34,7 +34,7 @@
#include <ureg_x86.h> #include <ureg_x86.h>
#include <mach_amd64.h> #include <mach_amd64.h>
#define REGOFF(x) (ulong)(&((struct Ureg *) 0)->x) #define REGOFF(x) (uintptr)(&((struct Ureg *) 0)->x)
#define PC REGOFF(pc) #define PC REGOFF(pc)
#define SP REGOFF(sp) #define SP REGOFF(sp)

View File

@ -84,7 +84,7 @@ Machdata i386mach =
1, /* break point size */ 1, /* break point size */
leswab, /* convert short to local byte order */ leswab, /* convert short to local byte order */
leswal, /* convert long to local byte order */ leswal, /* convert int32 to local byte order */
leswav, /* convert vlong to local byte order */ leswav, /* convert vlong to local byte order */
i386trace, /* C traceback */ i386trace, /* C traceback */
i386frame, /* frame finder */ i386frame, /* frame finder */
@ -101,7 +101,7 @@ Machdata i386mach =
static char* static char*
i386excep(Map *map, Rgetter rget) i386excep(Map *map, Rgetter rget)
{ {
ulong c; uint32 c;
uvlong pc; uvlong pc;
static char buf[16]; static char buf[16];
@ -210,9 +210,9 @@ struct Instr
char rip; /* RIP-relative in amd64 mode */ char rip; /* RIP-relative in amd64 mode */
uchar opre; /* f2/f3 could introduce media */ uchar opre; /* f2/f3 could introduce media */
short seg; /* segment of far address */ short seg; /* segment of far address */
ulong disp; /* displacement */ uint32 disp; /* displacement */
ulong imm; /* immediate */ uint32 imm; /* immediate */
ulong imm2; /* second immediate operand */ uint32 imm2; /* second immediate operand */
uvlong imm64; /* big immediate */ uvlong imm64; /* big immediate */
char *curr; /* fill level in output buffer */ char *curr; /* fill level in output buffer */
char *end; /* end of output buffer */ char *end; /* end of output buffer */
@ -286,9 +286,9 @@ enum {
Iwdq, /* Operand-sized immediate, possibly 64 bits */ Iwdq, /* Operand-sized immediate, possibly 64 bits */
Awd, /* Address offset */ Awd, /* Address offset */
Iwds, /* Operand-sized immediate (sign extended) */ Iwds, /* Operand-sized immediate (sign extended) */
RM, /* Word or long R/M field with register (/r) */ RM, /* Word or int32 R/M field with register (/r) */
RMB, /* Byte R/M field with register (/r) */ RMB, /* Byte R/M field with register (/r) */
RMOP, /* Word or long R/M field with op code (/digit) */ RMOP, /* Word or int32 R/M field with op code (/digit) */
RMOPB, /* Byte R/M field with op code (/digit) */ RMOPB, /* Byte R/M field with op code (/digit) */
RMR, /* R/M register only (mod = 11) */ RMR, /* R/M register only (mod = 11) */
RMM, /* R/M memory only (mod = 0/1/2) */ RMM, /* R/M memory only (mod = 0/1/2) */
@ -1294,10 +1294,10 @@ igets(Map *map, Instr *ip, ushort *sp)
* get 4 bytes of the instruction * get 4 bytes of the instruction
*/ */
static int static int
igetl(Map *map, Instr *ip, ulong *lp) igetl(Map *map, Instr *ip, uint32 *lp)
{ {
ushort s; ushort s;
long l; int32 l;
if (igets(map, ip, &s) < 0) if (igets(map, ip, &s) < 0)
return -1; return -1;
@ -1315,7 +1315,7 @@ igetl(Map *map, Instr *ip, ulong *lp)
static int static int
igetq(Map *map, Instr *ip, vlong *qp) igetq(Map *map, Instr *ip, vlong *qp)
{ {
ulong l; uint32 l;
uvlong q; uvlong q;
if (igetl(map, ip, &l) < 0) if (igetl(map, ip, &l) < 0)
@ -1483,7 +1483,7 @@ badop:
ip->imm = c|0xffffff00; ip->imm = c|0xffffff00;
else else
ip->imm = c&0xff; ip->imm = c&0xff;
ip->imm64 = (long)ip->imm; ip->imm64 = (int32)ip->imm;
ip->jumptype = Jbs; ip->jumptype = Jbs;
break; break;
case Ibs: /* 8-bit immediate (sign extended) */ case Ibs: /* 8-bit immediate (sign extended) */
@ -1496,7 +1496,7 @@ badop:
ip->imm = c|0xff00; ip->imm = c|0xff00;
else else
ip->imm = c&0xff; ip->imm = c&0xff;
ip->imm64 = (long)ip->imm; ip->imm64 = (int32)ip->imm;
break; break;
case Iw: /* 16-bit immediate -> imm */ case Iw: /* 16-bit immediate -> imm */
if (igets(map, ip, &s) < 0) if (igets(map, ip, &s) < 0)
@ -1530,7 +1530,7 @@ badop:
return 0; return 0;
ip->imm64 = ip->imm; ip->imm64 = ip->imm;
if (ip->rex & REXW) { if (ip->rex & REXW) {
ulong l; uint32 l;
if (igetl(map, ip, &l) < 0) if (igetl(map, ip, &l) < 0)
return 0; return 0;
ip->imm64 |= (uvlong)l << 32; ip->imm64 |= (uvlong)l << 32;
@ -1781,7 +1781,7 @@ static void
plocal(Instr *ip) plocal(Instr *ip)
{ {
int ret; int ret;
long offset; int32 offset;
Symbol s; Symbol s;
char *reg; char *reg;
@ -1826,10 +1826,10 @@ isjmp(Instr *ip)
* are changed on sources. * are changed on sources.
*/ */
static int static int
issymref(Instr *ip, Symbol *s, long w, long val) issymref(Instr *ip, Symbol *s, int32 w, int32 val)
{ {
Symbol next, tmp; Symbol next, tmp;
long isstring, size; int32 isstring, size;
if (isjmp(ip)) if (isjmp(ip))
return 1; return 1;
@ -1869,7 +1869,7 @@ static void
immediate(Instr *ip, vlong val) immediate(Instr *ip, vlong val)
{ {
Symbol s; Symbol s;
long w; int32 w;
if (findsym(val, CANY, &s)) { /* TO DO */ if (findsym(val, CANY, &s)) { /* TO DO */
w = val - s.value; w = val - s.value;
@ -2036,9 +2036,9 @@ prinstr(Instr *ip, char *fmt)
break; break;
case 'p': case 'p':
/* /*
* signed immediate in the ulong ip->imm. * signed immediate in the uint32 ip->imm.
*/ */
v = (long)ip->imm; v = (int32)ip->imm;
immediate(ip, v+ip->addr+ip->n); immediate(ip, v+ip->addr+ip->n);
break; break;
case 'r': case 'r':
@ -2154,7 +2154,7 @@ i386foll(Map *map, uvlong pc, Rgetter rget, uvlong *foll)
return 1; return 1;
case Iwds: /* pc relative JUMP or CALL*/ case Iwds: /* pc relative JUMP or CALL*/
case Jbs: /* pc relative JUMP or CALL */ case Jbs: /* pc relative JUMP or CALL */
v = (long)i.imm; v = (int32)i.imm;
foll[0] = pc+v+i.n; foll[0] = pc+v+i.n;
n = 1; n = 1;
break; break;

View File

@ -45,7 +45,7 @@ static struct segment* reloc(Map*, uvlong, vlong*);
int int
geta(Map *map, uvlong addr, uvlong *x) geta(Map *map, uvlong addr, uvlong *x)
{ {
ulong l; uint32 l;
uvlong vl; uvlong vl;
if (mach->szaddr == 8){ if (mach->szaddr == 8){
@ -81,7 +81,7 @@ get8(Map *map, uvlong addr, uvlong *x)
} }
int int
get4(Map *map, uvlong addr, ulong *x) get4(Map *map, uvlong addr, uint32 *x)
{ {
if (!map) { if (!map) {
werrstr("get4: invalid map"); werrstr("get4: invalid map");
@ -158,7 +158,7 @@ put8(Map *map, uvlong addr, uvlong v)
} }
int int
put4(Map *map, uvlong addr, ulong v) put4(Map *map, uvlong addr, uint32 v)
{ {
if (!map) { if (!map) {
werrstr("put4: invalid map"); werrstr("put4: invalid map");

View File

@ -35,9 +35,9 @@ typedef struct {
ushort type; /* file type */ ushort type; /* file type */
ushort machine; /* target machine */ ushort machine; /* target machine */
int version; /* file version */ int version; /* file version */
ulong elfentry; /* start address */ uint32 elfentry; /* start address */
ulong phoff; /* phdr file offset */ uint32 phoff; /* phdr file offset */
ulong shoff; /* shdr file offset */ uint32 shoff; /* shdr file offset */
int flags; /* file flags */ int flags; /* file flags */
ushort ehsize; /* sizeof ehdr */ ushort ehsize; /* sizeof ehdr */
ushort phentsize; /* sizeof phdr */ ushort phentsize; /* sizeof phdr */
@ -66,11 +66,11 @@ typedef struct {
typedef struct { typedef struct {
int type; /* entry type */ int type; /* entry type */
ulong offset; /* file offset */ uint32 offset; /* file offset */
ulong vaddr; /* virtual address */ uint32 vaddr; /* virtual address */
ulong paddr; /* physical address */ uint32 paddr; /* physical address */
int filesz; /* file size */ int filesz; /* file size */
ulong memsz; /* memory size */ uint32 memsz; /* memory size */
int flags; /* entry flags */ int flags; /* entry flags */
int align; /* memory/file alignment */ int align; /* memory/file alignment */
} Phdr32; } Phdr32;
@ -87,27 +87,27 @@ typedef struct {
} Phdr64; } Phdr64;
typedef struct { typedef struct {
ulong name; /* section name */ uint32 name; /* section name */
ulong type; /* SHT_... */ uint32 type; /* SHT_... */
ulong flags; /* SHF_... */ uint32 flags; /* SHF_... */
ulong addr; /* virtual address */ uint32 addr; /* virtual address */
ulong offset; /* file offset */ uint32 offset; /* file offset */
ulong size; /* section size */ uint32 size; /* section size */
ulong link; /* misc info */ uint32 link; /* misc info */
ulong info; /* misc info */ uint32 info; /* misc info */
ulong addralign; /* memory alignment */ uint32 addralign; /* memory alignment */
ulong entsize; /* entry size if table */ uint32 entsize; /* entry size if table */
} Shdr32; } Shdr32;
typedef struct { typedef struct {
ulong name; /* section name */ uint32 name; /* section name */
ulong type; /* SHT_... */ uint32 type; /* SHT_... */
uvlong flags; /* SHF_... */ uvlong flags; /* SHF_... */
uvlong addr; /* virtual address */ uvlong addr; /* virtual address */
uvlong offset; /* file offset */ uvlong offset; /* file offset */
uvlong size; /* section size */ uvlong size; /* section size */
ulong link; /* misc info */ uint32 link; /* misc info */
ulong info; /* misc info */ uint32 info; /* misc info */
uvlong addralign; /* memory alignment */ uvlong addralign; /* memory alignment */
uvlong entsize; /* entry size if table */ uvlong entsize; /* entry size if table */
} Shdr64; } Shdr64;

View File

@ -36,7 +36,7 @@
/* /*
* All a.out header types. The dummy entry allows canonical * All a.out header types. The dummy entry allows canonical
* processing of the union as a sequence of longs * processing of the union as a sequence of int32s
*/ */
typedef struct { typedef struct {
@ -53,7 +53,7 @@ typedef struct {
struct nextexec next; /* bootexec.h */ struct nextexec next; /* bootexec.h */
Machhdr machhdr; /* macho.h */ Machhdr machhdr; /* macho.h */
} e; } e;
long dummy; /* padding to ensure extra long */ int32 dummy; /* padding to ensure extra int32 */
} ExecHdr; } ExecHdr;
static int nextboot(int, Fhdr*, ExecHdr*); static int nextboot(int, Fhdr*, ExecHdr*);
@ -66,25 +66,25 @@ static int adotout(int, Fhdr*, ExecHdr*);
static int elfdotout(int, Fhdr*, ExecHdr*); static int elfdotout(int, Fhdr*, ExecHdr*);
static int machdotout(int, Fhdr*, ExecHdr*); static int machdotout(int, Fhdr*, ExecHdr*);
static int armdotout(int, Fhdr*, ExecHdr*); static int armdotout(int, Fhdr*, ExecHdr*);
static void setsym(Fhdr*, long, long, long, vlong); static void setsym(Fhdr*, int32, int32, int32, vlong);
static void setdata(Fhdr*, uvlong, long, vlong, long); static void setdata(Fhdr*, uvlong, int32, vlong, int32);
static void settext(Fhdr*, uvlong, uvlong, long, vlong); static void settext(Fhdr*, uvlong, uvlong, int32, vlong);
static void hswal(void*, int, ulong(*)(ulong)); static void hswal(void*, int, uint32(*)(uint32));
static uvlong _round(uvlong, ulong); static uvlong _round(uvlong, uint32);
/* /*
* definition of per-executable file type structures * definition of per-executable file type structures
*/ */
typedef struct Exectable{ typedef struct Exectable{
long magic; /* big-endian magic number of file */ int32 magic; /* big-endian magic number of file */
char *name; /* executable identifier */ char *name; /* executable identifier */
char *dlmname; /* dynamically loadable module identifier */ char *dlmname; /* dynamically loadable module identifier */
uchar type; /* Internal code */ uchar type; /* Internal code */
uchar _magic; /* _MAGIC() magic */ uchar _magic; /* _MAGIC() magic */
Mach *mach; /* Per-machine data */ Mach *mach; /* Per-machine data */
long hsize; /* header size */ int32 hsize; /* header size */
ulong (*swal)(ulong); /* beswal or leswal */ uint32 (*swal)(uint32); /* beswal or leswal */
int (*hparse)(int, Fhdr*, ExecHdr*); int (*hparse)(int, Fhdr*, ExecHdr*);
} ExecTable; } ExecTable;
@ -336,7 +336,7 @@ crackhdr(int fd, Fhdr *fp)
ExecTable *mp; ExecTable *mp;
ExecHdr d; ExecHdr d;
int nb, ret; int nb, ret;
ulong magic; uint32 magic;
fp->type = FNONE; fp->type = FNONE;
nb = read(fd, (char *)&d.e, sizeof(d.e)); nb = read(fd, (char *)&d.e, sizeof(d.e));
@ -383,7 +383,7 @@ crackhdr(int fd, Fhdr *fp)
mach = mp->mach; mach = mp->mach;
if(mp->swal != nil) if(mp->swal != nil)
hswal(&d, sizeof(d.e)/sizeof(ulong), mp->swal); hswal(&d, sizeof(d.e)/sizeof(uint32), mp->swal);
ret = mp->hparse(fd, fp, &d); ret = mp->hparse(fd, fp, &d);
seek(fd, mp->hsize, 0); /* seek to end of header */ seek(fd, mp->hsize, 0); /* seek to end of header */
break; break;
@ -397,9 +397,9 @@ crackhdr(int fd, Fhdr *fp)
* Convert header to canonical form * Convert header to canonical form
*/ */
static void static void
hswal(void *v, int n, ulong (*swap)(ulong)) hswal(void *v, int n, uint32 (*swap)(uint32))
{ {
ulong *ulp; uint32 *ulp;
for(ulp = v; n--; ulp++) for(ulp = v; n--; ulp++)
*ulp = (*swap)(*ulp); *ulp = (*swap)(*ulp);
@ -411,7 +411,7 @@ hswal(void *v, int n, ulong (*swap)(ulong))
static int static int
adotout(int fd, Fhdr *fp, ExecHdr *hp) adotout(int fd, Fhdr *fp, ExecHdr *hp)
{ {
long pgsize; int32 pgsize;
USED(fd); USED(fd);
pgsize = mach->pgsize; pgsize = mach->pgsize;
@ -491,10 +491,10 @@ common(int fd, Fhdr *fp, ExecHdr *hp)
static int static int
commonllp64(int unused, Fhdr *fp, ExecHdr *hp) commonllp64(int unused, Fhdr *fp, ExecHdr *hp)
{ {
long pgsize; int32 pgsize;
uvlong entry; uvlong entry;
hswal(&hp->e, sizeof(Exec)/sizeof(long), beswal); hswal(&hp->e, sizeof(Exec)/sizeof(int32), beswal);
if(!(hp->e.exechdr.magic & HDR_MAGIC)) if(!(hp->e.exechdr.magic & HDR_MAGIC))
return 0; return 0;
@ -634,7 +634,7 @@ elf64dotout(int fd, Fhdr *fp, ExecHdr *hp)
{ {
uvlong (*swav)(uvlong); uvlong (*swav)(uvlong);
ulong (*swal)(ulong); uint32 (*swal)(uint32);
ushort (*swab)(ushort); ushort (*swab)(ushort);
Ehdr64 *ep; Ehdr64 *ep;
Phdr64 *ph; Phdr64 *ph;
@ -721,7 +721,7 @@ elf64dotout(int fd, Fhdr *fp, ExecHdr *hp)
free(ph); free(ph);
return 0; return 0;
} }
hswal(ph, phsz/sizeof(ulong), swal); hswal(ph, phsz/sizeof(uint32), swal);
shsz = sizeof(Shdr64)*ep->shnum; shsz = sizeof(Shdr64)*ep->shnum;
sh = malloc(shsz); sh = malloc(shsz);
@ -731,7 +731,7 @@ elf64dotout(int fd, Fhdr *fp, ExecHdr *hp)
free(sh); free(sh);
sh = 0; sh = 0;
} else } else
hswal(ph, phsz/sizeof(ulong), swal); hswal(ph, phsz/sizeof(uint32), swal);
} }
/* find text, data and symbols and install them */ /* find text, data and symbols and install them */
@ -757,7 +757,7 @@ elf64dotout(int fd, Fhdr *fp, ExecHdr *hp)
* ph[1] : symsz, lcsz, 0, 0, symoff * ph[1] : symsz, lcsz, 0, 0, symoff
*/ */
if(ep->machine == SPARC64 && ep->phnum == 2) { if(ep->machine == SPARC64 && ep->phnum == 2) {
ulong txtaddr, txtsz, dataddr, bsssz; uint32 txtaddr, txtsz, dataddr, bsssz;
txtaddr = ph[0].vaddr | 0x80000000; txtaddr = ph[0].vaddr | 0x80000000;
txtsz = ph[0].filesz - ph[0].paddr; txtsz = ph[0].filesz - ph[0].paddr;
@ -822,7 +822,7 @@ static int
elfdotout(int fd, Fhdr *fp, ExecHdr *hp) elfdotout(int fd, Fhdr *fp, ExecHdr *hp)
{ {
ulong (*swal)(ulong); uint32 (*swal)(uint32);
ushort (*swab)(ushort); ushort (*swab)(ushort);
Ehdr32 *ep; Ehdr32 *ep;
Phdr32 *ph; Phdr32 *ph;
@ -905,7 +905,7 @@ elfdotout(int fd, Fhdr *fp, ExecHdr *hp)
free(ph); free(ph);
return 0; return 0;
} }
hswal(ph, phsz/sizeof(ulong), swal); hswal(ph, phsz/sizeof(uint32), swal);
/* find text, data and symbols and install them */ /* find text, data and symbols and install them */
it = id = is = -1; it = id = is = -1;
@ -930,7 +930,7 @@ elfdotout(int fd, Fhdr *fp, ExecHdr *hp)
* ph[1] : symsz, lcsz, 0, 0, symoff * ph[1] : symsz, lcsz, 0, 0, symoff
*/ */
if(ep->machine == SPARC64 && ep->phnum == 2) { if(ep->machine == SPARC64 && ep->phnum == 2) {
ulong txtaddr, txtsz, dataddr, bsssz; uint32 txtaddr, txtsz, dataddr, bsssz;
txtaddr = ph[0].vaddr | 0x80000000; txtaddr = ph[0].vaddr | 0x80000000;
txtsz = ph[0].filesz - ph[0].paddr; txtsz = ph[0].filesz - ph[0].paddr;
@ -960,7 +960,7 @@ static int
machdotout(int fd, Fhdr *fp, ExecHdr *hp) machdotout(int fd, Fhdr *fp, ExecHdr *hp)
{ {
uvlong (*swav)(uvlong); uvlong (*swav)(uvlong);
ulong (*swal)(ulong); uint32 (*swal)(uint32);
ushort (*swab)(ushort); ushort (*swab)(ushort);
Machhdr *mp; Machhdr *mp;
MachCmd **cmd; MachCmd **cmd;
@ -1117,7 +1117,7 @@ armdotout(int fd, Fhdr *fp, ExecHdr *hp)
} }
static void static void
settext(Fhdr *fp, uvlong e, uvlong a, long s, vlong off) settext(Fhdr *fp, uvlong e, uvlong a, int32 s, vlong off)
{ {
fp->txtaddr = a; fp->txtaddr = a;
fp->entry = e; fp->entry = e;
@ -1126,7 +1126,7 @@ settext(Fhdr *fp, uvlong e, uvlong a, long s, vlong off)
} }
static void static void
setdata(Fhdr *fp, uvlong a, long s, vlong off, long bss) setdata(Fhdr *fp, uvlong a, int32 s, vlong off, int32 bss)
{ {
fp->dataddr = a; fp->dataddr = a;
fp->datsz = s; fp->datsz = s;
@ -1135,7 +1135,7 @@ setdata(Fhdr *fp, uvlong a, long s, vlong off, long bss)
} }
static void static void
setsym(Fhdr *fp, long symsz, long sppcsz, long lnpcsz, vlong symoff) setsym(Fhdr *fp, int32 symsz, int32 sppcsz, int32 lnpcsz, vlong symoff)
{ {
fp->symsz = symsz; fp->symsz = symsz;
fp->symoff = symoff; fp->symoff = symoff;
@ -1147,7 +1147,7 @@ setsym(Fhdr *fp, long symsz, long sppcsz, long lnpcsz, vlong symoff)
static uvlong static uvlong
_round(uvlong a, ulong b) _round(uvlong a, uint32 b)
{ {
uvlong w; uvlong w;

View File

@ -98,7 +98,7 @@ symoff(char *buf, int n, uvlong v, int space)
{ {
Symbol s; Symbol s;
int r; int r;
long delta; int32 delta;
r = delta = 0; /* to shut compiler up */ r = delta = 0; /* to shut compiler up */
if (v) { if (v) {
@ -132,7 +132,7 @@ int
fpformat(Map *map, Reglist *rp, char *buf, int n, int modif) fpformat(Map *map, Reglist *rp, char *buf, int n, int modif)
{ {
char reg[12]; char reg[12];
ulong r; uint32 r;
switch(rp->rformat) switch(rp->rformat)
{ {
@ -180,9 +180,9 @@ fpformat(Map *map, Reglist *rp, char *buf, int n, int modif)
} }
char * char *
_hexify(char *buf, ulong p, int zeros) _hexify(char *buf, uint32 p, int zeros)
{ {
ulong d; uint32 d;
d = p/16; d = p/16;
if(d) if(d)
@ -200,7 +200,7 @@ _hexify(char *buf, ulong p, int zeros)
* double format. Naive but workable, probably. * double format. Naive but workable, probably.
*/ */
int int
ieeedftos(char *buf, int n, ulong h, ulong l) ieeedftos(char *buf, int n, uint32 h, uint32 l)
{ {
double fr; double fr;
int exp; int exp;
@ -238,7 +238,7 @@ ieeedftos(char *buf, int n, ulong h, ulong l)
} }
int int
ieeesftos(char *buf, int n, ulong h) ieeesftos(char *buf, int n, uint32 h)
{ {
double fr; double fr;
int exp; int exp;
@ -273,25 +273,25 @@ ieeesftos(char *buf, int n, ulong h)
int int
beieeesftos(char *buf, int n, void *s) beieeesftos(char *buf, int n, void *s)
{ {
return ieeesftos(buf, n, beswal(*(ulong*)s)); return ieeesftos(buf, n, beswal(*(uint32*)s));
} }
int int
beieeedftos(char *buf, int n, void *s) beieeedftos(char *buf, int n, void *s)
{ {
return ieeedftos(buf, n, beswal(*(ulong*)s), beswal(((ulong*)(s))[1])); return ieeedftos(buf, n, beswal(*(uint32*)s), beswal(((uint32*)(s))[1]));
} }
int int
leieeesftos(char *buf, int n, void *s) leieeesftos(char *buf, int n, void *s)
{ {
return ieeesftos(buf, n, leswal(*(ulong*)s)); return ieeesftos(buf, n, leswal(*(uint32*)s));
} }
int int
leieeedftos(char *buf, int n, void *s) leieeedftos(char *buf, int n, void *s)
{ {
return ieeedftos(buf, n, leswal(((ulong*)(s))[1]), leswal(*(ulong*)s)); return ieeedftos(buf, n, leswal(((uint32*)(s))[1]), leswal(*(uint32*)s));
} }
/* packed in 12 bytes, with s[2]==s[3]==0; mantissa starts at s[4]*/ /* packed in 12 bytes, with s[2]==s[3]==0; mantissa starts at s[4]*/
@ -300,7 +300,7 @@ beieee80ftos(char *buf, int n, void *s)
{ {
uchar *reg = (uchar*)s; uchar *reg = (uchar*)s;
int i; int i;
ulong x; uint32 x;
uchar ieee[8+8]; /* room for slop */ uchar ieee[8+8]; /* room for slop */
uchar *p, *q; uchar *p, *q;

View File

@ -7,19 +7,19 @@
*/ */
typedef struct { typedef struct {
ulong magic; /* mach magic number identifier */ uint32 magic; /* mach magic number identifier */
ulong cputype; /* cpu specifier */ uint32 cputype; /* cpu specifier */
ulong cpusubtype; /* machine specifier */ uint32 cpusubtype; /* machine specifier */
ulong filetype; /* type of file */ uint32 filetype; /* type of file */
ulong ncmds; /* number of load commands */ uint32 ncmds; /* number of load commands */
ulong sizeofcmds; /* the size of all the load commands */ uint32 sizeofcmds; /* the size of all the load commands */
ulong flags; /* flags */ uint32 flags; /* flags */
ulong reserved; /* reserved */ uint32 reserved; /* reserved */
} Machhdr; } Machhdr;
typedef struct { typedef struct {
ulong type; /* type of load command */ uint32 type; /* type of load command */
ulong size; /* total size in bytes */ uint32 size; /* total size in bytes */
} MachCmd; } MachCmd;
typedef struct { typedef struct {
@ -29,16 +29,16 @@ typedef struct {
uvlong vmsize; /* memory size of this segment */ uvlong vmsize; /* memory size of this segment */
uvlong fileoff; /* file offset of this segment */ uvlong fileoff; /* file offset of this segment */
uvlong filesize; /* amount to map from the file */ uvlong filesize; /* amount to map from the file */
ulong maxprot; /* maximum VM protection */ uint32 maxprot; /* maximum VM protection */
ulong initprot; /* initial VM protection */ uint32 initprot; /* initial VM protection */
ulong nsects; /* number of sections in segment */ uint32 nsects; /* number of sections in segment */
ulong flags; /* flags */ uint32 flags; /* flags */
} MachSeg64; /* for 64-bit architectures */ } MachSeg64; /* for 64-bit architectures */
typedef struct { typedef struct {
MachCmd cmd; MachCmd cmd;
ulong fileoff; /* file offset of this segment */ uint32 fileoff; /* file offset of this segment */
ulong filesize; /* amount to map from the file */ uint32 filesize; /* amount to map from the file */
} MachSymSeg; } MachSymSeg;
typedef struct { typedef struct {
@ -46,14 +46,14 @@ typedef struct {
char segname[16]; /* segment this section goes in */ char segname[16]; /* segment this section goes in */
uvlong addr; /* memory address of this section */ uvlong addr; /* memory address of this section */
uvlong size; /* size in bytes of this section */ uvlong size; /* size in bytes of this section */
ulong offset; /* file offset of this section */ uint32 offset; /* file offset of this section */
ulong align; /* section alignment (power of 2) */ uint32 align; /* section alignment (power of 2) */
ulong reloff; /* file offset of relocation entries */ uint32 reloff; /* file offset of relocation entries */
ulong nreloc; /* number of relocation entries */ uint32 nreloc; /* number of relocation entries */
ulong flags; /* flags (section type and attributes)*/ uint32 flags; /* flags (section type and attributes)*/
ulong reserved1; /* reserved (for offset or index) */ uint32 reserved1; /* reserved (for offset or index) */
ulong reserved2; /* reserved (for count or sizeof) */ uint32 reserved2; /* reserved (for count or sizeof) */
ulong reserved3; /* reserved */ uint32 reserved3; /* reserved */
} MachSect64; /* for 64-bit architectures */ } MachSect64; /* for 64-bit architectures */
enum { enum {

View File

@ -240,7 +240,7 @@ processprog(Prog *p, int doautos)
static void static void
objlookup(int id, char *name, int type, uint sig) objlookup(int id, char *name, int type, uint sig)
{ {
long h; int32 h;
char *cp; char *cp;
Sym *s; Sym *s;
Symtab *sp; Symtab *sp;
@ -351,7 +351,7 @@ nextar(Biobuf *bp, int offset, char *buf)
{ {
struct ar_hdr a; struct ar_hdr a;
int i, r; int i, r;
long arsize; int32 arsize;
if (offset&01) if (offset&01)
offset++; offset++;

View File

@ -41,10 +41,10 @@ beswab(ushort s)
} }
/* /*
* big-endian long * big-endian int32
*/ */
ulong uint32
beswal(ulong l) beswal(uint32 l)
{ {
uchar *p; uchar *p;
@ -80,10 +80,10 @@ leswab(ushort s)
} }
/* /*
* little-endian long * little-endian int32
*/ */
ulong uint32
leswal(ulong l) leswal(uint32 l)
{ {
uchar *p; uchar *p;

View File

@ -46,8 +46,8 @@ struct txtsym { /* Text Symbol table */
struct hist { /* Stack of include files & #line directives */ struct hist { /* Stack of include files & #line directives */
char *name; /* Assumes names Null terminated in file */ char *name; /* Assumes names Null terminated in file */
long line; /* line # where it was included */ int32 line; /* line # where it was included */
long offset; /* line # of #line directive */ int32 offset; /* line # of #line directive */
}; };
struct file { /* Per input file header to history stack */ struct file { /* Per input file header to history stack */
@ -69,11 +69,11 @@ static Sym **fnames; /* file names path component table */
static Sym **globals; /* globals by addr table */ static Sym **globals; /* globals by addr table */
static Hist *hist; /* base of history stack */ static Hist *hist; /* base of history stack */
static int isbuilt; /* internal table init flag */ static int isbuilt; /* internal table init flag */
static long nauto; /* number of automatics */ static int32 nauto; /* number of automatics */
static long nfiles; /* number of files */ static int32 nfiles; /* number of files */
static long nglob; /* number of globals */ static int32 nglob; /* number of globals */
static long nhist; /* number of history stack entries */ static int32 nhist; /* number of history stack entries */
static long nsym; /* number of symbols */ static int32 nsym; /* number of symbols */
static int ntxt; /* number of text symbols */ static int ntxt; /* number of text symbols */
static uchar *pcline; /* start of pc-line state table */ static uchar *pcline; /* start of pc-line state table */
static uchar *pclineend; /* end of pc-line table */ static uchar *pclineend; /* end of pc-line table */
@ -86,15 +86,15 @@ static uvlong txtend; /* end of text segment */
static uvlong firstinstr; /* as found from symtab; needed for amd64 */ static uvlong firstinstr; /* as found from symtab; needed for amd64 */
static void cleansyms(void); static void cleansyms(void);
static long decodename(Biobuf*, Sym*); static int32 decodename(Biobuf*, Sym*);
static short *encfname(char*); static short *encfname(char*);
static int fline(char*, int, long, Hist*, Hist**); static int fline(char*, int, int32, Hist*, Hist**);
static void fillsym(Sym*, Symbol*); static void fillsym(Sym*, Symbol*);
static int findglobal(char*, Symbol*); static int findglobal(char*, Symbol*);
static int findlocvar(Symbol*, char *, Symbol*); static int findlocvar(Symbol*, char *, Symbol*);
static int findtext(char*, Symbol*); static int findtext(char*, Symbol*);
static int hcomp(Hist*, short*); static int hcomp(Hist*, short*);
static int hline(File*, short*, long*); static int hline(File*, short*, int32*);
static void printhist(char*, Hist*, int); static void printhist(char*, Hist*, int);
static int buildtbls(void); static int buildtbls(void);
static int symcomp(const void*, const void*); static int symcomp(const void*, const void*);
@ -109,7 +109,7 @@ int
syminit(int fd, Fhdr *fp) syminit(int fd, Fhdr *fp)
{ {
Sym *p; Sym *p;
long i, l, size; int32 i, l, size;
vlong vl; vlong vl;
Biobuf b; Biobuf b;
int svalsz; int svalsz;
@ -228,12 +228,12 @@ symerrmsg(int n, char *table)
return -1; return -1;
} }
static long static int32
decodename(Biobuf *bp, Sym *p) decodename(Biobuf *bp, Sym *p)
{ {
char *cp; char *cp;
int c1, c2; int c1, c2;
long n; int32 n;
vlong o; vlong o;
if((p->type & 0x80) == 0) { /* old-style, fixed length names */ if((p->type & 0x80) == 0) { /* old-style, fixed length names */
@ -352,7 +352,7 @@ textseg(uvlong base, Fhdr *fp)
* (special hack for high access rate operations) * (special hack for high access rate operations)
*/ */
Sym * Sym *
symbase(long *n) symbase(int32 *n)
{ {
*n = nsym; *n = nsym;
return symbols; return symbols;
@ -375,7 +375,7 @@ getsym(int index)
static int static int
buildtbls(void) buildtbls(void)
{ {
long i; int32 i;
int j, nh, ng, nt; int j, nh, ng, nt;
File *f; File *f;
Txtsym *tp; Txtsym *tp;
@ -607,7 +607,7 @@ findtext(char *name, Symbol *s)
static int static int
findglobal(char *name, Symbol *s) findglobal(char *name, Symbol *s)
{ {
long i; int32 i;
for(i = 0; i < nglob; i++) { for(i = 0; i < nglob; i++) {
if(cdotstrcmp(globals[i]->name, name) == 0) { if(cdotstrcmp(globals[i]->name, name) == 0) {
@ -881,10 +881,10 @@ globalsym(Symbol *s, int index)
* find the pc given a file name and line offset into it. * find the pc given a file name and line offset into it.
*/ */
uvlong uvlong
file2pc(char *file, long line) file2pc(char *file, int32 line)
{ {
File *fp; File *fp;
long i; int32 i;
uvlong pc, start, end; uvlong pc, start, end;
short *name; short *name;
@ -980,11 +980,11 @@ encfname(char *file)
* the size of intervening files in the stack. * the size of intervening files in the stack.
*/ */
static int static int
hline(File *fp, short *name, long *line) hline(File *fp, short *name, int32 *line)
{ {
Hist *hp; Hist *hp;
int offset, depth; int offset, depth;
long ln; int32 ln;
for(hp = fp->hist; hp->name; hp++) /* find name in stack */ for(hp = fp->hist; hp->name; hp++) /* find name in stack */
if(hp->name[1] || hp->name[2]) { if(hp->name[1] || hp->name[2]) {
@ -1053,10 +1053,10 @@ hcomp(Hist *hp, short *sp)
/* /*
* Convert a pc to a "file:line {file:line}" string. * Convert a pc to a "file:line {file:line}" string.
*/ */
long int32
fileline(char *str, int n, uvlong dot) fileline(char *str, int n, uvlong dot)
{ {
long line, top, bot, mid; int32 line, top, bot, mid;
File *f; File *f;
*str = 0; *str = 0;
@ -1087,11 +1087,11 @@ fileline(char *str, int n, uvlong dot)
* file with included files inserted in line. * file with included files inserted in line.
*/ */
static int static int
fline(char *str, int n, long line, Hist *base, Hist **ret) fline(char *str, int n, int32 line, Hist *base, Hist **ret)
{ {
Hist *start; /* start of current level */ Hist *start; /* start of current level */
Hist *h; /* current entry */ Hist *h; /* current entry */
long delta; /* sum of size of files this level */ int32 delta; /* sum of size of files this level */
int k; int k;
start = base; start = base;
@ -1287,12 +1287,12 @@ pc2sp(uvlong pc)
/* /*
* find the source file line number for a given value of the pc * find the source file line number for a given value of the pc
*/ */
long int32
pc2line(uvlong pc) pc2line(uvlong pc)
{ {
uchar *c, u; uchar *c, u;
uvlong currpc; uvlong currpc;
long currline; int32 currline;
if(pcline == 0) if(pcline == 0)
return -1; return -1;
@ -1331,12 +1331,12 @@ pc2line(uvlong pc)
* a file and the first text address in the following file, respectively. * a file and the first text address in the following file, respectively.
*/ */
uvlong uvlong
line2addr(long line, uvlong basepc, uvlong endpc) line2addr(int32 line, uvlong basepc, uvlong endpc)
{ {
uchar *c, u; uchar *c, u;
uvlong currpc, pc; uvlong currpc, pc;
long currline; int32 currline;
long delta, d; int32 delta, d;
int found; int found;
if(pcline == 0 || line == 0) if(pcline == 0 || line == 0)