summaryrefslogtreecommitdiff
path: root/ortho/gcc
diff options
context:
space:
mode:
authorgingold2008-08-30 13:30:19 +0000
committergingold2008-08-30 13:30:19 +0000
commitcd9300765e7e3fd43e450777e98a778146f700c2 (patch)
treef013fea17ae4eee9c1649e63b99b9bfe377fafb4 /ortho/gcc
parent4b6571671497ecc1f846bfa49678254e14511fc9 (diff)
downloadghdl-cd9300765e7e3fd43e450777e98a778146f700c2.tar.gz
ghdl-cd9300765e7e3fd43e450777e98a778146f700c2.tar.bz2
ghdl-cd9300765e7e3fd43e450777e98a778146f700c2.zip
Switch to gcc 4.3
Don't use tagged types in grt (not supported by recent versions of GNAT) Fix warnings
Diffstat (limited to 'ortho/gcc')
-rw-r--r--ortho/gcc/Makefile10
-rw-r--r--ortho/gcc/Makefile.inc12
-rw-r--r--ortho/gcc/ortho-lang.c102
-rw-r--r--ortho/gcc/ortho_ident.adb1
4 files changed, 40 insertions, 85 deletions
diff --git a/ortho/gcc/Makefile b/ortho/gcc/Makefile
index 63fb5e3..18fc0b1 100644
--- a/ortho/gcc/Makefile
+++ b/ortho/gcc/Makefile
@@ -2,9 +2,10 @@ ortho_srcdir=..
orthobe_srcdir=$(ortho_srcdir)/gcc
agcc_objdir=.
agcc_srcdir=$(ortho_srcdir)/gcc
-AGCC_GCCSRC_DIR:=$(HOME)/dist/gcc-4.2.4
+AGCC_GCCSRC_DIR:=$(HOME)/dist/gcc-4.3.1
AGCC_GCCOBJ_DIR:=$(AGCC_GCCSRC_DIR)-objs/
SED=sed
+GNATMAKE=gnatmake
all: $(ortho_exec)
@@ -15,12 +16,13 @@ ORTHO_PACKAGE=Ortho_Gcc
$(ortho_exec): $(AGCC_DEPS) $(ORTHO_BASENAME).ads force
- gnatmake -m -o $@ -g -aI$(ortho_srcdir) \
+ $(GNATMAKE) -m -o $@ -g -aI$(ortho_srcdir) \
-aI$(ortho_srcdir)/gcc $(GNAT_FLAGS) ortho_gcc-main \
- -bargs -E -largs $(AGCC_OBJS) \
+ -bargs -E -largs $(AGCC_OBJS) \
$(AGCC_GCCOBJ_DIR)libcpp/libcpp.a \
$(AGCC_GCCOBJ_DIR)libiberty/libiberty.a \
- $(AGCC_GCCOBJ_DIR)libdecnumber/libdecnumber.a #-static
+ $(AGCC_GCCOBJ_DIR)libdecnumber/libdecnumber.a \
+ -lmpfr -lgmp #-static
clean: agcc-clean
$(RM) -f *.o *.ali ortho_nodes-main
diff --git a/ortho/gcc/Makefile.inc b/ortho/gcc/Makefile.inc
index ef60808..8b7289a 100644
--- a/ortho/gcc/Makefile.inc
+++ b/ortho/gcc/Makefile.inc
@@ -27,24 +27,16 @@ AGCC_INC_FLAGS=-I$(AGCC_GCCOBJ_DIR)/gcc -I$(AGCC_GCCSRC_DIR)/include \
-I$(AGCC_GCCSRC_DIR)/libcpp/include
AGCC_CFLAGS=-g -Wall -DIN_GCC $(AGCC_INC_FLAGS)
-AGCC_LOCAL_OBJS=ortho-lang.o gcc-version.o
+AGCC_LOCAL_OBJS=ortho-lang.o
AGCC_DEPS := $(AGCC_LOCAL_OBJS)
AGCC_OBJS := $(AGCC_LOCAL_OBJS) \
$(AGCC_GCCOBJ_DIR)gcc/toplev.o \
+ $(AGCC_GCCOBJ_DIR)gcc/attribs.o \
$(AGCC_GCCOBJ_DIR)gcc/libbackend.a \
$(AGCC_GCCOBJ_DIR)libcpp/libcpp.a \
$(AGCC_GCCOBJ_DIR)libiberty/libiberty.a
-gcc-version.c: $(AGCC_GCCSRC_DIR)/gcc/BASE-VER
- -$(RM) -f $@
- echo '#include "version.h"' > $@
- echo "const char version_string[] = \""`cat $<` "(ghdl)\";" >> $@
- echo 'const char bug_report_url[] = "<URL:http://gna.org/projects/ghdl>";' >> $@
-
-gcc-version.o: gcc-version.c
- $(CC) -c -o $@ $< $(AGCC_CFLAGS)
-
ortho-lang.o: $(agcc_srcdir)/ortho-lang.c \
$(AGCC_GCCOBJ_DIR)gcc/gtype-vhdl.h \
$(AGCC_GCCOBJ_DIR)gcc/gt-vhdl-ortho-lang.h
diff --git a/ortho/gcc/ortho-lang.c b/ortho/gcc/ortho-lang.c
index a5037f9..c37e391 100644
--- a/ortho/gcc/ortho-lang.c
+++ b/ortho/gcc/ortho-lang.c
@@ -247,7 +247,7 @@ ortho_init (void)
{
tree n;
- input_location.line = 0;
+ input_location = BUILTINS_LOCATION;
/* Create a global binding. */
push_binding ();
@@ -372,13 +372,6 @@ ortho_handle_option (size_t code, const char *arg, int value)
}
}
-#if 0
-void
-linemap_init (void *s)
-{
-}
-#endif
-
extern int lang_parse_file (const char *filename);
static void
@@ -391,6 +384,9 @@ ortho_parse_file (int debug)
else
filename = in_fnames[0];
+ linemap_add (line_table, LC_ENTER, 0, filename ? filename :"*no-file*", 1);
+ input_location = linemap_line_start (line_table, 0, 252);
+
if (!lang_parse_file (filename))
errorcount++;
else
@@ -398,19 +394,7 @@ ortho_parse_file (int debug)
cgraph_finalize_compilation_unit ();
cgraph_optimize ();
}
-}
-
-static void
-ortho_expand_function (tree fndecl)
-{
- if (DECL_CONTEXT (fndecl) != NULL_TREE)
- {
- push_function_context ();
- tree_rest_of_compilation (fndecl);
- pop_function_context ();
- }
- else
- tree_rest_of_compilation (fndecl);
+ linemap_add (line_table, LC_LEAVE, 0, NULL, 1);
}
/* Called by the back-end or by the front-end when the address of EXP
@@ -610,6 +594,7 @@ builtin_function (const char *name,
make_decl_rtl (decl);
DECL_BUILT_IN_CLASS (decl) = class;
DECL_FUNCTION_CODE (decl) = function_code;
+ DECL_SOURCE_LOCATION (decl) = input_location;
return decl;
}
@@ -653,32 +638,6 @@ type_for_mode (enum machine_mode mode, int unsignedp)
return type_for_size (GET_MODE_BITSIZE (mode), unsignedp);
}
-/* Return the unsigned version of a TYPE_NODE, a scalar type. */
-static tree
-unsigned_type (tree type)
-{
- return type_for_size (TYPE_PRECISION (type), 1);
-}
-
-/* Return the signed version of a TYPE_NODE, a scalar type. */
-static tree
-signed_type (tree type)
-{
- return type_for_size (TYPE_PRECISION (type), 0);
-}
-
-/* Return a type the same as TYPE except unsigned or signed according to
- UNSIGNEDP. */
-static tree
-signed_or_unsigned_type (int unsignedp, tree type)
-{
- if (!INTEGRAL_TYPE_P (type)
- || TYPE_UNSIGNED (type) == unsignedp)
- return type;
- else
- return type_for_size (TYPE_PRECISION (type), unsignedp);
-}
-
#undef LANG_HOOKS_NAME
#define LANG_HOOKS_NAME "vhdl"
#undef LANG_HOOKS_IDENTIFIER_SIZE
@@ -752,23 +711,24 @@ const char * const tree_code_name[] = {
union lang_tree_node
GTY((desc ("0"),
- chain_next ("(union lang_tree_node *)TREE_CHAIN (&%h.generic)")))
+ chain_next ("(union lang_tree_node *) GENERIC_NEXT (&%h.generic)")))
{
- union tree_node GTY ((tag ("0"),
- desc ("tree_node_structure (&%h)")))
- generic;
+ union tree_node GTY ((tag ("0"))) generic;
};
struct lang_decl GTY(())
{
+ char dummy;
};
struct lang_type GTY (())
{
+ char dummy;
};
struct language_function GTY (())
{
+ char dummy;
};
struct chain_constr_type
@@ -1004,8 +964,7 @@ new_alloca (tree rtype, tree size)
cur_binding_level->save_stack = 1;
args = tree_cons (NULL_TREE, fold_convert (size_type_node, size), NULL_TREE);
- res = build3 (CALL_EXPR, ptr_type_node, stack_alloc_function_ptr,
- args, NULL_TREE);
+ res = build_call_list (ptr_type_node, stack_alloc_function_ptr, args);
return fold_convert (rtype, res);
}
@@ -1074,9 +1033,9 @@ new_float_literal (tree ltype, double value)
else
hi = s >> (8 * sizeof (HOST_WIDE_INT));
- res = build_int_cst_wide (ltype, lo, hi);
+ res = build_int_cst_wide (long_integer_type_node, lo, hi);
REAL_VALUE_FROM_INT (r_sign, lo, hi, DFmode);
- real_2expN (&r_exp, ex - 60);
+ real_2expN (&r_exp, ex - 60, DFmode);
real_arithmetic (&r, MULT_EXPR, &r_sign, &r_exp);
res = build_real (ltype, r);
return res;
@@ -1496,14 +1455,14 @@ ortho_build_addr (tree lvalue, tree atype)
ortho_mark_addressable (base);
- offset = fold_build2 (MULT_EXPR, TREE_TYPE (idx), idx,
+ idx = fold_convert (sizetype, idx);
+ offset = fold_build2 (MULT_EXPR, sizetype, idx,
array_ref_element_size (lvalue));
base = array_to_pointer_conversion (base);
base_type = TREE_TYPE (base);
- res = build2 (PLUS_EXPR, base_type,
- base, convert (base_type, offset));
+ res = build2 (POINTER_PLUS_EXPR, base_type, base, offset);
}
else
{
@@ -1606,7 +1565,7 @@ new_value (tree lvalue)
void
new_debug_line_decl (int line)
{
- input_location.line = line;
+ input_location = linemap_line_start (line_table, line, 252);
}
void
@@ -1806,6 +1765,8 @@ finish_subprogram_decl (struct o_inter_list *interfaces, tree *res)
decl = build_decl (FUNCTION_DECL, interfaces->ident,
build_function_type (interfaces->rtype,
interfaces->param_list.first));
+ DECL_SOURCE_LOCATION (decl) = input_location;
+
is_global = current_function_decl == NULL_TREE
|| interfaces->storage == o_storage_external;
if (is_global)
@@ -1876,7 +1837,7 @@ finish_subprogram_body (void)
DECL_SAVED_TREE (func) = bind;
/* Initialize the RTL code for the function. */
- allocate_struct_function (func);
+ allocate_struct_function (func, false);
/* Store the end of the function. */
cfun->function_end_locus = input_location;
@@ -1898,14 +1859,14 @@ finish_subprogram_body (void)
cgraph_finalize_function (func, false);
current_function_decl = parent;
- cfun = NULL;
+ set_cfun (NULL);
}
void
new_debug_line_stmt (int line)
{
- input_location.line = line;
+ input_location = linemap_line_start (line_table, line, 252);
}
void
@@ -1948,10 +1909,9 @@ new_association (struct o_assoc_list *assocs, tree val)
tree
new_function_call (struct o_assoc_list *assocs)
{
- return build3 (CALL_EXPR,
- TREE_TYPE (TREE_TYPE (assocs->subprg)),
- build_function_ptr (assocs->subprg),
- assocs->list.first, NULL_TREE);
+ return build_call_list (TREE_TYPE (TREE_TYPE (assocs->subprg)),
+ build_function_ptr (assocs->subprg),
+ assocs->list.first);
}
void
@@ -1959,10 +1919,9 @@ new_procedure_call (struct o_assoc_list *assocs)
{
tree res;
- res = build3 (CALL_EXPR,
- TREE_TYPE (TREE_TYPE (assocs->subprg)),
- build_function_ptr (assocs->subprg),
- assocs->list.first, NULL_TREE);
+ res = build_call_list (TREE_TYPE (TREE_TYPE (assocs->subprg)),
+ build_function_ptr (assocs->subprg),
+ assocs->list.first);
TREE_SIDE_EFFECTS (res) = 1;
append_stmt (res);
}
@@ -1987,7 +1946,8 @@ new_func_return_stmt (tree value)
res = DECL_RESULT (current_function_decl);
assign = build2 (MODIFY_EXPR, TREE_TYPE (value), res, value);
TREE_SIDE_EFFECTS (assign) = 1;
- stmt = build1 (RETURN_EXPR, TREE_TYPE (value), assign);
+ stmt = build1 (RETURN_EXPR, void_type_node, assign);
+ TREE_SIDE_EFFECTS (stmt) = 1;
append_stmt (stmt);
}
diff --git a/ortho/gcc/ortho_ident.adb b/ortho/gcc/ortho_ident.adb
index c8acd58..1fac9ab 100644
--- a/ortho/gcc/ortho_ident.adb
+++ b/ortho/gcc/ortho_ident.adb
@@ -7,6 +7,7 @@ package body Ortho_Ident is
(Id : O_Ident; Str : Address; Size : Integer)
return Boolean;
pragma Import (C, Compare_Identifier_String);
+ pragma Warnings (Off, Compare_Identifier_String);
function Get_Identifier (Str : String) return O_Ident is
begin