github.com/bgentry/go@v0.0.0-20150121062915-6cf5a733d54d/src/cmd/6g/galign.c (about)

     1  // Copyright 2009 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  #include <u.h>
     6  #include <libc.h>
     7  #include "gg.h"
     8  
     9  int	thechar	= '6';
    10  char*	thestring	= "amd64";
    11  LinkArch*	thelinkarch = &linkamd64;
    12  
    13  void
    14  linkarchinit(void)
    15  {
    16  	if(strcmp(getgoarch(), "amd64p32") == 0)
    17  		thelinkarch = &linkamd64p32;
    18  }
    19  
    20  vlong MAXWIDTH = 1LL<<50;
    21  
    22  int	addptr = AADDQ;
    23  int	movptr = AMOVQ;
    24  int	leaptr = ALEAQ;
    25  int	cmpptr = ACMPQ;
    26  
    27  /*
    28   * go declares several platform-specific type aliases:
    29   * int, uint, float, and uintptr
    30   */
    31  Typedef	typedefs[] =
    32  {
    33  	{"int",		TINT,		TINT64},
    34  	{"uint",		TUINT,		TUINT64},
    35  	{"uintptr",	TUINTPTR,	TUINT64},
    36  	{0}
    37  };
    38  
    39  void
    40  betypeinit(void)
    41  {
    42  	widthptr = 8;
    43  	widthint = 8;
    44  	widthreg = 8;
    45  	if(strcmp(getgoarch(), "amd64p32") == 0) {
    46  		widthptr = 4;
    47  		widthint = 4;
    48  		addptr = AADDL;
    49  		movptr = AMOVL;
    50  		leaptr = ALEAL;
    51  		cmpptr = ACMPL;
    52  		typedefs[0].sameas = TINT32;
    53  		typedefs[1].sameas = TUINT32;
    54  		typedefs[2].sameas = TUINT32;
    55  		
    56  	}
    57  
    58  	zprog.link = P;
    59  	zprog.as = AGOK;
    60  	zprog.from.type = D_NONE;
    61  	zprog.from.index = D_NONE;
    62  	zprog.from.scale = 0;
    63  	zprog.to = zprog.from;
    64  
    65  	listinit6();
    66  }