Mercurial > hg > CbC > CbC_gcc
comparison gcc/tree-stdarg.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 /* Pass computing data for optimizing stdarg functions. | 1 /* Pass computing data for optimizing stdarg functions. |
2 Copyright (C) 2004-2017 Free Software Foundation, Inc. | 2 Copyright (C) 2004-2018 Free Software Foundation, Inc. |
3 Contributed by Jakub Jelinek <jakub@redhat.com> | 3 Contributed by Jakub Jelinek <jakub@redhat.com> |
4 | 4 |
5 This file is part of GCC. | 5 This file is part of GCC. |
6 | 6 |
7 GCC is free software; you can redistribute it and/or modify | 7 GCC is free software; you can redistribute it and/or modify |
34 #include "gimple-walk.h" | 34 #include "gimple-walk.h" |
35 #include "gimplify.h" | 35 #include "gimplify.h" |
36 #include "tree-into-ssa.h" | 36 #include "tree-into-ssa.h" |
37 #include "tree-cfg.h" | 37 #include "tree-cfg.h" |
38 #include "tree-stdarg.h" | 38 #include "tree-stdarg.h" |
39 #include "tree-chkp.h" | |
40 | 39 |
41 /* A simple pass that attempts to optimize stdarg functions on architectures | 40 /* A simple pass that attempts to optimize stdarg functions on architectures |
42 that need to save register arguments to stack on entry to stdarg functions. | 41 that need to save register arguments to stack on entry to stdarg functions. |
43 If the function doesn't use any va_start macros, no registers need to | 42 If the function doesn't use any va_start macros, no registers need to |
44 be saved. If va_start macros are used, the va_list variables don't escape | 43 be saved. If va_start macros are used, the va_list variables don't escape |
693 if (!is_gimple_call (stmt)) | 692 if (!is_gimple_call (stmt)) |
694 continue; | 693 continue; |
695 | 694 |
696 callee = gimple_call_fndecl (stmt); | 695 callee = gimple_call_fndecl (stmt); |
697 if (!callee | 696 if (!callee |
698 || DECL_BUILT_IN_CLASS (callee) != BUILT_IN_NORMAL) | 697 || !fndecl_built_in_p (callee, BUILT_IN_NORMAL)) |
699 continue; | 698 continue; |
700 | 699 |
701 switch (DECL_FUNCTION_CODE (callee)) | 700 switch (DECL_FUNCTION_CODE (callee)) |
702 { | 701 { |
703 case BUILT_IN_VA_START: | 702 case BUILT_IN_VA_START: |
866 if (is_gimple_call (stmt)) | 865 if (is_gimple_call (stmt)) |
867 { | 866 { |
868 tree callee = gimple_call_fndecl (stmt); | 867 tree callee = gimple_call_fndecl (stmt); |
869 | 868 |
870 if (callee | 869 if (callee |
871 && DECL_BUILT_IN_CLASS (callee) == BUILT_IN_NORMAL | 870 && (fndecl_built_in_p (callee, BUILT_IN_VA_START) |
872 && (DECL_FUNCTION_CODE (callee) == BUILT_IN_VA_START | 871 || fndecl_built_in_p (callee, BUILT_IN_VA_END))) |
873 || DECL_FUNCTION_CODE (callee) == BUILT_IN_VA_END)) | |
874 continue; | 872 continue; |
875 } | 873 } |
876 | 874 |
877 if (is_gimple_assign (stmt)) | 875 if (is_gimple_assign (stmt)) |
878 { | 876 { |
1036 if (lhs != NULL_TREE) | 1034 if (lhs != NULL_TREE) |
1037 { | 1035 { |
1038 unsigned int nargs = gimple_call_num_args (stmt); | 1036 unsigned int nargs = gimple_call_num_args (stmt); |
1039 gcc_assert (useless_type_conversion_p (TREE_TYPE (lhs), type)); | 1037 gcc_assert (useless_type_conversion_p (TREE_TYPE (lhs), type)); |
1040 | 1038 |
1041 /* We replace call with a new expr. This may require | |
1042 corresponding bndret call fixup. */ | |
1043 if (chkp_function_instrumented_p (fun->decl)) | |
1044 chkp_fixup_inlined_call (lhs, expr); | |
1045 | |
1046 if (nargs == 4) | 1039 if (nargs == 4) |
1047 { | 1040 { |
1048 /* We've transported the size of with WITH_SIZE_EXPR here as | 1041 /* We've transported the size of with WITH_SIZE_EXPR here as |
1049 the last argument of the internal fn call. Now reinstate | 1042 the last argument of the internal fn call. Now reinstate |
1050 it. */ | 1043 it. */ |