summaryrefslogtreecommitdiff
path: root/gcc/common
diff options
context:
space:
mode:
authorjgreenhalgh <jgreenhalgh@138bc75d-0d04-0410-961f-82ee72b054a4>2013-12-17 12:24:05 +0000
committerjgreenhalgh <jgreenhalgh@138bc75d-0d04-0410-961f-82ee72b054a4>2013-12-17 12:24:05 +0000
commitb7188fad665f9018305b04c701953472de7bf01b (patch)
tree2e0eacf98d499c447aafacc0005c6874b39d91f3 /gcc/common
parente534aceb45dfc8a56febddf7e3dbee5144d0be9f (diff)
downloadgcc-b7188fad665f9018305b04c701953472de7bf01b.tar.gz
[ARM 1/5 big.LITTLE] Add driver support for rewriting -mcpu names
gcc/ * common/config/arm/arm-common.c (arm_rewrite_selected_cpu): New. (arm_rewrite_mcpu): Likewise. * config/arm/arm-protos.h (arm_rewrite_selected_cpu): New. * config/arm/arm.h (BIG_LITTLE_SPEC): New. (BIG_LITTLE_SPEC_FUNCTIONS): Likewise. (EXTRA_SPEC_FUNCTIONS): Include BIG_LITTLE_SPEC_FUNCTIONS. (ASM_CPU_SPEC): Include BIG_LITTLE_SPEC. * config/arm/arm.c (arm_file_start): Rewrite arm_selecetd_cpu values. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206045 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/common')
-rw-r--r--gcc/common/config/arm/arm-common.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/gcc/common/config/arm/arm-common.c b/gcc/common/config/arm/arm-common.c
index c43a2ce927b..87f18ecea77 100644
--- a/gcc/common/config/arm/arm-common.c
+++ b/gcc/common/config/arm/arm-common.c
@@ -63,6 +63,41 @@ arm_except_unwind_info (struct gcc_options *opts)
return UI_SJLJ;
}
+#define ARM_CPU_NAME_LENGTH 20
+
+/* Truncate NAME at the first '.' character seen, or return
+ NAME unmodified. */
+
+const char *
+arm_rewrite_selected_cpu (const char *name)
+{
+ static char output_buf[ARM_CPU_NAME_LENGTH + 1] = {0};
+ char *arg_pos;
+
+ strncpy (output_buf, name, ARM_CPU_NAME_LENGTH);
+ arg_pos = strchr (output_buf, '.');
+
+ /* If we found a '.' truncate the entry at that point. */
+ if (arg_pos)
+ *arg_pos = '\0';
+
+ return output_buf;
+}
+
+/* Called by the driver to rewrite a name passed to the -mcpu
+ argument in preparation to be passed to the assembler. The
+ name will be in ARGV[0], ARGC should always be 1. */
+
+const char *
+arm_rewrite_mcpu (int argc, const char **argv)
+{
+ gcc_assert (argc == 1);
+ return arm_rewrite_selected_cpu (argv[0]);
+}
+
+#undef ARM_CPU_NAME_LENGTH
+
+
#undef TARGET_DEFAULT_TARGET_FLAGS
#define TARGET_DEFAULT_TARGET_FLAGS (TARGET_DEFAULT | MASK_SCHED_PROLOG)