This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] Generalized access to MIPS coprocessor registers


The attached patch provides a facility for exposing MIPS coprocessor
registers to user code, via declarations such as the following:

register unsigned int cp0count asm ("c0r1"); /* coprocessor 0 r1 */

It does this in a generalized fashion, and it is fairly easy to drop in a
set of custom coprocessor definitions for a specific MIPS processor rather
than using the general defaults. Exact use is documented in the patch to
tm.texi.

I have run the testsuites, x86-pc-linux-gnu cross mips64-elf, and saw
no regressions. Testsuite entries for this functionality will probably
follow soon.

I'll need approval before I can apply this. I'd imagine some amount of
discussion'll come first, though. :)

2002-04-12  Matt Hiller  <hiller@redhat.com>

	* config/mips/coprocessor-common.h: New file.
	* config/mips/mipscops.md: New file.
	* config/mips/mips.h (COMPLETE_COPROCESSOR_DESCRIPTION_PROVIDED,
	COP0_REG_FIRST, COP0_REG_NUM, COP0_FIXED_REGISTERS,
	COP0_CALL_USED_REGISTERS, COP0_CALL_REALLY_USED_REGISTERS,
	COP0_REGSET, COP0_AND_GR_REGSET, COP0_REG_CLASS_LIST,
	COP0_REG_NAMES, COP0_SW_REG_NAMES, COP0_DEBUG_REGISTER_NAMES,
	COP1_REG_NUM, COP1_FIXED_REGISTERS,
	COP1_CALL_USED_REGISTERS, COP1_CALL_REALLY_USED_REGISTERS,
	COP1_REGSET, COP1_AND_GR_REGSET, COP1_REG_CLASS_LIST,
	COP1_REG_NAMES, COP1_SW_REG_NAMES, COP1_DEBUG_REGISTER_NAMES,
	COP2_REG_NUM, COP2_FIXED_REGISTERS,
	COP2_CALL_USED_REGISTERS, COP2_CALL_REALLY_USED_REGISTERS,
	COP2_REGSET, COP2_AND_GR_REGSET, COP2_REG_CLASS_LIST,
	COP2_REG_NAMES, COP2_SW_REG_NAMES, COP2_DEBUG_REGISTER_NAMES,
	COP3_REG_NUM, COP3_FIXED_REGISTERS,
	COP3_CALL_USED_REGISTERS, COP3_CALL_REALLY_USED_REGISTERS,
	COP3_REGSET, COP3_AND_GR_REGSET, COP3_REG_CLASS_LIST,
	COP3_REG_NAMES, COP3_SW_REG_NAMES, COP3_DEBUG_REGISTER_NAMES,
	ALL_COP_MIPS_CHAR_TO_CLASSES, ALL_COP_REG_ALLOC_ORDER,
	ALL_COP_ADDITIONAL_REGISTER_NAMES, ALL_COP_REGISTER_MOVE_COSTS,
	ALL_COP_CLASS_MAX_NREGS, ALL_COP_HARD_REGNO_MODE,
	ALL_COP_REGSET, ALL_COP_AND_GR_REGSET, ALL_REGSET): New macros,
	intended as programmer hooks.

	(FIRST_PSEUDO_REGISTER): Redefine considering coprocessor
	registers, adjust comment accordingly.
	(COP1_REG_FIRST, COP2_REG_FIRST, COP3_REG_FIRST,
	COP0_REG_LAST, COP1_REG_LAST, COP2_REG_LAST, COP3_REG_LAST,
	COP0_REG_P, COP1_REG_P, COP2_REG_P, COP3_REG_P, ALL_COP_REG_P,
	COP_REG_CLASS_P): New macros.
	(FIXED_REGISTERS, CALL_USED_REGISTERS, CALL_REALLY_USED_REGISTERS,
	reg_class, REG_CLASS_NAMES, REG_CLASS_CONTENTS, REG_ALLOC_ORDER,
	CLASS_MAX_NREGS, REGISTER_MOVE_COST, DEBUG_REGISTER_NAMES,
	ADDITIONAL_REGISTER_NAMES): Include relevant coprocessor macros.
	(REGISTER_NAMES): Adjust comment, include relevant coprocessor
	macro.
	(mips_char_to_class): Adjust comment to include coprocessor
	constraint letters.	

	* config/mips/mips.c (coprocessor_operand, coprocessor2_operand):
	New functions.
	(mips_reg_names, mips_sw_reg_names, mips_regno_to_class): Include
	relevant coprocessor macros.
	(move_operand): Don't accept coprocessor operands for regular
	moves.
	(override_options): Initialize mips_char_to_class and
	mips_hard_regno_mode_ok properly for coprocessor registers.

	* config/mips/mips.md: include mipscops.md.

	* doc/tm.texi: Document feature, macros, and hooks.

Attachment: generic_coprocessor_0412.patch.gz
Description: GNU Zip compressed data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]