[m-rev.] diff: commit Peter Hawkins' patch for global registers on x86_64
Julien Fischer
juliensf at cs.mu.OZ.AU
Mon Aug 29 17:53:03 AEST 2005
Estimated hours taken: 0.1 (+ unknown time by hawkinsp)
Branches: main
Commit Peter Hawkins' patch for global registers on x86_64.
(The actual registers we use may need some finessing but we can
do that when we have more experience with this architecture.)
runtime/mercury_regs.h:
runtime/machdeps/x86_64_regs.h:
Global register declarations for x86_64.
runtime/Mmakefile:
Add x86_64_regs.h to the list of machine dependent
headers.
runtime/machdeps/README:
Mention that the above Mmakefile needs to be updated
when adding a new architecture.
Julien.
Index: runtime/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/Mmakefile,v
retrieving revision 1.123
diff -u -r1.123 Mmakefile
--- runtime/Mmakefile 20 May 2005 06:15:18 -0000 1.123
+++ runtime/Mmakefile 29 Aug 2005 07:38:51 -0000
@@ -130,7 +130,8 @@
machdeps/sparc_regs.h \
machdeps/alpha_regs.h \
machdeps/pa_regs.h \
- machdeps/rs6000_regs.h
+ machdeps/rs6000_regs.h \
+ machdeps/x86_64_regs.h
# MCPP_HDRS are header files in Microsoft's Managed extensions for C++
Index: runtime/mercury_regs.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_regs.h,v
retrieving revision 1.24
diff -u -r1.24 mercury_regs.h
--- runtime/mercury_regs.h 16 Jul 2004 12:14:27 -0000 1.24
+++ runtime/mercury_regs.h 29 Aug 2005 07:38:51 -0000
@@ -82,6 +82,8 @@
#include "machdeps/mips_regs.h"
#elif defined(__i386__)
#include "machdeps/i386_regs.h"
+ #elif defined(__x86_64__)
+ #include "machdeps/x86_64_regs.h"
#elif defined(__sparc__)
#include "machdeps/sparc_regs.h"
#elif defined(__alpha__)
Index: runtime/machdeps/README
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/machdeps/README,v
retrieving revision 1.1
diff -u -r1.1 README
--- runtime/machdeps/README 31 Jan 1997 07:53:58 -0000 1.1
+++ runtime/machdeps/README 29 Aug 2005 07:40:39 -0000
@@ -34,3 +34,5 @@
- Add a new case to the switch on machine type in `../regs.h';
this new case should #include the header file you just added.
+
+ - Add the new header file to the MACHDEPS list in runtime/Mmakefile.
Index: runtime/machdeps/x86_64_regs.h
===================================================================
RCS file: runtime/machdeps/x86_64_regs.h
diff -N runtime/machdeps/x86_64_regs.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ runtime/machdeps/x86_64_regs.h 29 Aug 2005 07:41:09 -0000
@@ -0,0 +1,86 @@
+/*
+** Copyright (C) 2005 The University of Melbourne.
+** This file may only be copied under the terms of the GNU Library General
+** Public License - see the file COPYING.LIB in the Mercury distribution.
+*/
+#ifndef MR_MACHDEPS_X86_64_REGS_H
+#define MR_MACHDEPS_X86_64_REGS_H
+
+/*
+** Machine registers MR_mr0 - MR_mr36 for the x86-64 architecture.
+**
+** The first MR_NUM_REAL_REGS of these are real machine registers.
+** The others are just slots in a global array.
+**
+** At the moment we're only using the callee-save registers
+** (r12-r15).
+**
+*/
+
+#define MR_NUM_REAL_REGS 4
+
+register MR_Word MR_mr0 __asm__("r12"); /* sp */
+register MR_Word MR_mr1 __asm__("r13"); /* succip */
+register MR_Word MR_mr2 __asm__("r14"); /* succip */
+register MR_Word MR_mr3 __asm__("r15"); /* succip */
+
+#define MR_real_reg_number_mr0 r12
+#define MR_real_reg_number_mr1 r13
+#define MR_real_reg_number_mr2 r14
+#define MR_real_reg_number_mr3 r15
+
+#define MR_save_regs_to_mem(save_area) ( \
+ save_area[0] = MR_mr0, \
+ save_area[1] = MR_mr1, \
+ save_area[2] = MR_mr2, \
+ save_area[3] = MR_mr3, \
+ (void)0 \
+)
+
+#define MR_restore_regs_from_mem(save_area) ( \
+ MR_mr0 = save_area[0], \
+ MR_mr1 = save_area[1], \
+ MR_mr2 = save_area[2], \
+ MR_mr3 = save_area[3], \
+ (void)0 \
+)
+
+#define MR_save_transient_regs_to_mem(save_area) ((void)0)
+#define MR_restore_transient_regs_from_mem(save_area) ((void)0)
+
+#define MR_mr4 MR_fake_reg[4]
+#define MR_mr5 MR_fake_reg[5]
+#define MR_mr6 MR_fake_reg[6]
+#define MR_mr7 MR_fake_reg[7]
+#define MR_mr8 MR_fake_reg[8]
+#define MR_mr9 MR_fake_reg[9]
+#define MR_mr10 MR_fake_reg[10]
+#define MR_mr11 MR_fake_reg[11]
+#define MR_mr12 MR_fake_reg[12]
+#define MR_mr13 MR_fake_reg[13]
+#define MR_mr14 MR_fake_reg[14]
+#define MR_mr15 MR_fake_reg[15]
+#define MR_mr16 MR_fake_reg[16]
+#define MR_mr17 MR_fake_reg[17]
+#define MR_mr18 MR_fake_reg[18]
+#define MR_mr19 MR_fake_reg[19]
+#define MR_mr20 MR_fake_reg[20]
+#define MR_mr21 MR_fake_reg[21]
+#define MR_mr22 MR_fake_reg[22]
+#define MR_mr23 MR_fake_reg[23]
+#define MR_mr24 MR_fake_reg[24]
+#define MR_mr25 MR_fake_reg[25]
+#define MR_mr26 MR_fake_reg[26]
+#define MR_mr27 MR_fake_reg[27]
+#define MR_mr28 MR_fake_reg[28]
+#define MR_mr29 MR_fake_reg[29]
+#define MR_mr30 MR_fake_reg[30]
+#define MR_mr31 MR_fake_reg[31]
+#define MR_mr32 MR_fake_reg[32]
+#define MR_mr33 MR_fake_reg[33]
+#define MR_mr34 MR_fake_reg[34]
+#define MR_mr35 MR_fake_reg[35]
+#define MR_mr36 MR_fake_reg[36]
+#define MR_mr37 MR_fake_reg[37]
+
+#endif /* not MR_MACHDEPS_X86_64_REGS_H */
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list