Commit Graph

194 Commits

Author SHA1 Message Date
Eric Botcazou
e1e5852c9f decl.c (gnat_to_gnu_entity): Try to make a packable type for fields of union types as well.
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Record_Subtype>: Try to
	make a packable type for fields of union types as well.
	<is_type>: Use RECORD_OR_UNION_TYPE_P predicate.
	(gnat_to_gnu_component_type): Try to make a packable type for fields
	of union types as well.
	(make_packable_type): Use RECORD_OR_UNION_TYPE_P predicate.
	(maybe_pad_type): Try to make a packable type for fields of union types
	as well.
	(gnat_to_gnu_field): Likewise.
	(is_variable_size): Use RECORD_OR_UNION_TYPE_P predicate.
	(set_rm_size): Likewise.
	(rm_size): Likewise.
	* gcc-interface/misc.c (gnat_type_max_size): Likewise.
	* gcc-interface/trans.c (add_decl_expr): Likewise.
	* gcc-interface/utils.c (finish_record_type): Likewise.
	* gcc-interface/utils2.c (build_simple_component_ref): Likewise.

From-SVN: r180540
2011-10-26 20:45:09 +00:00
Eric Botcazou
27ab5bd888 trans.c (lhs_or_actual_p): New predicate.
* gcc-interface/trans.c (lhs_or_actual_p): New predicate.
	(unchecked_conversion_nop): Use it.
	(gnat_to_gnu): Likewise.

From-SVN: r180243
2011-10-20 11:03:54 +00:00
Eric Botcazou
b756276959 back_end.adb (Call_Back_End): Pass the maximum logical line number instead of the maximum physical line...
* back_end.adb (Call_Back_End): Pass the maximum logical line number
	instead of the maximum physical line number to gigi.
	* gcc-interface/trans.c (Sloc_to_locus): Cope with line zero.

From-SVN: r180242
2011-10-20 10:56:08 +00:00
Tom Tromey
46427374e1 Linemap infrastructure for virtual locations
This is the first instalment of a set which goal is to track locations
of tokens across macro expansions.  Tom Tromey did the original work
and attached the patch to PR preprocessor/7263.  This opus is a
derivative of that original work.

This patch modifies the linemap module of libcpp to add virtual
locations support.

A virtual location is a mapped location that can resolve to several
different physical locations.  It can always resolve to the spelling
location of a token.  For tokens resulting from macro expansion it can
resolve to:
  - either the location of the expansion point of the macro.
  - or the location of the token in the definition of the
  macro
  - or, if the token is an argument of a function-like macro,
  the location of the use of the matching macro parameter in
  the definition of the macro

The patch creates a new type of line map called a macro map.  For every
single macro expansion, there is a macro map that generates a virtual
location for every single resulting token of the expansion.

The good old type of line map we all know is now called an ordinary
map.  That one still encodes spelling locations as it has always had.

As a result linemap_lookup as been extended to return a macro map when
given a virtual location resulting from a macro expansion.  The layout
of structs line_map has changed to support this new type of map.  So
did the layout of struct line_maps.  Accessor macros have been
introduced to avoid messing with the implementation details of these
datastructures directly.  This helped already as we have been testing
different ways of arranging these datastructure.  Having to constantly
adjust client code that is too tied with the internals of line_map and
line_maps would have been even more painful.

Of course, many new public functions have been added to the linemap
module to handle the resolution of virtual locations.

This patch introduces the infrastructure but no part of the compiler
uses virtual locations yet.

However the client code of the linemap data structures has been
adjusted as per the changes.  E.g, it's not anymore reliable for a
client code to manipulate struct line_map directly if it just wants to
deal with spelling locations, because struct line_map can now
represent a macro map as well.  In that case, it's better to use the
convenient API to resolve the initial (possibly virtual) location to a
spelling location (or to an ordinary map) and use that.

This is the reason why the patch adjusts the Java, Ada and Fortran
front ends.

Also, note that virtual locations are not supposed to be ordered for
relations '<' and '>' anymore.  To test if a virtual location appears
"before" another one, one has to use a new operator exposed by the
line map interface.  The patch updates the only spot (in the
diagnostics module) I have found that was making the assumption that
locations were ordered for these relations.  This is the only change
that introduces a use of the new line map API in this patch, so I am
adding a regression test for it only.

From-SVN: r180081
2011-10-17 11:58:56 +02:00
Eric Botcazou
722356ce27 trans.c (Attribute_to_gnu): Use remove_conversions.
* gcc-interface/trans.c (Attribute_to_gnu): Use remove_conversions.
	(push_range_check_info): Likewise.
	(gnat_to_gnu) <N_Code_Statement>: Likewise.
	* gcc-interface/utils2.c (build_unary_op) <INDIRECT_REF>: Likewise.
	(gnat_invariant_expr): Likewise.
	* gcc-interface/utils.c (compute_related_constant): Likewise.
	(max_size): Fix handling of SAVE_EXPR.
	(remove_conversions): Fix formatting.

From-SVN: r179873
2011-10-12 22:09:21 +00:00
Eric Botcazou
15bf7d19d4 ada-tree.h (DECL_LOOP_PARM_P): New flag.
* gcc-interface/ada-tree.h (DECL_LOOP_PARM_P): New flag.
	(DECL_INDUCTION_VAR): New macro.
	(SET_DECL_INDUCTION_VAR): Likewise.
	* gcc-interface/gigi.h (convert_to_index_type): Declare.
	(gnat_invariant_expr): Likewise.
	* gcc-interface/decl.c (gnat_to_gnu_entity) <object>: If this is a loop
	parameter, set DECL_LOOP_PARM_P on it.
	* gcc-interface/misc.c (gnat_print_decl) <VAR_DECL>: If DECL_LOOP_PARM_P
	is set, print DECL_INDUCTION_VAR instead of DECL_RENAMED_OBJECT.
	* gcc-interface/trans.c (gnu_loop_label_stack): Delete.
	(struct range_check_info_d): New type.
	(struct loop_info_d): Likewise.
	(gnu_loop_stack): New stack.
	(Identifier_to_gnu): Set TREE_READONLY flag on the first dereference
	built for a by-double-ref read-only parameter.  If DECL_LOOP_PARM_P
	is set, do not test DECL_RENAMED_OBJECT.
	(push_range_check_info): New function.
	(Loop_Statement_to_gnu): Push a new struct loop_info_d instead of just
	the label.  Reference the label and the iteration variable from it.
	Build the special induction variable in the unsigned version of the
	size type, if it is larger than the base type.  And attach it to the
	iteration variable if the latter isn't by-ref.  In the iteration scheme
	case, initialize the invariant conditions in front of the loop if
	deemed profitable.  Use gnu_loop_stack.
	(gnat_to_gnu) <N_Exit_Statement>: Use gnu_loop_stack.
	<N_Raise_Constraint_Error>: Always process the reason.  In the range
	check and related cases, and if loop unswitching is enabled, compute
	invariant conditions and push this information onto the stack.
	Do not translate again the condition if it has been already translated.
	* gcc-interface/utils.c (record_global_renaming_pointer): Assert that
	DECL_LOOP_PARM_P isn't set.
	(convert_to_index_type): New function.
	* gcc-interface/utils2.c (build_binary_op) <ARRAY_REF>: Use it in order
	to convert the index from the base index type to sizetype.
	(gnat_invariant_expr): New function.

From-SVN: r179868
2011-10-12 22:00:14 +00:00
Michael Meissner
e79983f458 Convert standard builtin functions from being arrays to using a functional interface
From-SVN: r179820
2011-10-11 19:55:09 +00:00
Eric Botcazou
71196d4e64 gigi.h (gnat_useless_type_conversion): Declare.
* gcc-interface/gigi.h (gnat_useless_type_conversion): Declare.
	(rest_of_subprog_body_compilation): Likewise.
	* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Variable>: For renaming,
	test for useless conversions by means of gnat_useless_type_conversion.
	* gcc-interface/trans.c: Include bitmap.h and cgraph.h.
	(language_function): Add named_ret_val and other_ret_val.
	(f_named_ret_val): New macro.
	(f_other_ret_val): Likewise.
	(gigi): Call rest_of_subprog_body_compilation.
	(struct nrv_data): New structure.
	(is_nrv_p): New predicate.
	(prune_nrv_r): New helper function.
	(prune_nrv_in_block): New function.
	(finalize_nrv_r): New helper function.
	(finalize_nrv): New function.
	(return_value_ok_for_nrv_p): New predicate.
	(build_return_expr): If optimization is enabled, record candidates for
	the Named Return Value optimization.
	(build_function_stub): Call rest_of_subprog_body_compilation.
	(Subprogram_Body_to_gnu): If optimization is enabled and there are
	candidates, finalize the Named Return Value optimization.
	Call rest_of_subprog_body_compilation.
	(call_to_gnu): At the end, if a return value is needed, simplify the
	result before wrapping it up in a COMPOUND_EXPR.
	* gcc-interface/utils.c (end_subprog_body): Split into...
	(rest_of_subprog_body_compilation): ...this.  New function.
	(gnat_useless_type_conversion): Likewise.

From-SVN: r179650
2011-10-07 11:17:55 +00:00
Eric Botcazou
7d76717db8 gigi.h (create_subprog_decl): Replace TREE_CHAIN with DECL_CHAIN in comment.
* gcc-interface/gigi.h (create_subprog_decl): Replace TREE_CHAIN with
	DECL_CHAIN in comment.
	* gcc-interface/trans.c (gigi): Likewise.
	(Attribute_to_gnu): Likewise.
	(build_function_stub): Likewise.
	(gnat_to_gnu): Likewise.
	* gcc-interface/utils.c (create_subprog_decl): Likewise.
	(convert_vms_descriptor64): Likewise.
	(convert_vms_descriptor32): Likewise.

From-SVN: r179185
2011-09-26 08:50:16 +00:00
Eric Botcazou
42acad07c0 trans.c (assoc_to_constructor): Minor tweaks.
* gcc-interface/trans.c (assoc_to_constructor): Minor tweaks.
	* gcc-interface/utils2.c (build_simple_component_ref): Fix formatting
	issues.  Use COMPLETE_TYPE_P in assertion.  Also set TREE_READONLY if
	the type of the record is TYPE_READONLY.

From-SVN: r179184
2011-09-26 08:45:36 +00:00
Eric Botcazou
50179d5882 ada-tree.h (TYPE_NULL_BOUNDS): New macro.
* gcc-interface/ada-tree.h (TYPE_NULL_BOUNDS): New macro.
	(SET_TYPE_NULL_BOUNDS): Likewise.
	* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Array_Type>: Set again
	TREE_THIS_NOTRAP on the INDIRECT_REF node built for the template.
	* gcc-interface/trans.c (Identifier_to_gnu): Return initializers of fat
	pointer types.
	* gcc-interface/utils.c (create_var_decl_1): If the object is external,
	check that the initializer is a valid constant expression for use in
	initializing a static variable.  Add missing guard.
	(update_pointer_to): Adjust TYPE_NULL_BOUNDS if set.
	(convert_to_fat_pointer): In the null fat pointer case, build a valid
	pointer for the bounds.
	* gcc-interface/utils2.c (compare_fat_pointers): New function.
	(build_binary_op) <EQ_EXPR>: Call it to compare fat pointers.

From-SVN: r179180
2011-09-26 07:52:58 +00:00
Eric Botcazou
ad1d36bafd ada-tree.h (TREE_THIS_NOTRAP): Redefine.
* gcc-interface/ada-tree.h (TREE_THIS_NOTRAP): Redefine.
	* gcc-interface/trans.c (Identifier_to_gnu): Factor out common code in
	the by-ref case.  Do not set TREE_READONLY on a renamed object.  Set
	TREE_THIS_NOTRAP on UNCONSTRAINED_ARRAY_REF nodes.
	(Attribute_to_gnu) <Attr_Length>: Expand the use of the parameter cache
	to the indirect case.
	* gcc-interface/utils.c (convert) <UNCONSTRAINED_ARRAY_REF>: Preserve
	the TREE_THIS_NOTRAP flag.

From-SVN: r179171
2011-09-25 20:40:10 +00:00
Eric Botcazou
6162cec0d9 trans.c (Loop_Statement_to_gnu): In the case of an iteration scheme...
* gcc-interface/trans.c (Loop_Statement_to_gnu): In the case of an
	iteration scheme, always generate the do-while form if optimization
	is enabled.  Use more straightforward test at the end.

From-SVN: r179169
2011-09-25 20:27:37 +00:00
Eric Botcazou
dee12fcd11 decl.c (gnat_to_gnu_entity): Use XNEW instead of xmalloc.
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Access_Subtype>: Use
	XNEW instead of xmalloc.  Do not build useless pointer type.
	<E_Anonymous_Access_Subprogram_Type>: Use XNEW instead of xmalloc.
	* gcc-interface/trans.c (gnat_to_gnu) <N_Raise_Constraint_Error>: Tidy.
	* gcc-interface/utils2.c (build_unary_op): Remove local variable.

From-SVN: r179168
2011-09-25 20:15:10 +00:00
Eric Botcazou
819a653eee decl.c (maybe_pad_type): Do not try to change the form of an addressable type.
* gcc-interface/decl.c (maybe_pad_type): Do not try to change the form
	of an addressable type.
	* gcc-interface/trans.c (gnat_gimplify_expr) <VIEW_CONVERT_EXPR>: New.
	Deal with those cases for which creating a temporary is mandatory.

From-SVN: r178764
2011-09-11 18:56:40 +00:00
Eric Botcazou
c946adde12 trans.c (call_to_gnu): Use local variable.
* gcc-interface/trans.c (call_to_gnu): Use local variable.  Make sure
	this is a real formal parameter before testing whether it is by ref.

From-SVN: r178763
2011-09-11 18:38:30 +00:00
Eric Botcazou
dddf8120db gigi.h (build_call_0_expr): Delete.
* gcc-interface/gigi.h (build_call_0_expr): Delete.
	(build_call_1_expr): Likewise.
	(build_call_2_expr): Likewise.
	(build_call_n_expr): New prototype.
	* gcc-interface/decl.c (gnat_to_gnu_entity): Use build_call_n_expr.
	* gcc-interface/trans.c (establish_gnat_vms_condition_handler): Ditto.
	(Handled_Sequence_Of_Statements_to_gnu): Likewise.
	(Exception_Handler_to_gnu_zcx): Likewise.
	(gnat_to_gnu): Likewise.
	(build_binary_op_trapv): Likewise.
	* gcc-interface/utils2.c (build_call_0_expr): Delete.
	(build_call_1_expr): Likewise.
	(build_call_2_expr): Likewise.
	(build_call_n_expr): New function.
	(build_call_raise): Use build_call_n_expr.
	(build_call_raise_range): Likewise.
	(build_call_raise_column): Likewise.
	(build_call_alloc_dealloc_proc): Likewise.
	(maybe_wrap_malloc): Likewise.
	(maybe_wrap_free): Likewise.

From-SVN: r178762
2011-09-11 18:33:46 +00:00
Eric Botcazou
d8e3855467 trans.c (build_return_expr): Use void_type_node for MODIFY_EXPR.
* gcc-interface/trans.c (build_return_expr): Use void_type_node for
	MODIFY_EXPR.
	* gcc-interface/utils2.c (build_binary_op) <MODIFY_EXPR>: Assert that
	the result type is null if ENABLE_CHECKING.  Set operation_type at the
	end unconditionally if not set in the previous cases.
	Use build2 and void_type_node for MODIFY_EXPR.
	(build_allocator): Use NULL_TREE for MODIFY_EXPR.

From-SVN: r178761
2011-09-11 18:28:05 +00:00
Arnaud Charlet
203ddceaed [multiple changes]
2011-09-06  Robert Dewar  <dewar@adacore.com>

	* s-tpopsp-vxworks.adb, prj-nmsc.adb: Minor reformatting.

2011-09-06  Hristian Kirtchev  <kirtchev@adacore.com>

	* gcc-interface/trans.c (Attribute_to_gnu): New case for
	attribute Descriptor_Size.
	* exp_attr.adb (Expand_N_Attribute_Reference): Add processing
	for attribute Descriptor_Size.
	* exp_ch7.adb (Double_Size_Of): Removed.
	(Make_Finalize_Address_Stmts): Remove the code which generates
	an expression to calculate the dope vector of an unconstrained
	array. Instead use attribute Descriptor_Size and leave the
	calculation to the back end.
	(Nearest_Multiple_Rounded_Up): Removed.
	(Size_Of): Removed.
	* sem_attr.adb (Analyze_Attribute): Add processing for attribute
	Descriptor_Size. Currently the attribute is applicable only
	to unconstrained arrays.
	(Eval_Attribute): Add processing for
	attribute Descriptor_Size.
	* snames.ads-tmpl: Add a predefined name and an Attribute_Id
	for Descriptor_Size.

2011-09-06  Ed Schonberg  <schonberg@adacore.com>

	* exp_aggr.adb: Remove useless formal.

From-SVN: r178585
2011-09-06 12:53:58 +02:00
Arnaud Charlet
624e168838 [multiple changes]
2011-08-29  Gary Dismukes  <dismukes@adacore.com>

	* exp_ch3.adb (Build_Record_Init_Proc.Build_Init_Procedure): Set
	Exception_Handlers to No_List instead of Empty_List in the case where
	there are no handlers.

2011-08-29  Tristan Gingold  <gingold@adacore.com>

	* gcc-interface/gigi.h (enum standard_datatypes): Add
	ADT_reraise_zcx_decl
	(reraise_zcx_decl): New macro.
	* gcc-interface/trans.c (gnu_incoming_exc_ptr): New variable.
	(gigi): Set reraise_zcx_decl.
	(Exception_Handler_to_gnu_zcx): Save and restore gnu_incoming_exc_ptr.
	(gnat_to_gnu): Handle N_Raise_Statement.

From-SVN: r178212
2011-08-29 14:36:42 +02:00
Eric Botcazou
588c8f488f gigi.h (enumerate_modes): Fix formatting.
* gcc-interface/gigi.h (enumerate_modes): Fix formatting.

	* gcc-interface/trans.c (Subprogram_Body_to_gnu): Revert latest change.

From-SVN: r177548
2011-08-07 16:47:14 +00:00
Arnaud Charlet
002bdd685c [multiple changes]
2011-08-02  Geert Bosch  <bosch@adacore.com>

	* gcc-interface/gigi.h, gcc-interface/misc.c (enumerate_modes): New
	function.
	* gcc-interface/Make-lang.in: Update dependencies.

2011-08-02  Olivier Hainque  <hainque@adacore.com>

	* gcc-interface/trans.c (Subprogram_Body_to_gnu): Set the function
	end_locus.

From-SVN: r177141
2011-08-02 15:00:21 +02:00
Eric Botcazou
f3d3457603 gigi.h (build_function_stub): Remove.
* gcc-interface/gigi.h (build_function_stub): Remove.
	(build_return_expr): Likewise.
	(convert_vms_descriptor): Declare.
	* gcc-interface/utils.c (convert_vms_descriptor): Make global.
	(build_function_stub): Move to...
	* gcc-interface/utils2.c (build_return_expr): Move to...
	* gcc-interface/trans.c (build_function_stub): ...here.
	(build_return_expr): ...here.
	(Subprogram_Body_to_gnu): Add local variable for language_function.
	Disconnect the parameter attributes cache, if any, once done with it.
	Call end_subprog_body only after setting the end_locus.
	Build the stub associated with the function, if any, at the very end.
	(gnat_to_gnu) <N_Return_Statement>: Remove couple of useless local
	variables and streamline control flow.

From-SVN: r176712
2011-07-24 12:45:44 +00:00
Eric Botcazou
96769d3294 trans.c (Identifier_to_gnu): Don't set TREE_THIS_NOTRAP on a dereference built for a by-ref object if...
* gcc-interface/trans.c (Identifier_to_gnu): Don't set TREE_THIS_NOTRAP
	on a dereference built for a by-ref object if it has an address clause.

From-SVN: r175172
2011-06-18 10:31:26 +00:00
Eric Botcazou
7e4680c1a2 einfo.ads (Address_Taken): Document use for the second argument of Asm_Input and Asm_Output attributes.
* einfo.ads (Address_Taken): Document use for the second argument of
	Asm_Input and Asm_Output attributes.
	* sem_attr.adb (Analyze_Attribute) <Attribute_Asm_Input>: If the second
	argument is an entity name, then set Address_Taken on it.
	<Attribute_Asm_Output>: Likewise.
	* gcc-interface/trans.c (lvalue_required_for_attribute_p): Handle the
	Attr_Asm_Input and Attr_Asm_Output attributes explicitly.
	(gnat_to_gnu) <N_Code_Statement>: If an operand is going to end up in
	memory and is a CONST_DECL, retrieve its corresponding VAR_DECL.

From-SVN: r175171
2011-06-18 10:18:38 +00:00
Eric Botcazou
e9f57686fc trans.c (Identifier_to_gnu): Also handle deferred constants whose full view has discriminants specially.
* gcc-interface/trans.c (Identifier_to_gnu): Also handle deferred
	constants whose full view has discriminants specially.

From-SVN: r174689
2011-06-06 10:21:58 +00:00
Kai Tietz
bf6490b56f trans.c (Exception_Handler_to_gnu_sjlj): Use boolean_false_node instead of integer_zero_node.
2011-05-18  Kai Tietz <ktietz@redhat.com>

	* gcc-interface/trans.c (Exception_Handler_to_gnu_sjlj): Use
	boolean_false_node instead of integer_zero_node.
	(convert_with_check): Likewise.
	* gcc-interface/decl.c (choices_to_gnu): Likewise.

From-SVN: r173846
2011-05-18 10:40:50 +02:00
Eric Botcazou
7bf9a5ac1c trans.c (call_to_gnu): In the by-reference case...
* gcc-interface/trans.c (call_to_gnu): In the by-reference case, if the
	type of the parameter is an unconstrained array, convert the actual to
	the type of the formal in the In Out and Out cases as well.

From-SVN: r173706
2011-05-12 14:54:09 +00:00
Nathan Froyd
3d528853ba generalize build_case_label to the rest of the compiler
generalize build_case_label to the rest of the compiler
gcc/ada/
	* gcc-interface/trans.c (Case_Statement_to_gnu): Call
	build_case_label.

gcc/
	* except.c (sjlj_emit_dispatch_table): Call build_case_label.
	* gimplify.c (gimplify_switch_expr): Likewise.
	* omp-low.c (expand_omp_sections): Likewise.
	* tree-eh.c (lower_try_finally_switch): Likewise.
	(lower_eh_dispatch): Likewise.
	* tree.h (build_case_label): Declare.
	* tree.c (build_case_label): Define.

gcc/c-family/
	* c-common.c (c_add_case_label): Omit the loc argument to
	build_case_label.
	* c-common.h (build_case_label): Remove.
	* c-semantics.c (build_case_label): Remove.

gcc/cp/
	* decl.c (finish_case_label): Omit the loc argument to
	build_case_label.

gcc/fortran/
	* trans-decl.c (gfc_trans_entry_master_switch): Call build_case_label.
	* trans-io.c (add_case): Likewise.
	* trans-stmt.c (gfc_trans_integer_select): Likewise.
	(gfc_trans_character_select): Likewise.

gcc/go/
	* go-gcc.cc (Gcc_backend::switch_statement): Call build_case_label.

gcc/java/
	* expr.c (expand_java_switch): Call build_case_label.
	(expand_java_add_case): Likewise.

From-SVN: r173467
2011-05-06 03:47:57 +00:00
Richard Guenther
d35936ab70 tree.h (int_const_binop): Remove notrunc argument.
2011-05-04  Richard Guenther  <rguenther@suse.de>

	* tree.h (int_const_binop): Remove notrunc argument.
	* fold-const.c (int_const_binop): Remove notrunc argument.  Always
	create integer constants that are properly truncated.
	(extract_muldiv_1): Expand one notrunc int_const_binop caller.
	(const_binop): Remove zero notrunc argument to int_const_binop.
	(size_binop_loc): Likewise.
	(fold_div_compare): Likewise.
	(maybe_canonicalize_comparison_1): Likewise.
	(fold_comparison): Likewise.
	(fold_binary_loc): Likewise.
	(multiple_of_p): Likewise.
	* expr.c (store_constructor): Likewise.
	* gimple-fold.c (maybe_fold_offset_to_array_ref): Likewise.
	(maybe_fold_stmt_addition): Likewise.
	* ipa-prop.c (ipa_modify_call_arguments): Likewise.
	* stor-layout.c (layout_type): Likewise.
	* tree-data-ref.c (tree_fold_divides_p): Likewise.
	* tree-sra.c (build_ref_for_offset): Likewise.
	(build_user_friendly_ref_for_offset): Likewise.
	* tree-ssa-address.c (maybe_fold_tmr): Likewise.
	* tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Likewise.
	* tree-ssa-loop-niter.c (inverse): Likewise.
	* tree-ssa-pre.c (create_component_ref_by_pieces_1): Likewise.
	* tree-ssa.c (maybe_rewrite_mem_ref_base): Likewise.
	* tree-switch-conversion.c (check_range): Likewise.
	(build_constructors): Likewise.
	* tree-vect-generic.c (expand_vector_piecewise): Likewise.
	* tree-vrp.c (set_and_canonicalize_value_range): Likewise.
	(extract_range_from_assert): Likewise.
	(vrp_int_const_binop): Likewise.
	(extract_range_from_binary_expr): Likewise.
	(extract_range_from_unary_expr): Likewise.
	(check_array_ref): Likewise.
	(find_case_label_range): Likewise.
	(simplify_div_or_mod_using_ranges): Likewise.
	* tree-cfg.c (group_case_labels_stmt): Use double-ints for
	comparing case labels for merging.


	ada/
	* gcc-interface/trans.c (gnat_to_gnu): Remove zero notrunc argument to
	int_const_binop.
	(pos_to_constructor): Likewise.

	fortran/
	* trans-types.c (gfc_get_array_type_bounds): Remove zero notrunc
	argument to int_const_binop.

From-SVN: r173356
2011-05-04 09:04:53 +00:00
Nathan Froyd
c1fd8753c5 trans.c (gigi): Call build_function_type_list instead of build_function_type.
* gcc-interface/trans.c (gigi): Call build_function_type_list instead
	of build_function_type.  Adjust calls to...
	(build_raise_check): ...this.  Do not take a void_tree parameter.
	Call build_function_type_list instead of build_function_type.
	Fix head comment and swap couple of conditional blocks.

Co-Authored-By: Eric Botcazou <ebotcazou@adacore.com>

From-SVN: r173325
2011-05-03 16:34:20 +00:00
Eric Botcazou
7d7fcb08c3 gigi.h (create_subprog_decl): Add ARTIFICIAL_FLAG parameter.
* gcc-interface/gigi.h (create_subprog_decl): Add ARTIFICIAL_FLAG
	parameter.
	* gcc-interface/utils.c (create_subprog_decl): Likewise.  Set
	DECL_ARTIFICIAL and DECL_NO_INLINE_WARNING_P on the DECL accordingly.
	* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Subprogram_Type>: Add
	ARTIFICIAL_FLAG local variable and pass it to create_subprog_decl.
	<all>: Do not set flags on the reused DECL node coming from an alias.
	Set DECL_IGNORED_P on the DECL node built for subprograms if they
	don't need debug info here...
	* gcc-interface/trans.c (Subprogram_Body_to_gnu): ...and not here.
	(gigi): Adjust calls to create_subprog_decl.
	(build_raise_check): Likewise.
	(establish_gnat_vms_condition_handler): Likewise.
	(Compilation_Unit_to_gnu): Likewise.
	(gnat_to_gnu): Likewise.

From-SVN: r172862
2011-04-22 17:35:08 +00:00
Eric Botcazou
88872b00da trans.c (Identifier_to_gnu): Do not return initializers of aggregate types that contain a placeholder.
* gcc-interface/trans.c (Identifier_to_gnu): Do not return initializers
	of aggregate types that contain a placeholder.

From-SVN: r172209
2011-04-08 20:21:36 +00:00
Eric Botcazou
65444786be ada-tree.h (DECL_TAFT_TYPE_P): New flag.
* gcc-interface/ada-tree.h (DECL_TAFT_TYPE_P): New flag.
	* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Incomplete_Type>: Set it
	if this is a Taft amendment type and the full declaration is available.
	* gcc-interface/trans.c (process_type): Likewise.
	If there is an old type, mark the new one as used if DECL_TAFT_TYPE_P.
	(process_freeze_entity): Likewise.
	* gcc-interface/utils.c (dummy_global): New static variable.
	(gnat_write_global_declarations): If there are types declared as used
	at the global level, insert them in the global hash table.

From-SVN: r171881
2011-04-02 08:36:32 +00:00
Eric Botcazou
1aeb40dd6d gigi.h (record_builtin_type): Add ARTIFICIAL_P param.
* gcc-interface/gigi.h (record_builtin_type): Add ARTIFICIAL_P param.
	* gcc-interface/utils.c (gnat_pushdecl): If this is a non-artificial
	declaration of an array type, then set DECL_ORIGINAL_TYPE to a distinct
	copy.
	(record_builtin_type): Add ARTIFICIAL_P parameter.  Set DECL_ARTIFICIAL
	flag of the type accordingly.
	* gcc-interface/trans.c (gigi): Adjust calls to record_builtin_type.

From-SVN: r171880
2011-04-02 08:28:21 +00:00
Eric Botcazou
6ddf984362 gigi.h (finalize_from_with_types): Adjust comment.
* gcc-interface/gigi.h (finalize_from_with_types): Adjust comment.
	* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Access_Type>: Defer
	unconditionally to the end of the unit when the designated type is
	limited_with'ed.
	<all>: Rename local variable.  Attempt to un-defer types only and do it
	for limited_with'ed types as well.
	(finalize_from_with_types): Adjust comment.  Rename variable and tidy.
	* gcc-interface/trans.c (Compilation_Unit_to_gnu): Use GNAT_UNIT
	consistently and remove redundant call to finalize_from_with_types.

From-SVN: r171552
2011-03-26 09:55:04 +00:00
Eric Botcazou
5daed84a54 inline.adb (Back_End_Cannot_Inline): Lift restriction on calls to subprograms without a previous spec declared in...
* inline.adb (Back_End_Cannot_Inline): Lift restriction on calls to
	subprograms without a previous spec declared in the same unit.
	* gcc-interface/trans.c (Compilation_Unit_to_gnu): Process inlined
	subprograms at the end of the unit instead of at the beginning.
	* gcc-interface/utils.c (create_subprog_decl): Check that the entity
	isn't public for the special handling of non-inline functions nested
	inside inline external functions.

From-SVN: r171551
2011-03-26 09:34:40 +00:00
Eric Botcazou
abbc8c7b15 trans.c (gnat_to_gnu): Remove obsolete case of non-conversion to the nominal result type at the end.
* gcc-interface/trans.c (gnat_to_gnu): Remove obsolete case of
	non-conversion to the nominal result type at the end.

From-SVN: r171398
2011-03-24 15:15:44 +00:00
Eric Botcazou
ddb5a105e2 trans.c (create_temporary): New function taken from...
* gcc-interface/trans.c (create_temporary): New function taken from...
	(create_init_temporary): ...here.  Call it.
	(call_to_gnu): Create the temporary for the return value early, if any.
	Create it for a function with copy-in/copy-out parameters if there is
	no target; in other cases of copy-in/copy-out, use another temporary.
	Push the new binding level lazily.  Add and rename local variables.

From-SVN: r171345
2011-03-23 10:04:08 +00:00
Eric Botcazou
bb1f792960 gigi.h (smaller_form_type_p): Declare.
* gcc-interface/gigi.h (smaller_form_type_p): Declare.
	* gcc-interface/trans.c (smaller_form_type_p): Make global and move...
	* gcc-interface/utils.c (smaller_form_type_p): ...to here.
	(convert): Deal with conversions from a smaller form type specially.

From-SVN: r171091
2011-03-17 12:37:53 +00:00
Eric Botcazou
31a5a54750 gigi.h (fill_vms_descriptor): Take GNU_TYPE instead of GNAT_FORMAL.
* gcc-interface/gigi.h (fill_vms_descriptor): Take GNU_TYPE instead of
	GNAT_FORMAL.
	* gcc-interface/utils2.c (fill_vms_descriptor): Move from here to...
	* gcc-interface/utils.c (fill_vms_descriptor): ...here.  Take GNU_TYPE
	instead of GNAT_FORMAL.  Protect the expression against multiple uses.
	Do not generate the check directly, instead instantiate the template
	check present in the descriptor.
	(make_descriptor_field): Move around.
	(build_vms_descriptor32): Build a template check in the POINTER field.
	(build_vms_descriptor): Remove useless suffixes.
	* gcc-interface/trans.c (call_to_gnu): Adjust fill_vms_descriptor call.

From-SVN: r169788
2011-02-03 13:19:38 +00:00
Eric Botcazou
2d3c7e4f2d trans.c (Case_Statement_to_gnu): Put the SLOC of the end-of-case on the end label and its associated gotos, if any.
* gcc-interface/trans.c (Case_Statement_to_gnu): Put the SLOC of the
	end-of-case on the end label and its associated gotos, if any.

From-SVN: r168458
2011-01-04 09:50:33 +00:00
Eric Botcazou
0394741f9b trans.c (Subprogram_Body_to_gnu): Evaluate the expressions of the parameter cache within the statement group of...
* gcc-interface/trans.c (Subprogram_Body_to_gnu): Evaluate the
	expressions of the parameter cache within the statement group of
	the CICO mechanism.

From-SVN: r168456
2011-01-04 09:43:56 +00:00
Olivier Hainque
2a02d0907c trans.c (BLOCK_SOURCE_END_LOCATION): Provide default.
* gcc-interface/trans.c (BLOCK_SOURCE_END_LOCATION): Provide default.
	(set_end_locus_from_node): New function.
	(Subprogram_Body_to_gnu): Use it to mark both the inner BIND_EXPR we
	make and the function end_locus.
	(Compilation_Unit_to_gnu): Call it instead of a straight Sloc_to_locus
	for the elaboration subprogram.
	(set_gnu_expr_location_from_node) <default case>: Use it to attempt to
	set the end_locus of the expression as well.

Co-Authored-By: Eric Botcazou <ebotcazou@adacore.com>

From-SVN: r168455
2011-01-04 09:30:06 +00:00
Eric Botcazou
89f5e97804 re PR ada/47131 (internal error for ACATS C34011B on SJLJ targets)
PR ada/47131
	* gcc-interface/trans.c (Identifier_to_gnu): In SJLJ mode, do not make
	variables that are referenced in exception handlers volatile.

From-SVN: r168454
2011-01-04 08:58:02 +00:00
Ralf Wildenhues
308e6f3a18 Fix typos in gcc/ada.
gcc/ada/:
	* projects.texi: Fix typos.
	* gnat_rm.texi: Likewise.
	* gnat_ugn.texi: Likewise.
	* sem_util.adb: Fix typo in variable, typos in comments.
	* a-btgbso.adb: Fix typos in comments.
	* a-cbdlli.adb, a-cbhase.ads, a-cdlili.adb, a-cobove.adb,
	a-coinve.adb, a-convec.adb, a-direct.ads, a-strunb-shared.adb,
	a-strunb-shared.ads, a-stuten.ads, a-stwiun-shared.adb,
	a-stwiun-shared.ads, a-stzunb-shared.adb, a-stzunb-shared.ads,
	a-suenco.adb, a-suenst.adb, a-suewst.adb, a-suezst.adb, ali.ads,
	aspects.ads, atree.ads, binde.adb, bindgen.adb, checks.adb,
	checks.ads, einfo.ads, err_vars.ads, errout.adb, errout.ads,
	exp_aggr.adb, exp_attr.adb, exp_cg.adb, exp_ch3.adb,
	exp_ch4.adb, exp_ch5.adb, exp_ch6.adb, exp_ch7.adb,
	exp_dbug.ads, exp_disp.adb, exp_fixd.ads, freeze.adb,
	g-altive.ads, g-comlin.ads, g-excact.ads, g-mbdira.adb,
	g-sechas.ads, g-sehash.ads, g-sha1.ads, g-sha224.ads,
	g-sha256.ads, g-sha384.ads, g-sha512.ads, g-shsh32.ads,
	g-shsh64.ads, g-socket.adb, g-socket.ads, g-sothco.ads,
	gcc-interface/decl.c, gcc-interface/trans.c,
	gcc-interface/utils2.c, gnat1drv.adb, init.c, inline.adb,
	link.c, locales.c, make.adb, mingw32.h, namet.ads, osint.adb,
	par-ch12.adb, par-ch13.adb, par-ch3.adb, par-ch4.adb,
	par-prag.adb, par.adb, par_sco.adb, prepcomp.adb,
	prj-conf.ads, prj-dect.adb, prj-env.adb, prj-env.ads,
	prj-nmsc.adb, prj-tree.ads, prj-util.ads, prj.adb, prj.ads,
	s-auxdec-vms-alpha.adb, s-auxdec-vms_64.ads, s-oscons-tmplt.c,
	s-osinte-vxworks.ads, s-osprim-mingw.adb, s-regexp.adb,
	s-stusta.adb, s-taprop-mingw.adb, s-taprop-solaris.adb,
	scn.adb, scos.ads, sem.adb, sem_aggr.adb, sem_attr.adb,
	sem_aux.adb, sem_aux.ads, sem_ch12.adb, sem_ch12.ads,
	sem_ch13.adb, sem_ch13.ads, sem_ch3.adb, sem_ch4.adb,
	sem_ch6.adb, sem_ch7.adb, sem_ch8.adb, sem_disp.adb,
	sem_disp.ads, sem_eval.adb, sem_intr.adb, sem_prag.adb,
	sem_res.adb, sem_scil.adb, sem_util.ads, sem_warn.adb,
	sem_warn.ads, sinfo.ads, socket.c, styleg.adb, switch.ads,
	sysdep.c, tb-alvxw.c, xoscons.adb: Likewise.

From-SVN: r168082
2010-12-20 07:26:57 +00:00
Eric Botcazou
5128d641ba trans.c (can_be_lower_p): New predicate.
* gcc-interface/trans.c (can_be_lower_p): New predicate.
	(Loop_Statement_to_gnu): Do not generate the entry condition if we know
	that it will be true.

From-SVN: r167757
2010-12-13 17:51:47 +00:00
Eric Botcazou
5a19bc0a79 trans.c (addressable_p): Rewrite obsolete paragraph in head comment.
* gcc-interface/trans.c (addressable_p): Rewrite obsolete paragraph in
	head comment.

From-SVN: r166864
2010-11-17 12:00:15 +00:00
Eric Botcazou
6532e8a053 trans.c (gigi): Don't set 'pure' flag on SJLJ routines.
* gcc-interface/trans.c (gigi): Don't set 'pure' flag on SJLJ routines.
	* gcc-interface/utils2.c (compare_arrays): Add LOC parameter.  Set it
	directly on all the comparison expressions.
	(build_binary_op): Pass input_location to compare_arrays.

From-SVN: r166533
2010-11-10 12:09:46 +00:00
Eric Botcazou
054d6b836f trans.c (lvalue_required_p) <N_Type_Conversion>): Look through it for elementary types as well.
* gcc-interface/trans.c (lvalue_required_p) <N_Type_Conversion>): Look
	through it for elementary types as well.
	<N_Unchecked_Type_Conversion>: Adjust to above change.
	<N_Allocator>: Likewise.
	(gnat_to_gnu): Do not attempt to rewrite boolean literals.

From-SVN: r166532
2010-11-10 11:56:14 +00:00