comparison gcc/tree-ssa-operands.c @ 146:351920fa3827

merge
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Sun, 01 Mar 2020 16:13:28 +0900
parents 4e440907fcbf 1830386684a0
children
comparison
equal deleted inserted replaced
144:8f4e72ab4e11 146:351920fa3827
1 /* SSA operands management for trees. 1 /* SSA operands management for trees.
2 Copyright (C) 2003-2018 Free Software Foundation, Inc. 2 Copyright (C) 2003-2020 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 6 GCC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
512 static void 512 static void
513 add_stmt_operand (struct function *fn, tree *var_p, gimple *stmt, int flags) 513 add_stmt_operand (struct function *fn, tree *var_p, gimple *stmt, int flags)
514 { 514 {
515 tree var = *var_p; 515 tree var = *var_p;
516 516
517 gcc_assert (SSA_VAR_P (*var_p) || TREE_CODE (*var_p) == STRING_CST); 517 gcc_assert (SSA_VAR_P (*var_p)
518 || TREE_CODE (*var_p) == STRING_CST
519 || TREE_CODE (*var_p) == CONST_DECL);
518 520
519 if (is_gimple_reg (var)) 521 if (is_gimple_reg (var))
520 { 522 {
521 /* The variable is a GIMPLE register. Add it to real operands. */ 523 /* The variable is a GIMPLE register. Add it to real operands. */
522 if (flags & opf_def) 524 if (flags & opf_def)
738 case SSA_NAME: 740 case SSA_NAME:
739 case VAR_DECL: 741 case VAR_DECL:
740 case PARM_DECL: 742 case PARM_DECL:
741 case RESULT_DECL: 743 case RESULT_DECL:
742 case STRING_CST: 744 case STRING_CST:
745 case CONST_DECL:
743 if (!(flags & opf_address_taken)) 746 if (!(flags & opf_address_taken))
744 add_stmt_operand (fn, expr_p, stmt, flags); 747 add_stmt_operand (fn, expr_p, stmt, flags);
745 return; 748 return;
746 749
747 case DEBUG_EXPR_DECL: 750 case DEBUG_EXPR_DECL:
856 return; 859 return;
857 } 860 }
858 861
859 case FUNCTION_DECL: 862 case FUNCTION_DECL:
860 case LABEL_DECL: 863 case LABEL_DECL:
861 case CONST_DECL:
862 case CASE_LABEL_EXPR: 864 case CASE_LABEL_EXPR:
863 /* Expressions that make no memory references. */ 865 /* Expressions that make no memory references. */
864 return; 866 return;
865 867
866 default: 868 default:
969 if (def 971 if (def
970 && TREE_CODE (def) == SSA_NAME) 972 && TREE_CODE (def) == SSA_NAME)
971 def = SSA_NAME_VAR (def); 973 def = SSA_NAME_VAR (def);
972 if (build_vdef != def) 974 if (build_vdef != def)
973 { 975 {
974 error ("virtual definition of statement not up-to-date"); 976 error ("virtual definition of statement not up to date");
975 return true; 977 return true;
976 } 978 }
977 if (gimple_vdef (stmt) 979 if (gimple_vdef (stmt)
978 && ((def_p = gimple_vdef_op (stmt)) == NULL_DEF_OPERAND_P 980 && ((def_p = gimple_vdef_op (stmt)) == NULL_DEF_OPERAND_P
979 || DEF_FROM_PTR (def_p) != gimple_vdef (stmt))) 981 || DEF_FROM_PTR (def_p) != gimple_vdef (stmt)))
980 { 982 {
981 error ("virtual def operand missing for stmt"); 983 error ("virtual def operand missing for statement");
982 return true; 984 return true;
983 } 985 }
984 986
985 tree use = gimple_vuse (stmt); 987 tree use = gimple_vuse (stmt);
986 if (use 988 if (use
987 && TREE_CODE (use) == SSA_NAME) 989 && TREE_CODE (use) == SSA_NAME)
988 use = SSA_NAME_VAR (use); 990 use = SSA_NAME_VAR (use);
989 if (build_vuse != use) 991 if (build_vuse != use)
990 { 992 {
991 error ("virtual use of statement not up-to-date"); 993 error ("virtual use of statement not up to date");
992 return true; 994 return true;
993 } 995 }
994 if (gimple_vuse (stmt) 996 if (gimple_vuse (stmt)
995 && ((use_p = gimple_vuse_op (stmt)) == NULL_USE_OPERAND_P 997 && ((use_p = gimple_vuse_op (stmt)) == NULL_USE_OPERAND_P
996 || USE_FROM_PTR (use_p) != gimple_vuse (stmt))) 998 || USE_FROM_PTR (use_p) != gimple_vuse (stmt)))
997 { 999 {
998 error ("virtual use operand missing for stmt"); 1000 error ("virtual use operand missing for statement");
999 return true; 1001 return true;
1000 } 1002 }
1001 1003
1002 FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, SSA_OP_USE) 1004 FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, SSA_OP_USE)
1003 { 1005 {
1010 break; 1012 break;
1011 } 1013 }
1012 } 1014 }
1013 if (i == build_uses.length ()) 1015 if (i == build_uses.length ())
1014 { 1016 {
1015 error ("excess use operand for stmt"); 1017 error ("excess use operand for statement");
1016 debug_generic_expr (USE_FROM_PTR (use_p)); 1018 debug_generic_expr (USE_FROM_PTR (use_p));
1017 return true; 1019 return true;
1018 } 1020 }
1019 } 1021 }
1020 1022
1021 tree *op; 1023 tree *op;
1022 FOR_EACH_VEC_ELT (build_uses, i, op) 1024 FOR_EACH_VEC_ELT (build_uses, i, op)
1023 if (op != NULL) 1025 if (op != NULL)
1024 { 1026 {
1025 error ("use operand missing for stmt"); 1027 error ("use operand missing for statement");
1026 debug_generic_expr (*op); 1028 debug_generic_expr (*op);
1027 return true; 1029 return true;
1028 } 1030 }
1029 1031
1030 if (gimple_has_volatile_ops (stmt) != volatile_p) 1032 if (gimple_has_volatile_ops (stmt) != volatile_p)
1031 { 1033 {
1032 error ("stmt volatile flag not up-to-date"); 1034 error ("statement volatile flag not up to date");
1033 return true; 1035 return true;
1034 } 1036 }
1035 1037
1036 cleanup_build_arrays (); 1038 cleanup_build_arrays ();
1037 return false; 1039 return false;