]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[NDS32] Provide TARGET_CMODEL_[SMALL|MEDIUM|LARGE] to check which code model is speci...
authorChung-Ju Wu <jasonwucj@gmail.com>
Tue, 13 Jan 2015 05:32:08 +0000 (05:32 +0000)
committerChung-Ju Wu <jasonwucj@gcc.gnu.org>
Tue, 13 Jan 2015 05:32:08 +0000 (05:32 +0000)
gcc/
* config/nds32/nds32.h (TARGET_CMODEL_SMALL): New macro.
(TARGET_CMODEL_MEDIUM): New macro.
(TARGET_CMODEL_LARGE): New macro.
* config/nds32/nds32.c (nds32_asm_file_start): Display corresponding
code model setting in assembly code.

From-SVN: r219511

gcc/ChangeLog
gcc/config/nds32/nds32.c
gcc/config/nds32/nds32.h

index cff776fb2cc6497c5ab3adf3f504865fe591a39a..f4fae586b27084cd8e27f964c62edfb861f30da2 100644 (file)
@@ -1,3 +1,11 @@
+2015-01-13  Chung-Ju Wu  <jasonwucj@gmail.com>
+
+       * config/nds32/nds32.h (TARGET_CMODEL_SMALL): New macro.
+       (TARGET_CMODEL_MEDIUM): New macro.
+       (TARGET_CMODEL_LARGE): New macro.
+       * config/nds32/nds32.c (nds32_asm_file_start): Display corresponding
+       code model setting in assembly code.
+
 2015-01-13  Chung-Ju Wu  <jasonwucj@gmail.com>
 
        * common/config/nds32/nds32-common.c (TARGET_DEFAULT_TARGET_FLAGS):
index d2ffb6150a7026114aba36ecb18b1c9987d87a86..91e797efbbf97bf5cd5663f18715f0fcb6afe212 100644 (file)
@@ -2157,6 +2157,13 @@ nds32_asm_file_start (void)
   if (TARGET_ISA_V3M)
     fprintf (asm_out_file, "\t! ISA family\t\t: %s\n", "V3M");
 
+  if (TARGET_CMODEL_SMALL)
+    fprintf (asm_out_file, "\t! Code model\t\t: %s\n", "SMALL");
+  if (TARGET_CMODEL_MEDIUM)
+    fprintf (asm_out_file, "\t! Code model\t\t: %s\n", "MEDIUM");
+  if (TARGET_CMODEL_LARGE)
+    fprintf (asm_out_file, "\t! Code model\t\t: %s\n", "LARGE");
+
   fprintf (asm_out_file, "\t! Endian setting\t: %s\n",
                         ((TARGET_BIG_ENDIAN) ? "big-endian"
                                              : "little-endian"));
@@ -2178,9 +2185,6 @@ nds32_asm_file_start (void)
   fprintf (asm_out_file, "\t! 16-bit instructions\t: %s\n",
                         ((TARGET_16_BIT) ? "Yes"
                                          : "No"));
-  fprintf (asm_out_file, "\t! GP base access\t: %s\n",
-                        ((TARGET_GP_DIRECT) ? "Yes"
-                                            : "No"));
   fprintf (asm_out_file, "\t! Reduced registers set\t: %s\n",
                         ((TARGET_REDUCED_REGS) ? "Yes"
                                                : "No"));
index d9a55adff480f420dbd22ba6229c3a1eec664b85..ac6cf429a761d8deb3e7d888ffcf0305707e82e9 100644 (file)
@@ -344,6 +344,19 @@ enum nds32_builtins
 #define TARGET_ISA_V3   (nds32_arch_option == ARCH_V3)
 #define TARGET_ISA_V3M  (nds32_arch_option == ARCH_V3M)
 
+#define TARGET_CMODEL_SMALL \
+   (nds32_cmodel_option == CMODEL_SMALL)
+#define TARGET_CMODEL_MEDIUM \
+   (nds32_cmodel_option == CMODEL_MEDIUM)
+#define TARGET_CMODEL_LARGE \
+   (nds32_cmodel_option == CMODEL_LARGE)
+
+/* When -mcmodel=small or -mcmodel=medium,
+   compiler may generate gp-base instruction directly.  */
+#define TARGET_GP_DIRECT \
+   (nds32_cmodel_option == CMODEL_SMALL\
+    || nds32_cmodel_option == CMODEL_MEDIUM)
+
 #define TARGET_SOFT_FLOAT 1
 #define TARGET_HARD_FLOAT 0