comparison gcc/read-rtl-function.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
comparison
equal deleted inserted replaced
111:04ced10e8804 131:84e7813d76e9
1 /* read-rtl-function.c - Reader for RTL function dumps 1 /* read-rtl-function.c - Reader for RTL function dumps
2 Copyright (C) 2016-2017 Free Software Foundation, Inc. 2 Copyright (C) 2016-2018 Free Software Foundation, Inc.
3 3
4 This file is part of GCC. 4 This file is part of GCC.
5 5
6 GCC is free software; you can redistribute it and/or modify it under 6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free 7 the terms of the GNU General Public License as published by the Free
319 319
320 static int 320 static int
321 parse_note_insn_name (const char *string) 321 parse_note_insn_name (const char *string)
322 { 322 {
323 for (int i = 0; i < NOTE_INSN_MAX; i++) 323 for (int i = 0; i < NOTE_INSN_MAX; i++)
324 if (0 == strcmp (string, GET_NOTE_INSN_NAME (i))) 324 if (strcmp (string, GET_NOTE_INSN_NAME (i)) == 0)
325 return i; 325 return i;
326 fatal_with_file_and_line ("unrecognized NOTE_INSN name: `%s'", string); 326 fatal_with_file_and_line ("unrecognized NOTE_INSN name: `%s'", string);
327 } 327 }
328 328
329 /* Return the register number for NAME, or return -1 if it isn't 329 /* Return the register number for NAME, or return -1 if it isn't
1077 const char *desc_start = desc; 1077 const char *desc_start = desc;
1078 /* If ORIGINAL_REGNO (rtx) != regno, we will have: 1078 /* If ORIGINAL_REGNO (rtx) != regno, we will have:
1079 "orig:%i", ORIGINAL_REGNO (rtx). 1079 "orig:%i", ORIGINAL_REGNO (rtx).
1080 Consume it, we don't set ORIGINAL_REGNO, since we can 1080 Consume it, we don't set ORIGINAL_REGNO, since we can
1081 get that from the 2nd copy later. */ 1081 get that from the 2nd copy later. */
1082 if (0 == strncmp (desc, "orig:", 5)) 1082 if (strncmp (desc, "orig:", 5) == 0)
1083 { 1083 {
1084 expect_original_regno = true; 1084 expect_original_regno = true;
1085 desc_start += 5; 1085 desc_start += 5;
1086 /* Skip to any whitespace following the integer. */ 1086 /* Skip to any whitespace following the integer. */
1087 const char *space = strchr (desc_start, ' '); 1087 const char *space = strchr (desc_start, ' ');
1310 tree 1310 tree
1311 function_reader::parse_mem_expr (const char *desc) 1311 function_reader::parse_mem_expr (const char *desc)
1312 { 1312 {
1313 tree fndecl = cfun->decl; 1313 tree fndecl = cfun->decl;
1314 1314
1315 if (0 == strcmp (desc, "<retval>")) 1315 if (strcmp (desc, "<retval>") == 0)
1316 return DECL_RESULT (fndecl); 1316 return DECL_RESULT (fndecl);
1317 1317
1318 tree param = find_param_by_name (fndecl, desc); 1318 tree param = find_param_by_name (fndecl, desc);
1319 if (param) 1319 if (param)
1320 return param; 1320 return param;
2141 rtx set1 = single_set (insn_1); 2141 rtx set1 = single_set (insn_1);
2142 rtx mem1 = SET_DEST (set1); 2142 rtx mem1 = SET_DEST (set1);
2143 ASSERT_EQ (42, MEM_ALIAS_SET (mem1)); 2143 ASSERT_EQ (42, MEM_ALIAS_SET (mem1));
2144 /* "+17". */ 2144 /* "+17". */
2145 ASSERT_TRUE (MEM_OFFSET_KNOWN_P (mem1)); 2145 ASSERT_TRUE (MEM_OFFSET_KNOWN_P (mem1));
2146 ASSERT_EQ (17, MEM_OFFSET (mem1)); 2146 ASSERT_KNOWN_EQ (17, MEM_OFFSET (mem1));
2147 /* "S8". */ 2147 /* "S8". */
2148 ASSERT_EQ (8, MEM_SIZE (mem1)); 2148 ASSERT_KNOWN_EQ (8, MEM_SIZE (mem1));
2149 /* "A128. */ 2149 /* "A128. */
2150 ASSERT_EQ (128, MEM_ALIGN (mem1)); 2150 ASSERT_EQ (128, MEM_ALIGN (mem1));
2151 /* "AS5. */ 2151 /* "AS5. */
2152 ASSERT_EQ (5, MEM_ADDR_SPACE (mem1)); 2152 ASSERT_EQ (5, MEM_ADDR_SPACE (mem1));
2153 2153
2157 rtx set2 = single_set (insn_2); 2157 rtx set2 = single_set (insn_2);
2158 rtx mem2 = SET_DEST (set2); 2158 rtx mem2 = SET_DEST (set2);
2159 ASSERT_EQ (43, MEM_ALIAS_SET (mem2)); 2159 ASSERT_EQ (43, MEM_ALIAS_SET (mem2));
2160 /* "+18". */ 2160 /* "+18". */
2161 ASSERT_TRUE (MEM_OFFSET_KNOWN_P (mem2)); 2161 ASSERT_TRUE (MEM_OFFSET_KNOWN_P (mem2));
2162 ASSERT_EQ (18, MEM_OFFSET (mem2)); 2162 ASSERT_KNOWN_EQ (18, MEM_OFFSET (mem2));
2163 /* "S9". */ 2163 /* "S9". */
2164 ASSERT_EQ (9, MEM_SIZE (mem2)); 2164 ASSERT_KNOWN_EQ (9, MEM_SIZE (mem2));
2165 /* "AS6. */ 2165 /* "AS6. */
2166 ASSERT_EQ (6, MEM_ADDR_SPACE (mem2)); 2166 ASSERT_EQ (6, MEM_ADDR_SPACE (mem2));
2167 }
2168
2169 /* Verify that "repeated xN" is read correctly. */
2170
2171 static void
2172 test_loading_repeat ()
2173 {
2174 rtl_dump_test t (SELFTEST_LOCATION, locate_file ("repeat.rtl"));
2175
2176 rtx_insn *insn_1 = get_insn_by_uid (1);
2177 ASSERT_EQ (PARALLEL, GET_CODE (PATTERN (insn_1)));
2178 ASSERT_EQ (64, XVECLEN (PATTERN (insn_1), 0));
2179 for (int i = 0; i < 64; i++)
2180 ASSERT_EQ (const0_rtx, XVECEXP (PATTERN (insn_1), 0, i));
2167 } 2181 }
2168 2182
2169 /* Run all of the selftests within this file. */ 2183 /* Run all of the selftests within this file. */
2170 2184
2171 void 2185 void
2185 test_loading_const_int (); 2199 test_loading_const_int ();
2186 test_loading_symbol_ref (); 2200 test_loading_symbol_ref ();
2187 test_loading_cfg (); 2201 test_loading_cfg ();
2188 test_loading_bb_index (); 2202 test_loading_bb_index ();
2189 test_loading_mem (); 2203 test_loading_mem ();
2204 test_loading_repeat ();
2190 } 2205 }
2191 2206
2192 } // namespace selftest 2207 } // namespace selftest
2193 2208
2194 #endif /* #if CHECKING_P */ 2209 #endif /* #if CHECKING_P */