summaryrefslogtreecommitdiff
path: root/ortho/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'ortho/gcc')
-rw-r--r--ortho/gcc/ortho-lang.c75
1 files changed, 7 insertions, 68 deletions
diff --git a/ortho/gcc/ortho-lang.c b/ortho/gcc/ortho-lang.c
index e1c25e2..d2eb243 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)
{