1
0
mirror of https://github.com/golang/go synced 2024-11-13 16:10:25 -07:00

move bits.c from 6g to gc

R=ken
OCL=26909
CL=26909
This commit is contained in:
Russ Cox 2009-03-30 16:13:11 -07:00
parent f538760552
commit 531f242f5d
6 changed files with 63 additions and 40 deletions

View File

@ -22,7 +22,6 @@ OFILES=\
obj.$O\ obj.$O\
peep.$O\ peep.$O\
reg.$O\ reg.$O\
bits.$O\
../6l/enam.$O\ ../6l/enam.$O\
LIB=\ LIB=\

View File

@ -28,13 +28,9 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#define Z N #define Z N
#define Adr Addr #define Adr Addr
#define BITS 5
#define NVAR (BITS*sizeof(uint32)*8)
#define D_HI D_NONE #define D_HI D_NONE
#define D_LO D_NONE #define D_LO D_NONE
@ -50,16 +46,9 @@
#define CINF 1000 #define CINF 1000
#define LOOP 3 #define LOOP 3
typedef struct Bits Bits;
typedef struct Reg Reg; typedef struct Reg Reg;
typedef struct Var Var;
typedef struct Rgn Rgn; typedef struct Rgn Rgn;
struct Bits
{
uint32 b[BITS];
};
struct Reg struct Reg
{ {
@ -91,14 +80,6 @@ struct Reg
}; };
#define R ((Reg*)0) #define R ((Reg*)0)
struct Var
{
vlong offset;
Sym* sym;
char name;
char etype;
};
#define NRGN 600 #define NRGN 600
struct Rgn struct Rgn
{ {
@ -108,14 +89,12 @@ struct Rgn
short regno; short regno;
}; };
EXTERN int32 exregoffset; // not set EXTERN int32 exregoffset; // not set
EXTERN int32 exfregoffset; // not set EXTERN int32 exfregoffset; // not set
EXTERN Reg* firstr; EXTERN Reg* firstr;
EXTERN Reg* lastr; EXTERN Reg* lastr;
EXTERN Reg zreg; EXTERN Reg zreg;
EXTERN Reg* freer; EXTERN Reg* freer;
EXTERN Var var[NVAR];
EXTERN Reg** rpo2r; EXTERN Reg** rpo2r;
EXTERN Rgn region[NRGN]; EXTERN Rgn region[NRGN];
EXTERN Rgn* rgp; EXTERN Rgn* rgp;
@ -129,24 +108,10 @@ EXTERN Bits consts;
EXTERN Bits addrs; EXTERN Bits addrs;
EXTERN Bits ovar; EXTERN Bits ovar;
EXTERN int change; EXTERN int change;
EXTERN Bits zbits;
EXTERN int32 maxnr; EXTERN int32 maxnr;
EXTERN int32* idom; EXTERN int32* idom;
/* EXTERN struct
* bits.c
*/
Bits bor(Bits, Bits);
Bits band(Bits, Bits);
Bits bnot(Bits);
int bany(Bits*);
int bnum(Bits);
Bits blsh(uint);
int beq(Bits, Bits);
int bset(Bits, uint);
int Qconv(Fmt *fp);
int bitno(int32);
struct
{ {
int32 ncvtreg; int32 ncvtreg;
int32 nspill; int32 nspill;

View File

@ -28,6 +28,7 @@ OFILES=\
mparith3.$O\ mparith3.$O\
builtin.$O\ builtin.$O\
compat.$O\ compat.$O\
bits.$O\
$(LIB): $(OFILES) $(LIB): $(OFILES)
ar rsc $(LIB) $(OFILES) ar rsc $(LIB) $(OFILES)

View File

@ -28,8 +28,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#include "gg.h" #include "go.h"
#include "opt.h"
Bits Bits
bor(Bits a, Bits b) bor(Bits a, Bits b)

View File

@ -11,7 +11,7 @@
#include "compat.h" #include "compat.h"
#ifndef EXTERN #ifndef EXTERN
#define EXTERN extern #define EXTERN extern
#endif #endif
enum enum
{ {
@ -420,6 +420,29 @@ enum
Erv, // evaluated in rvalue context Erv, // evaluated in rvalue context
}; };
#define BITS 5
#define NVAR (BITS*sizeof(uint32)*8)
typedef struct Bits Bits;
struct Bits
{
uint32 b[BITS];
};
EXTERN Bits zbits;
typedef struct Var Var;
struct Var
{
vlong offset;
Sym* sym;
char name;
char etype;
};
EXTERN Var var[NVAR];
typedef struct Io Io; typedef struct Io Io;
struct Io struct Io
{ {
@ -871,3 +894,17 @@ Node* nodarg(Type*, int);
void nodconst(Node*, Type*, vlong); void nodconst(Node*, Type*, vlong);
Type* deep(Type*); Type* deep(Type*);
Type* shallow(Type*); Type* shallow(Type*);
/*
* bits.c
*/
Bits bor(Bits, Bits);
Bits band(Bits, Bits);
Bits bnot(Bits);
int bany(Bits*);
int bnum(Bits);
Bits blsh(uint);
int beq(Bits, Bits);
int bset(Bits, uint);
int Qconv(Fmt *fp);
int bitno(int32);

22
src/cmd/make8.bash Normal file
View File

@ -0,0 +1,22 @@
# Copyright 2009 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
#!/bin/bash
set -e
bash clean.bash
cd 8l
bash mkenam
make enam.o
cd ..
for i in cc 8l 8a 8c gc 8g ar db nm acid cov gobuild godefs prof gotest
do
echo; echo; echo %%%% making $i %%%%; echo
cd $i
make install
cd ..
done