summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn van Groningen2006-05-01 14:17:26 +0000
committerJohn van Groningen2006-05-01 14:17:26 +0000
commitb2d4c9be8fd379aa56d8bc392f94b3fb0dc055ef (patch)
tree42f1f2423ebdad6d00aaa85b462a045002f81a43
parentenable NO_STRING_ADDRESS_IN_DESCRIPTOR for sparc (diff)
use int_64 instead of __int64, define int_64, include stdint.h on 64 bits linux
-rw-r--r--cgaas.c23
-rw-r--r--cgaas.h4
-rw-r--r--cgawas.c13
-rw-r--r--cgcalc.c3
-rw-r--r--cgcode.c9
-rw-r--r--cginput.c3
-rw-r--r--cginstructions.c3
-rw-r--r--cglin.c14
-rw-r--r--cgopt.c4
-rw-r--r--cgport.h19
-rw-r--r--cgstack.c4
-rw-r--r--cgtypes.h4
12 files changed, 73 insertions, 30 deletions
diff --git a/cgaas.c b/cgaas.c
index 39a0b5a..626650d 100644
--- a/cgaas.c
+++ b/cgaas.c
@@ -9,6 +9,9 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
+#ifdef LINUX
+# include <stdint.h>
+#endif
#ifdef __MWERKS__
# define I486
@@ -361,11 +364,11 @@ void store_long_word_in_data_section (ULONG c)
}
}
-void store_word64_in_data_section (__int64 c)
+void store_word64_in_data_section (int_64 c)
{
if (data_buffer_free>=8){
data_buffer_free-=8;
- *(__int64*)data_buffer_p=c;
+ *(int_64*)data_buffer_p=c;
data_buffer_p+=8;
} else {
store_long_word_in_data_section ((ULONG)c);
@@ -398,19 +401,19 @@ void store_abc_string_in_data_section (char *string,int length)
store_word64_in_data_section (length);
while (length>=8){
- store_word64_in_data_section (*(__int64*)string_p);
+ store_word64_in_data_section (*(int_64*)string_p);
string_p+=8;
length-=8;
}
if (length>0){
- unsigned __int64 d;
+ uint_64 d;
int shift;
d=0;
shift=0;
while (length>0){
- d |= (unsigned __int64)string_p[0]<<shift;
+ d |= (uint_64)string_p[0]<<shift;
shift+=8;
--length;
++string_p;
@@ -637,7 +640,7 @@ static void as_r (int code1,int code2,int reg1)
store_c (0300 | code2 | (reg1_n & 7));
}
-static void as_move_i64_r (__int64 i,int reg1)
+static void as_move_i64_r (int_64 i,int reg1)
{
int reg1_n;
@@ -2264,16 +2267,16 @@ static void as_parameter (int code1,int code2,struct parameter *parameter)
Granlund, Torbjorn and Montgomery, Peter L. [1994]. SIGPLAN Notices, 29 (June), 61.
*/
-struct ms magic (__int64 d)
+struct ms magic (int_64 d)
/* must have 2 <= d <= 231-1 or -231 <= d <= -2 */
{
int p;
- unsigned __int64 ad, anc, delta, q1, r1, q2, r2, t;
- const unsigned __int64 two63 = (unsigned __int64)1<<63;/* 263 */
+ uint_64 ad, anc, delta, q1, r1, q2, r2, t;
+ const uint_64 two63 = (uint_64)1<<63;/* 263 */
struct ms mag;
ad = d>=0 ? d : -d;
- t = two63 + ((unsigned __int64)d >> 63);
+ t = two63 + ((uint_64)d >> 63);
anc = t - 1 - t%ad; /* absolute value of nc */
p = 63; /* initialize p */
q1 = two63/anc; /* initialize q1 = 2p/abs(nc) */
diff --git a/cgaas.h b/cgaas.h
index 89af0dc..d9631fc 100644
--- a/cgaas.h
+++ b/cgaas.h
@@ -29,7 +29,7 @@ void write_version_and_options (int version,int options);
void write_depend (char *module_name);
#endif
-struct ms { __int64 m; int s; };
+struct ms { int_64 m; int s; };
-extern struct ms magic (__int64 d);
+extern struct ms magic (int_64 d);
diff --git a/cgawas.c b/cgawas.c
index f1db070..d300d77 100644
--- a/cgawas.c
+++ b/cgawas.c
@@ -8,6 +8,9 @@
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
+#if defined (LINUX) && defined (G_AI64)
+# include <stdint.h>
+#endif
#undef GENERATIONAL_GC
#define LEA_ADDRESS
@@ -145,7 +148,7 @@ void w_as_long_in_data_section (int n)
w_as_newline();
}
-static void print_int64 (unsigned __int64 n)
+static void print_int64 (uint_64 n)
{
static char digits[32];
char *p;
@@ -158,7 +161,7 @@ static void print_int64 (unsigned __int64 n)
p=&digits[31];
*p='\0';
while (n>9){
- unsigned __int64 m;
+ uint_64 m;
m=n/10;
*--p='0'+(n-10*m);
@@ -169,7 +172,7 @@ static void print_int64 (unsigned __int64 n)
fprintf (assembly_file,p);
}
-void w_as_word64_in_data_section (__int64 n)
+void w_as_word64_in_data_section (int_64 n)
{
#ifdef DATA_IN_CODE_SECTION
if (!in_data_section){
@@ -440,7 +443,7 @@ static void w_as_internal_label (int label_number)
fprintf (assembly_file,"i_%d",label_number);
}
-static void w_as_immediate (__int64 i)
+static void w_as_immediate (int_64 i)
{
if ((int)i==i)
fprintf (assembly_file,intel_asm ? "%I64i" : "$%I64u",i);
@@ -870,7 +873,7 @@ static void w_as_movl_register_register_newline (int reg1,int reg2)
w_as_register_register_newline (reg1,reg2);
}
-static void w_as_immediate_register_newline (__int64 i,int reg)
+static void w_as_immediate_register_newline (int_64 i,int reg)
{
if (!intel_asm){
w_as_immediate (i);
diff --git a/cgcalc.c b/cgcalc.c
index 78f0374..e438065 100644
--- a/cgcalc.c
+++ b/cgcalc.c
@@ -7,6 +7,9 @@
#pragma segment Code1
#include <stdio.h>
+#if defined (LINUX) && defined (G_AI64)
+# include <stdint.h>
+#endif
#include "cgport.h"
#include "cg.h"
#include "cgrconst.h"
diff --git a/cgcode.c b/cgcode.c
index e1d36d3..f43c51d 100644
--- a/cgcode.c
+++ b/cgcode.c
@@ -6,6 +6,9 @@
#include <stdio.h>
#include <string.h>
+#if defined (LINUX) && defined (G_AI64)
+# include <stdint.h>
+#endif
#if defined (G_POWER) || defined (I486) || defined (sparc)
# define NO_STRING_ADDRESS_IN_DESCRIPTOR
@@ -7913,7 +7916,7 @@ void code_caf (char *label_name,int a_stack_size,int b_stack_size)
#endif
if (assembly_flag)
#ifdef G_A64
- w_as_word64_in_data_section ((__int64)0);
+ w_as_word64_in_data_section ((int_64)0);
#else
w_as_long_in_data_section (0);
#endif
@@ -7947,7 +7950,7 @@ void code_caf (char *label_name,int a_stack_size,int b_stack_size)
#endif
if (assembly_flag)
#ifdef G_A64
- w_as_word64_in_data_section ((__int64)0);
+ w_as_word64_in_data_section ((int_64)0);
#else
w_as_long_in_data_section (0);
#endif
@@ -8860,7 +8863,7 @@ void code_pb (char string[],int string_length)
w_as_define_data_label (profile_function_label->label_number);
# endif
# ifdef G_A64
- w_as_word64_in_data_section ((__int64)0);
+ w_as_word64_in_data_section ((int_64)0);
# else
w_as_long_in_data_section (0);
# endif
diff --git a/cginput.c b/cginput.c
index ab44aa8..8bed814 100644
--- a/cginput.c
+++ b/cginput.c
@@ -8,6 +8,9 @@
#define COMPATIBLE_DESC 0
#include <string.h>
+#if defined (LINUX) && defined (G_AI64)
+# include <stdint.h>
+#endif
#include "cgport.h"
diff --git a/cginstructions.c b/cginstructions.c
index f4cf7ce..2c27898 100644
--- a/cginstructions.c
+++ b/cginstructions.c
@@ -6,6 +6,9 @@
#include <stdio.h>
#include <string.h>
+#if defined (LINUX) && defined (G_AI64)
+# include <stdint.h>
+#endif
#include "cgport.h"
diff --git a/cglin.c b/cglin.c
index e5f7a16..7861af4 100644
--- a/cglin.c
+++ b/cglin.c
@@ -5,6 +5,10 @@
*/
#include <stdio.h>
+#if defined (LINUX) && defined (G_AI64)
+# include <stdint.h>
+#endif
+
#include "cgport.h"
#include "cg.h"
#include "cgconst.h"
@@ -1089,7 +1093,7 @@ void i_movew_id_r (int offset,int register_1,int register_2)
}
#ifdef G_A64
-static void i_move_i_id (__int64 i,int offset_1,int register_1)
+static void i_move_i_id (int_64 i,int offset_1,int register_1)
#else
static void i_move_i_id (LONG i,int offset_1,int register_1)
#endif
@@ -1136,7 +1140,7 @@ void i_move_i_r (CleanInt i,int register_1)
#if defined (M68000) || defined (I486)
# ifdef G_A64
-static void i_move_i_x (__int64 i,int offset,int register_1,int register_2)
+static void i_move_i_x (int_64 i,int offset,int register_1,int register_2)
# else
static void i_move_i_x (LONG i,int offset,int register_1,int register_2)
# endif
@@ -4443,7 +4447,7 @@ static void move_float_ad_id (ADDRESS *ad_p,int offset,int areg)
return;
case P_F_IMMEDIATE:
#ifdef G_A64
- i_move_i_id (((__int64*)&ad_p->ad_register)[0],offset,areg);
+ i_move_i_id (((int_64*)&ad_p->ad_register)[0],offset,areg);
#else
i_move_i_id (((LONG*)&ad_p->ad_register)[0],offset,areg);
i_move_i_id (((LONG*)&ad_p->ad_register)[1],offset+4,areg);
@@ -5112,7 +5116,7 @@ static void move_float_ad_x (ADDRESS *ad_p,int offset,int areg,int dreg)
return;
case P_F_IMMEDIATE:
#ifdef G_A64
- i_move_i_x (((__int64*)&ad_p->ad_register)[0],offset,areg,dreg);
+ i_move_i_x (((int_64*)&ad_p->ad_register)[0],offset,areg,dreg);
#else
i_move_i_x (((LONG*)&ad_p->ad_register)[0],offset,areg,dreg);
i_move_i_x (((LONG*)&ad_p->ad_register)[1],offset+(4<<2),areg,dreg);
@@ -5883,7 +5887,7 @@ static void linearize_fromf_operator (INSTRUCTION_GRAPH graph,ADDRESS *ad_p)
else
reg=get_aregister();
- i_move_i_r (((__int64*)&r)[0],reg);
+ i_move_i_r (((int_64*)&r)[0],reg);
ad_p->ad_mode=P_REGISTER;
ad_p->ad_register=reg;
ad_p->ad_count_p=&graph->node_count;
diff --git a/cgopt.c b/cgopt.c
index beff6ff..0f7e22c 100644
--- a/cgopt.c
+++ b/cgopt.c
@@ -5,6 +5,10 @@
*/
#include <stdio.h>
+#if defined (LINUX) && defined (G_AI64)
+# include <stdint.h>
+#endif
+
#include "cgport.h"
#include "cg.h"
#include "cgrconst.h"
diff --git a/cgport.h b/cgport.h
index 975159f..2bb0a4f 100644
--- a/cgport.h
+++ b/cgport.h
@@ -55,9 +55,14 @@
# endif
#endif
-#define LONG long
+#if defined (LINUX) && defined (G_A64)
+# define LONG int
+# define ULONG unsigned int
+#else
+# define LONG long
+# define ULONG unsigned long
+#endif
#define BYTE char
-#define ULONG unsigned long
#define UBYTE unsigned char
#define VOID void
@@ -83,7 +88,15 @@
#else
# define STACK_ELEMENT_SIZE 8
# define STACK_ELEMENT_LOG_SIZE 3
-# define CleanInt __int64
+# if defined (LINUX)
+# define CleanInt int64_t
+# define int_64 int64_t
+# define uint_64 uint64_t
+# else
+# define CleanInt __int64
+# define int_64 __int64
+# define uint_64 unsigned __int64
+# endif
#endif
#if defined (I486) || (defined (G_POWER) || defined (ALIGN_C_CALLS)) || defined (MACH_O)
diff --git a/cgstack.c b/cgstack.c
index e99df94..f5de409 100644
--- a/cgstack.c
+++ b/cgstack.c
@@ -5,6 +5,10 @@
*/
#include <stdio.h>
+#if defined (LINUX) && defined (G_AI64)
+# include <stdint.h>
+#endif
+
#include "cgport.h"
#include "cgconst.h"
#include "cgrconst.h"
diff --git a/cgtypes.h b/cgtypes.h
index 8b4d304..d299076 100644
--- a/cgtypes.h
+++ b/cgtypes.h
@@ -109,7 +109,7 @@ struct parameter {
union parameter_data {
LONG i;
#ifdef G_A64
- __int64 imm;
+ int_64 imm;
#endif
LABEL *l;
DOUBLE *r;
@@ -159,7 +159,7 @@ struct instruction_node {
LABEL * l;
LONG i;
# ifdef G_A64
- __int64 imm;
+ int_64 imm;
# endif
}
#endif