diff options
Diffstat (limited to 'ortho')
-rw-r--r-- | ortho/debug/ortho_debug.adb | 11 | ||||
-rw-r--r-- | ortho/gcc/Makefile | 10 | ||||
-rw-r--r-- | ortho/gcc/ortho-lang.c | 35 | ||||
-rw-r--r-- | ortho/gcc/ortho_ident.adb | 3 |
4 files changed, 50 insertions, 9 deletions
diff --git a/ortho/debug/ortho_debug.adb b/ortho/debug/ortho_debug.adb index e61886e..633fe70 100644 --- a/ortho/debug/ortho_debug.adb +++ b/ortho/debug/ortho_debug.adb @@ -1311,9 +1311,8 @@ package body Ortho_Debug is is subtype O_Dnode_Const_Value is O_Dnode_Type (ON_Const_Value); N : O_Dnode; + Temp : constant O_Dnode := Const; begin - Const := Const; - if Const.Const_Value /= O_Dnode_Null then -- Constant already has a value. raise Syntax_Error; @@ -1335,14 +1334,15 @@ package body Ortho_Debug is Lineno => 0, Const_Decl => Const, Value => O_Cnode_Null); - Const.Const_Value := N; + Temp.Const_Value := N; + Const := Temp; Add_Decl (N, False); end Start_Const_Value; procedure Finish_Const_Value (Const : in out O_Dnode; Val : O_Cnode) is + Temp : constant O_Dnode := Const; begin - Const := Const; if Const.Const_Value = O_Dnode_Null then -- Start_Const_Value not called. @@ -1357,7 +1357,8 @@ package body Ortho_Debug is raise Type_Error; end if; Check_Type (Val.Ctype, Const.Dtype); - Const.Const_Value.Value := Val; + Temp.Const_Value.Value := Val; + Const := Temp; end Finish_Const_Value; procedure New_Var_Decl diff --git a/ortho/gcc/Makefile b/ortho/gcc/Makefile index 2687b79..da64a29 100644 --- a/ortho/gcc/Makefile +++ b/ortho/gcc/Makefile @@ -2,11 +2,13 @@ ortho_srcdir=.. orthobe_srcdir=$(ortho_srcdir)/gcc agcc_objdir=. agcc_srcdir=$(ortho_srcdir)/gcc -AGCC_GCCSRC_DIR:=$(HOME)/dist/gcc-4.7.2 -AGCC_GCCOBJ_DIR:=$(AGCC_GCCSRC_DIR)-objs/ +# Modify AGCC_GCCSRC_DIR and AGCC_GCCOBJ_DIR for your environment +AGCC_GCCSRC_DIR:=$(HOME)/Projects/gcc4.8.2/source/gcc-4.8.2/ +AGCC_GCCOBJ_DIR:=$(HOME)/Projects/gcc4.8.2/build/ SED=sed GNATMAKE=gnatmake CC=gcc +COMPILER=g++ all: $(ortho_exec) @@ -16,7 +18,8 @@ ORTHO_BASENAME=$(orthobe_srcdir)/ortho_gcc ORTHO_PACKAGE=Ortho_Gcc #LIBFLAGS=$(HOME)/dist/mpfr-2.3.1/.libs/libmpfr.a $(HOME)/dist/gmp-4.2.2/.libs/libgmp.a -LIBFLAGS=-L$(HOME)/dist/build/lib -lmpc -lmpfr -lgmp -lz -ldl #$(AGCC_GCCOBJ_DIR)/intl/libintl.a -liconv -lz +LIBFLAGS=-L$(AGCC_GCCOBJ_DIR)./mpfr/.libs -L$(AGCC_GCCOBJ_DIR)./mpc/src/.libs -lmpc -lmpfr -lgmp -lz -ldl -lstdc++ +#$(AGCC_GCCOBJ_DIR)/intl/libintl.a -liconv -lz $(ortho_exec): $(AGCC_DEPS) $(ORTHO_BASENAME).ads force $(GNATMAKE) -m -o $@ -g -aI$(ortho_srcdir) \ @@ -26,6 +29,7 @@ $(ortho_exec): $(AGCC_DEPS) $(ORTHO_BASENAME).ads force $(AGCC_GCCOBJ_DIR)gcc/libcommon-target.a \ $(AGCC_GCCOBJ_DIR)gcc/libcommon.a \ $(AGCC_GCCOBJ_DIR)libcpp/libcpp.a \ + $(AGCC_GCCOBJ_DIR)libbacktrace/.libs/libbacktrace.a \ $(AGCC_GCCOBJ_DIR)libiberty/libiberty.a \ $(AGCC_GCCOBJ_DIR)libdecnumber/libdecnumber.a \ $(LIBFLAGS) #-static diff --git a/ortho/gcc/ortho-lang.c b/ortho/gcc/ortho-lang.c index b46c012..904bfa4 100644 --- a/ortho/gcc/ortho-lang.c +++ b/ortho/gcc/ortho-lang.c @@ -23,6 +23,9 @@ #include "tree-pass.h" #include "tree-dump.h" +// temp for debugging +// #include "stdio.h" + /* TODO: * remove stmt_list_stack, save in if/case/loop block * Re-add -v (if necessary) @@ -307,6 +310,38 @@ ortho_init (void) BUILT_IN_STACK_RESTORE, BUILT_IN_NORMAL, NULL, NULL_TREE), true); } + /* Test and (if necessary) repair BUILT_IN_UNREACHABLE builtin. + FIXME: Re-evaluate this and remove when upstream gcc has fixed the + underlying problem : gcc4.8.2 segfaults compiling with -O2, + during fn "void unloop_loops" in tree-ssa-loop-ivcanon.c */ + { + tree func_type = build_function_type (ptr_type_node, NULL_TREE); + + if (builtin_decl_implicit_p (BUILT_IN_UNREACHABLE)) + { + // printf("BUILT_IN_UNREACHABLE function is available\n"); + } + else + { + tree builtin_f = builtin_decl_explicit (BUILT_IN_UNREACHABLE); + // printf("No implicit BUILT_IN_UNREACHABLE function : repairing!\n"); + debug_tree(builtin_f); + if (builtin_f == NULL_TREE) + { + // printf("Adding BUILT_IN_UNREACHABLE function\n"); + set_builtin_decl (BUILT_IN_UNREACHABLE, + builtin_function("__builtin_unreachable", func_type, + BUILT_IN_UNREACHABLE, BUILT_IN_NORMAL, NULL, NULL_TREE), + true); + } + else + { + // printf("Making BUILT_IN_UNREACHABLE function implicit\n"); + set_builtin_decl_implicit_p (BUILT_IN_UNREACHABLE, true); + } + } + } + { REAL_VALUE_TYPE v; diff --git a/ortho/gcc/ortho_ident.adb b/ortho/gcc/ortho_ident.adb index 5ff0939..56a8510 100644 --- a/ortho/gcc/ortho_ident.adb +++ b/ortho/gcc/ortho_ident.adb @@ -1,7 +1,8 @@ package body Ortho_Ident is function Get_Identifier_With_Length (Str : Address; Size : Integer) return O_Ident; - pragma Import (C, Get_Identifier_With_Length, "get_identifier_with_length_c"); + pragma Import (C, Get_Identifier_With_Length, + "get_identifier_with_length_c"); function Compare_Identifier_String (Id : O_Ident; Str : Address; Size : Integer) |