aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2014-11-02 13:54:34 +0100
committerTristan Gingold <tgingold@free.fr>2014-11-02 13:54:34 +0100
commit88fff744247c4c1f8e886207c7997390b063af27 (patch)
treec30a36767ebcaff52b5923cec71d1bf736b40319
parent77dadd243e9ec21f9f60473291f2cf8d1fdcf289 (diff)
downloadghdl-88fff744247c4c1f8e886207c7997390b063af27.tar.gz
ghdl-88fff744247c4c1f8e886207c7997390b063af27.tar.bz2
ghdl-88fff744247c4c1f8e886207c7997390b063af27.zip
ortho-lang.c: get rid of expr.h (poisonned) and rewrite ortho_build_addr.
-rw-r--r--ortho/gcc/ortho-lang.c75
-rw-r--r--translate/ghdldrv/Makefile12
2 files changed, 14 insertions, 73 deletions
diff --git a/ortho/gcc/ortho-lang.c b/ortho/gcc/ortho-lang.c
index e1c25e2ea..d2eb24342 100644
--- a/ortho/gcc/ortho-lang.c
+++ b/ortho/gcc/ortho-lang.c
@@ -49,8 +49,6 @@
#include "print-tree.h"
#include "stringpool.h"
#include "stor-layout.h"
-//#include "tree-dfa.h"
-#include "expr.h"
#include "varasm.h"
/* Returns the number of FIELD_DECLs in TYPE.
@@ -1494,9 +1492,6 @@ new_alignof (tree atype, tree rtype)
return build_int_cstu (rtype, TYPE_ALIGN_UNIT (atype));
}
-/* Convert the array expression EXP to a pointer. */
-static tree array_to_pointer_conversion (tree exp);
-
static tree
ortho_build_addr (tree lvalue, tree atype)
{
@@ -1509,40 +1504,16 @@ ortho_build_addr (tree lvalue, tree atype)
}
else
{
- /* &base[off] -> base+off. */
- if (TREE_CODE (lvalue) == ARRAY_REF
- || TREE_CODE (lvalue) == ARRAY_RANGE_REF)
- {
- tree base = TREE_OPERAND (lvalue, 0);
- tree idx = TREE_OPERAND (lvalue, 1);
- tree offset;
- tree base_type;
+ tree ptr_type;
- ortho_mark_addressable (base);
-
- 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);
+ /* &base[off] -> base+off. */
+ ortho_mark_addressable (lvalue);
- res = build2 (POINTER_PLUS_EXPR, base_type, base, offset);
- }
+ if (TREE_TYPE (lvalue) != TREE_TYPE (atype))
+ ptr_type = build_pointer_type (TREE_TYPE (lvalue));
else
- {
- ortho_mark_addressable (lvalue);
-
- if (TREE_TYPE (lvalue) != TREE_TYPE (atype))
- {
- tree ptr;
- ptr = build_pointer_type (TREE_TYPE (lvalue));
- res = build1 (ADDR_EXPR, ptr, lvalue);
- }
- else
- res = build1 (ADDR_EXPR, atype, lvalue);
- }
- res = fold (res);
+ ptr_type = atype;
+ res = fold_build1 (ADDR_EXPR, ptr_type, lvalue);
}
if (TREE_TYPE (res) != atype)
@@ -1551,38 +1522,6 @@ ortho_build_addr (tree lvalue, tree atype)
return res;
}
-/* Convert the array expression EXP to a pointer. */
-static tree
-array_to_pointer_conversion (tree exp)
-{
- tree type = TREE_TYPE (exp);
- tree adr;
- tree restype = TREE_TYPE (type);
- tree ptrtype;
-
- gcc_assert (TREE_CODE (type) == ARRAY_TYPE);
-
- /* Create a pointer to elements. */
- ptrtype = build_pointer_type (restype);
-
- switch (TREE_CODE (exp))
- {
- case INDIRECT_REF:
- return convert (ptrtype, TREE_OPERAND (exp, 0));
-
- case VAR_DECL:
- /* Convert array to pointer to elements. */
- adr = build1 (ADDR_EXPR, ptrtype, exp);
- ortho_mark_addressable (exp);
- TREE_SIDE_EFFECTS (adr) = 0; /* Default would be, same as EXP. */
- return adr;
-
- default:
- /* Get address. */
- return ortho_build_addr (exp, ptrtype);
- }
-}
-
tree
new_unchecked_address (tree lvalue, tree atype)
{
diff --git a/translate/ghdldrv/Makefile b/translate/ghdldrv/Makefile
index 888014bf7..ed94f02b4 100644
--- a/translate/ghdldrv/Makefile
+++ b/translate/ghdldrv/Makefile
@@ -163,19 +163,21 @@ install.standard: $(LIB93_DIR)/std/std_standard.o \
grt.links:
cd ../lib; ln -sf $(GRTSRCDIR)/grt.lst .; ln -sf $(GRTSRCDIR)/libgrt.a .; ln -sf $(GRTSRCDIR)/grt.ver .
-install.all: install.v87 install.v93 install.standard
+install.all: install.v87 install.v93 install.v08
install.gcc:
- $(MAKE) GHDL=ghdl_gcc install.v87 install.v93 install.v08
+ $(MAKE) GHDL1=../ghdl1-gcc install.standard
+ $(MAKE) GHDL=ghdl_gcc install.all
install.mcode:
- $(MAKE) GHDL=ghdl_mcode install.v87 install.v93 install.v08
+ $(MAKE) GHDL=ghdl_mcode install.all
install.simul:
- $(MAKE) GHDL=ghdl_simul install.v87 install.v93 install.v08
+ $(MAKE) GHDL=ghdl_simul install.all
install.llvm:
- $(MAKE) GHDL=ghdl_llvm GHDL1=../ghdl1-llvm install.all
+ $(MAKE) GHDL1=../ghdl1-llvm install.standard
+ $(MAKE) GHDL=ghdl_llvm install.all
clean: force
$(RM) -f *.o *.ali ghdl_gcc ghdl_mcode ghdl_llvm ghdl_llvm_jit