diff options
Diffstat (limited to 'gcc-4.6/gcc/ada/gcc-interface')
-rw-r--r-- | gcc-4.6/gcc/ada/gcc-interface/Makefile.in | 56 | ||||
-rw-r--r-- | gcc-4.6/gcc/ada/gcc-interface/decl.c | 25 | ||||
-rw-r--r-- | gcc-4.6/gcc/ada/gcc-interface/trans.c | 22 |
3 files changed, 89 insertions, 14 deletions
diff --git a/gcc-4.6/gcc/ada/gcc-interface/Makefile.in b/gcc-4.6/gcc/ada/gcc-interface/Makefile.in index b64ba5579..77027dd82 100644 --- a/gcc-4.6/gcc/ada/gcc-interface/Makefile.in +++ b/gcc-4.6/gcc/ada/gcc-interface/Makefile.in @@ -1792,7 +1792,6 @@ ifeq ($(strip $(filter-out powerpc% linux%,$(arch) $(osys))),) s-osinte.adb<s-osinte-posix.adb \ s-tpopsp.adb<s-tpopsp-posix-foreign.adb \ g-sercom.adb<g-sercom-linux.adb \ - g-trasym.adb<g-trasym-dwarf.adb \ $(ATOMICS_TARGET_PAIRS) ifeq ($(strip $(filter-out xenomai,$(THREAD_KIND))),) @@ -2105,6 +2104,7 @@ ifeq ($(strip $(filter-out %x86_64 linux%,$(arch) $(osys))),) endif ifeq ($(strip $(filter-out darwin%,$(osys))),) + SO_OPTS = -Wl,-flat_namespace -shared-libgcc ifeq ($(strip $(filter-out %86,$(arch))),) LIBGNAT_TARGET_PAIRS = \ a-intnam.ads<a-intnam-darwin.ads \ @@ -2124,6 +2124,7 @@ ifeq ($(strip $(filter-out darwin%,$(osys))),) ifeq ($(strip $(MULTISUBDIR)),/x86_64) LIBGNAT_TARGET_PAIRS += \ system.ads<system-darwin-x86_64.ads + SO_OPTS += -m64 else LIBGNAT_TARGET_PAIRS += \ system.ads<system-darwin-x86.ads @@ -2150,6 +2151,7 @@ ifeq ($(strip $(filter-out darwin%,$(osys))),) ifeq ($(strip $(MULTISUBDIR)),/i386) LIBGNAT_TARGET_PAIRS += \ system.ads<system-darwin-x86.ads + SO_OPTS += -m32 else LIBGNAT_TARGET_PAIRS += \ system.ads<system-darwin-x86_64.ads @@ -2171,8 +2173,15 @@ ifeq ($(strip $(filter-out darwin%,$(osys))),) a-numaux.ads<a-numaux-darwin.ads \ a-numaux.adb<a-numaux-darwin.adb \ g-trasym.ads<g-trasym-unimplemented.ads \ - g-trasym.adb<g-trasym-unimplemented.adb \ - system.ads<system-darwin-ppc.ads + g-trasym.adb<g-trasym-unimplemented.adb + ifeq ($(strip $(MULTISUBDIR)),/ppc64) + LIBGNAT_TARGET_PAIRS += \ + system.ads<system-darwin-ppc64.ads + SO_OPTS += -m64 + else + LIBGNAT_TARGET_PAIRS += \ + system.ads<system-darwin-ppc.ads + endif endif TOOLS_TARGET_PAIRS = \ @@ -2180,8 +2189,6 @@ ifeq ($(strip $(filter-out darwin%,$(osys))),) EH_MECHANISM=-gcc GNATLIB_SHARED = gnatlib-shared-darwin - SO_OPTS = -Wl,-flat_namespace -shared-libgcc - RANLIB = ranlib -c GMEM_LIB = gmemlib LIBRARY_VERSION := $(LIB_VERSION) soext = .dylib @@ -2439,21 +2446,52 @@ install-gnatlib: ../stamp-gnatlib-$(RTSDIR) $(foreach PAIR,$(LIBGNAT_TARGET_PAIRS), \ $(LN_S) $(fsrcpfx)ada/$(word 2,$(subst <, ,$(PAIR))) \ $(RTSDIR)/$(word 1,$(subst <, ,$(PAIR)));) -# Copy generated target dependent sources - $(RM) $(RTSDIR)/s-oscons.ads - (cd $(RTSDIR); $(LN_S) ../s-oscons.ads s-oscons.ads) +# Copy tsystem.h + $(CP) $(srcdir)/tsystem.h $(RTSDIR) $(RM) ../stamp-gnatlib-$(RTSDIR) touch ../stamp-gnatlib1-$(RTSDIR) # GNULLI End ############################################################# +ifeq ($(strip $(filter-out alpha64 ia64 dec hp vms% openvms% alphavms%,$(subst -, ,$(host)))),) +OSCONS_CPP=../../$(DECC) -E /comment=as_is -DNATIVE \ + -DTARGET='""$(target)""' $(fsrcpfx)ada/s-oscons-tmplt.c + +OSCONS_EXTRACT=../../$(DECC) -DNATIVE \ + -DTARGET='""$(target)""' $(fsrcpfx)ada/s-oscons-tmplt.c ; \ + ld -o s-oscons-tmplt.exe s-oscons-tmplt.obj; \ + ./s-oscons-tmplt.exe > s-oscons-tmplt.s + +else +# GCC_FOR_TARGET has paths relative to the gcc directory, so we need to adjust +# for running it from $(RTSDIR) +OSCONS_CC=`echo "$(GCC_FOR_TARGET)" \ + | sed -e 's^\./xgcc^../../xgcc^' -e 's^-B./^-B../../^'` +OSCONS_CPP=$(OSCONS_CC) $(GNATLIBCFLAGS) -E -C \ + -DTARGET=\"$(target)\" $(fsrcpfx)ada/s-oscons-tmplt.c > s-oscons-tmplt.i +OSCONS_EXTRACT=$(OSCONS_CC) -S s-oscons-tmplt.i +endif + +./bldtools/oscons/xoscons: xoscons.adb xutil.ads xutil.adb + -$(MKDIR) ./bldtools/oscons + $(RM) $(addprefix ./bldtools/oscons/,$(notdir $^)) + $(CP) $^ ./bldtools/oscons + (cd ./bldtools/oscons ; gnatmake -q xoscons) + +$(RTSDIR)/s-oscons.ads: ../stamp-gnatlib1-$(RTSDIR) s-oscons-tmplt.c gsocket.h ./bldtools/oscons/xoscons + $(RM) $(RTSDIR)/s-oscons-tmplt.i $(RTSDIR)/s-oscons-tmplt.s + (cd $(RTSDIR) ; \ + $(OSCONS_CPP) ; \ + $(OSCONS_EXTRACT) ; \ + ../bldtools/oscons/xoscons) + # Don't use semicolon separated shell commands that involve list expansions. # The semicolon triggers a call to DCL on VMS and DCL can't handle command # line lengths in excess of 256 characters. # Example: cd $(RTSDIR); ar rc libfoo.a $(LONG_LIST_OF_OBJS) # is guaranteed to overflow the buffer. -gnatlib: ../stamp-gnatlib1-$(RTSDIR) ../stamp-gnatlib2-$(RTSDIR) +gnatlib: ../stamp-gnatlib1-$(RTSDIR) ../stamp-gnatlib2-$(RTSDIR) $(RTSDIR)/s-oscons.ads $(MAKE) -C $(RTSDIR) \ CC="`echo \"$(GCC_FOR_TARGET)\" \ | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'`" \ diff --git a/gcc-4.6/gcc/ada/gcc-interface/decl.c b/gcc-4.6/gcc/ada/gcc-interface/decl.c index e5768950d..58459d4ab 100644 --- a/gcc-4.6/gcc/ada/gcc-interface/decl.c +++ b/gcc-4.6/gcc/ada/gcc-interface/decl.c @@ -808,16 +808,30 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) && No (Address_Clause (gnat_entity)))) && TREE_CODE (TYPE_SIZE (gnu_type)) == INTEGER_CST) { - /* No point in jumping through all the hoops needed in order + unsigned int size_cap, align_cap; + + /* No point in promoting the alignment if this doesn't prevent + BLKmode access to the object, in particular block copy, as + this will for example disable the NRV optimization for it. + No point in jumping through all the hoops needed in order to support BIGGEST_ALIGNMENT if we don't really have to. So we cap to the smallest alignment that corresponds to a known efficient memory access pattern of the target. */ - unsigned int align_cap = Is_Atomic (gnat_entity) - ? BIGGEST_ALIGNMENT - : get_mode_alignment (ptr_mode); + if (Is_Atomic (gnat_entity)) + { + size_cap = UINT_MAX; + align_cap = BIGGEST_ALIGNMENT; + } + else + { + size_cap = MAX_FIXED_MODE_SIZE; + align_cap = get_mode_alignment (ptr_mode); + } if (!host_integerp (TYPE_SIZE (gnu_type), 1) - || compare_tree_int (TYPE_SIZE (gnu_type), align_cap) >= 0) + || compare_tree_int (TYPE_SIZE (gnu_type), size_cap) > 0) + align = 0; + else if (compare_tree_int (TYPE_SIZE (gnu_type), align_cap) > 0) align = align_cap; else align = ceil_alignment (tree_low_cst (TYPE_SIZE (gnu_type), 1)); @@ -6422,6 +6436,7 @@ maybe_pad_type (tree type, tree size, unsigned int align, if (align != 0 && TREE_CODE (type) == RECORD_TYPE && TYPE_MODE (type) == BLKmode + && !TREE_ADDRESSABLE (type) && TREE_CODE (orig_size) == INTEGER_CST && !TREE_OVERFLOW (orig_size) && compare_tree_int (orig_size, MAX_FIXED_MODE_SIZE) <= 0 diff --git a/gcc-4.6/gcc/ada/gcc-interface/trans.c b/gcc-4.6/gcc/ada/gcc-interface/trans.c index b60cccf1e..29253958d 100644 --- a/gcc-4.6/gcc/ada/gcc-interface/trans.c +++ b/gcc-4.6/gcc/ada/gcc-interface/trans.c @@ -6276,6 +6276,28 @@ gnat_gimplify_expr (tree *expr_p, gimple_seq *pre_p, return GS_UNHANDLED; + case VIEW_CONVERT_EXPR: + op = TREE_OPERAND (expr, 0); + + /* If we are view-converting a CONSTRUCTOR or a call from an aggregate + type to a scalar one, explicitly create the local temporary. That's + required if the type is passed by reference. */ + if ((TREE_CODE (op) == CONSTRUCTOR || TREE_CODE (op) == CALL_EXPR) + && AGGREGATE_TYPE_P (TREE_TYPE (op)) + && !AGGREGATE_TYPE_P (TREE_TYPE (expr))) + { + tree mod, new_var = create_tmp_var_raw (TREE_TYPE (op), "C"); + gimple_add_tmp_var (new_var); + + mod = build2 (INIT_EXPR, TREE_TYPE (new_var), new_var, op); + gimplify_and_add (mod, pre_p); + + TREE_OPERAND (expr, 0) = new_var; + return GS_OK; + } + + return GS_UNHANDLED; + case DECL_EXPR: op = DECL_EXPR_DECL (expr); |