summaryrefslogtreecommitdiff
path: root/gcc/cfgexpand.c
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2009-10-27 06:38:52 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2009-10-27 06:38:52 +0000
commit2db0b3527cdd32dc1bb494d18508dc4320a19f69 (patch)
treec7c3eab8c786f9630cce495ae3913a2d458e808d /gcc/cfgexpand.c
parentd0986467397b442d06f2d63557bbc3548919d783 (diff)
downloadgcc-2db0b3527cdd32dc1bb494d18508dc4320a19f69.tar.gz
2009-10-27 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 153581 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@153582 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cfgexpand.c')
-rw-r--r--gcc/cfgexpand.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index be46028fa58..fdc4de586ef 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -2235,6 +2235,9 @@ expand_debug_expr (tree exp)
rtx op0 = NULL_RTX, op1 = NULL_RTX, op2 = NULL_RTX;
enum machine_mode mode = TYPE_MODE (TREE_TYPE (exp));
int unsignedp = TYPE_UNSIGNED (TREE_TYPE (exp));
+ addr_space_t as;
+ enum machine_mode address_mode;
+ enum machine_mode pointer_mode;
switch (TREE_CODE_CLASS (TREE_CODE (exp)))
{
@@ -2428,20 +2431,29 @@ expand_debug_expr (tree exp)
if (!op0)
return NULL;
- gcc_assert (GET_MODE (op0) == Pmode
- || GET_MODE (op0) == ptr_mode
+ if (POINTER_TYPE_P (TREE_TYPE (exp)))
+ as = TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (exp)));
+ else
+ as = ADDR_SPACE_GENERIC;
+
+ address_mode = targetm.addr_space.address_mode (as);
+ pointer_mode = targetm.addr_space.pointer_mode (as);
+
+ gcc_assert (GET_MODE (op0) == address_mode
+ || GET_MODE (op0) == pointer_mode
|| GET_CODE (op0) == CONST_INT
|| GET_CODE (op0) == CONST_DOUBLE);
if (TREE_CODE (exp) == ALIGN_INDIRECT_REF)
{
int align = TYPE_ALIGN_UNIT (TREE_TYPE (exp));
- op0 = gen_rtx_AND (Pmode, op0, GEN_INT (-align));
+ op0 = gen_rtx_AND (address_mode, op0, GEN_INT (-align));
}
op0 = gen_rtx_MEM (mode, op0);
set_mem_attributes (op0, exp, 0);
+ set_mem_addr_space (op0, as);
return op0;
@@ -2455,14 +2467,19 @@ expand_debug_expr (tree exp)
if (!op0)
return NULL;
- gcc_assert (GET_MODE (op0) == Pmode
- || GET_MODE (op0) == ptr_mode
+ as = TYPE_ADDR_SPACE (TREE_TYPE (exp));
+ address_mode = targetm.addr_space.address_mode (as);
+ pointer_mode = targetm.addr_space.pointer_mode (as);
+
+ gcc_assert (GET_MODE (op0) == address_mode
+ || GET_MODE (op0) == pointer_mode
|| GET_CODE (op0) == CONST_INT
|| GET_CODE (op0) == CONST_DOUBLE);
op0 = gen_rtx_MEM (mode, op0);
set_mem_attributes (op0, exp, 0);
+ set_mem_addr_space (op0, as);
return op0;