aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorKito Cheng <kito.cheng@gmail.com>2018-03-11 08:42:30 +0000
committerChung-Ju Wu <jasonwucj@gcc.gnu.org>2018-03-11 08:42:30 +0000
commit72b7e5e1b2da6d6aff25e7837c2f3a6b91f84229 (patch)
treef369e48d432a6de4dca9f07ee7790018bf2c62bc /gcc
parent483c57af553b22721f46bfdbd2795ac004767a51 (diff)
downloadgcc-72b7e5e1b2da6d6aff25e7837c2f3a6b91f84229.zip
gcc-72b7e5e1b2da6d6aff25e7837c2f3a6b91f84229.tar.gz
gcc-72b7e5e1b2da6d6aff25e7837c2f3a6b91f84229.tar.bz2
[NDS32] Add new function nds32_cpu_cpp_builtins and use it for TARGET_CPU_CPP_BUILTINS.
gcc/ * config/nds32/nds32-protos.h (nds32_cpu_cpp_builtins): Declare function. * config/nds32/nds32.c (nds32_cpu_cpp_builtins): New function. * config/nds32/nds32.h (TARGET_CPU_CPP_BUILTINS): Modify its definition. Co-Authored-By: Chung-Ju Wu <jasonwucj@gmail.com> From-SVN: r258426
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/config/nds32/nds32-protos.h3
-rw-r--r--gcc/config/nds32/nds32.c48
-rw-r--r--gcc/config/nds32/nds32.h34
4 files changed, 62 insertions, 32 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d429cd2..5d2df1d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,6 +1,15 @@
2018-03-11 Kito Cheng <kito.cheng@gmail.com>
Chung-Ju Wu <jasonwucj@gmail.com>
+ * config/nds32/nds32-protos.h (nds32_cpu_cpp_builtins): Declare
+ function.
+ * config/nds32/nds32.c (nds32_cpu_cpp_builtins): New function.
+ * config/nds32/nds32.h (TARGET_CPU_CPP_BUILTINS): Modify its
+ definition.
+
+2018-03-11 Kito Cheng <kito.cheng@gmail.com>
+ Chung-Ju Wu <jasonwucj@gmail.com>
+
* config/nds32/nds32-memory-manipulation.c (nds32_expand_strlen): New
function.
* config/nds32/nds32-multiple.md (strlensi): New pattern.
diff --git a/gcc/config/nds32/nds32-protos.h b/gcc/config/nds32/nds32-protos.h
index e1522f9..fe2509b 100644
--- a/gcc/config/nds32/nds32-protos.h
+++ b/gcc/config/nds32/nds32-protos.h
@@ -156,4 +156,7 @@ extern bool nds32_isr_function_p (tree);
extern bool nds32_rtx_costs_impl (rtx, machine_mode, int, int, int *, bool);
extern int nds32_address_cost_impl (rtx, machine_mode, addr_space_t, bool);
+/* Auxiliary functions for pre-define marco. */
+extern void nds32_cpu_cpp_builtins(struct cpp_reader *);
+
/* ------------------------------------------------------------------------ */
diff --git a/gcc/config/nds32/nds32.c b/gcc/config/nds32/nds32.c
index 085a7b8..f1e64cd 100644
--- a/gcc/config/nds32/nds32.c
+++ b/gcc/config/nds32/nds32.c
@@ -47,6 +47,7 @@
#include "expr.h"
#include "tm-constrs.h"
#include "builtins.h"
+#include "cpplib.h"
/* This file should be included last. */
#include "target-def.h"
@@ -2751,6 +2752,53 @@ nds32_expand_builtin (tree exp,
/* PART 4: Implemet extern function definitions,
the prototype is in nds32-protos.h. */
+/* Run-time Target Specification. */
+
+void
+nds32_cpu_cpp_builtins(struct cpp_reader *pfile)
+{
+#define builtin_define(TXT) cpp_define (pfile, TXT)
+#define builtin_assert(TXT) cpp_assert (pfile, TXT)
+ builtin_define ("__nds32__");
+ builtin_define ("__NDS32__");
+
+ if (TARGET_ISA_V2)
+ builtin_define ("__NDS32_ISA_V2__");
+ if (TARGET_ISA_V3)
+ builtin_define ("__NDS32_ISA_V3__");
+ if (TARGET_ISA_V3M)
+ builtin_define ("__NDS32_ISA_V3M__");
+
+ if (TARGET_BIG_ENDIAN)
+ builtin_define ("__NDS32_EB__");
+ else
+ builtin_define ("__NDS32_EL__");
+
+ if (TARGET_REDUCED_REGS)
+ builtin_define ("__NDS32_REDUCED_REGS__");
+ if (TARGET_CMOV)
+ builtin_define ("__NDS32_CMOV__");
+ if (TARGET_EXT_PERF)
+ builtin_define ("__NDS32_EXT_PERF__");
+ if (TARGET_EXT_PERF2)
+ builtin_define ("__NDS32_EXT_PERF2__");
+ if (TARGET_EXT_STRING)
+ builtin_define ("__NDS32_EXT_STRING__");
+ if (TARGET_16_BIT)
+ builtin_define ("__NDS32_16_BIT__");
+ if (TARGET_GP_DIRECT)
+ builtin_define ("__NDS32_GP_DIRECT__");
+
+ if (TARGET_BIG_ENDIAN)
+ builtin_define ("__big_endian__");
+
+ builtin_assert ("cpu=nds32");
+ builtin_assert ("machine=nds32");
+#undef builtin_define
+#undef builtin_assert
+}
+
+
/* Defining Data Structures for Per-function Information. */
void
diff --git a/gcc/config/nds32/nds32.h b/gcc/config/nds32/nds32.h
index 1c812f7..6846aef 100644
--- a/gcc/config/nds32/nds32.h
+++ b/gcc/config/nds32/nds32.h
@@ -440,38 +440,8 @@ enum nds32_builtins
/* Run-time Target Specification. */
-#define TARGET_CPU_CPP_BUILTINS() \
- do \
- { \
- builtin_define ("__nds32__"); \
- \
- if (TARGET_ISA_V2) \
- builtin_define ("__NDS32_ISA_V2__"); \
- if (TARGET_ISA_V3) \
- builtin_define ("__NDS32_ISA_V3__"); \
- if (TARGET_ISA_V3M) \
- builtin_define ("__NDS32_ISA_V3M__"); \
- \
- if (TARGET_BIG_ENDIAN) \
- builtin_define ("__big_endian__"); \
- if (TARGET_REDUCED_REGS) \
- builtin_define ("__NDS32_REDUCED_REGS__"); \
- if (TARGET_CMOV) \
- builtin_define ("__NDS32_CMOV__"); \
- if (TARGET_EXT_PERF) \
- builtin_define ("__NDS32_EXT_PERF__"); \
- if (TARGET_EXT_PERF2) \
- builtin_define ("__NDS32_EXT_PERF2__"); \
- if (TARGET_EXT_STRING) \
- builtin_define ("__NDS32_EXT_STRING__"); \
- if (TARGET_16_BIT) \
- builtin_define ("__NDS32_16_BIT__"); \
- if (TARGET_GP_DIRECT) \
- builtin_define ("__NDS32_GP_DIRECT__"); \
- \
- builtin_assert ("cpu=nds32"); \
- builtin_assert ("machine=nds32"); \
- } while (0)
+#define TARGET_CPU_CPP_BUILTINS() \
+ nds32_cpu_cpp_builtins (pfile)
/* Defining Data Structures for Per-function Information. */