Commit 72b7e5e1 by Kito Cheng Committed by Chung-Ju Wu

[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
parent 483c57af
2018-03-11 Kito Cheng <kito.cheng@gmail.com> 2018-03-11 Kito Cheng <kito.cheng@gmail.com>
Chung-Ju Wu <jasonwucj@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 * config/nds32/nds32-memory-manipulation.c (nds32_expand_strlen): New
function. function.
* config/nds32/nds32-multiple.md (strlensi): New pattern. * config/nds32/nds32-multiple.md (strlensi): New pattern.
......
...@@ -156,4 +156,7 @@ extern bool nds32_isr_function_p (tree); ...@@ -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 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); 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 *);
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
#include "expr.h" #include "expr.h"
#include "tm-constrs.h" #include "tm-constrs.h"
#include "builtins.h" #include "builtins.h"
#include "cpplib.h"
/* This file should be included last. */ /* This file should be included last. */
#include "target-def.h" #include "target-def.h"
...@@ -2751,6 +2752,53 @@ nds32_expand_builtin (tree exp, ...@@ -2751,6 +2752,53 @@ nds32_expand_builtin (tree exp,
/* PART 4: Implemet extern function definitions, /* PART 4: Implemet extern function definitions,
the prototype is in nds32-protos.h. */ 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. */ /* Defining Data Structures for Per-function Information. */
void void
......
...@@ -440,38 +440,8 @@ enum nds32_builtins ...@@ -440,38 +440,8 @@ enum nds32_builtins
/* Run-time Target Specification. */ /* Run-time Target Specification. */
#define TARGET_CPU_CPP_BUILTINS() \ #define TARGET_CPU_CPP_BUILTINS() \
do \ nds32_cpu_cpp_builtins (pfile)
{ \
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)
/* Defining Data Structures for Per-function Information. */ /* Defining Data Structures for Per-function Information. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment