aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Stump <mrs@apple.com>2006-04-28 00:44:49 +0000
committerMike Stump <mrs@apple.com>2006-04-28 00:44:49 +0000
commitf5d5da5b4f521eca461d5f86aee35f5779bf9ce7 (patch)
tree017324757bf442aad65895c458f67912f67e09a1
parentb0c35ab71368c6b58764e609cdb98418aafdbe01 (diff)
Radar 4529992
* c-common.c (pointer_int_sum): Only form ARRAY_REF for ARRAY_TYPEs. (iasm_maybe_force_mem): Ensure that we only use DECL_HARD_REGISTER on VAR_DECLs. * c-typeck.c (iasm_c_build_component_ref): Move [eax].16 code up, to avoid calling lookup_name on [eax]. testsuite: * g++.apple/asm-block-50.C: Expect warning for [ptr][4]. * gcc.apple/asm-block-50.c: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/apple/200605-release@113333 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog.apple-ppc9
-rw-r--r--gcc/c-common.c3
-rw-r--r--gcc/c-typeck.c13
-rw-r--r--gcc/testsuite/ChangeLog.apple-ppc6
-rw-r--r--gcc/testsuite/g++.apple/asm-block-50.C4
-rw-r--r--gcc/testsuite/gcc.apple/asm-block-50.c4
6 files changed, 28 insertions, 11 deletions
diff --git a/gcc/ChangeLog.apple-ppc b/gcc/ChangeLog.apple-ppc
index 7b170e1538a..e2821ca479c 100644
--- a/gcc/ChangeLog.apple-ppc
+++ b/gcc/ChangeLog.apple-ppc
@@ -1,3 +1,12 @@
+2006-04-27 Mike Stump <mrs@apple.com>
+
+ Radar 4529992
+ * c-common.c (pointer_int_sum): Only form ARRAY_REF for ARRAY_TYPEs.
+ (iasm_maybe_force_mem): Ensure that we only use DECL_HARD_REGISTER on
+ VAR_DECLs.
+ * c-typeck.c (iasm_c_build_component_ref): Move [eax].16 code up,
+ to avoid calling lookup_name on [eax].
+
2006-04-26 Hui-May Chang <hm.chang@apple.com>
Radar 4491613
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 4971c899a54..81c6976a29f 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -2451,6 +2451,7 @@ pointer_int_sum (enum tree_code resultcode, tree ptrop, tree intop)
&& flag_ms_asms
&& resultcode == PLUS_EXPR
&& TREE_CODE (array) == ADDR_EXPR
+ && TREE_CODE (TREE_TYPE (TREE_OPERAND (array, 0))) == ARRAY_TYPE
&& !(TREE_CODE (TREE_TYPE (TREE_TYPE (array))) == FUNCTION_TYPE
|| TREE_CODE (TREE_TYPE (TREE_TYPE (array))) == METHOD_TYPE))
{
@@ -7195,7 +7196,7 @@ iasm_maybe_force_mem (tree arg, char *buf, unsigned argnum, bool must_be_reg, ia
additional registers when not optimizing, so we punt with just
"m", as all memory instructions are currently marked as
clobbering memory anyway with iasm_memory_clobber. */
- if (! DECL_HARD_REGISTER (arg)
+ if (! (TREE_CODE (arg) == VAR_DECL && DECL_HARD_REGISTER (arg))
&& e->dat[e->num].constraint == 0)
iasm_force_constraint ("m", e);
#endif
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index 92f6dc5bcba..fee44282282 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -6870,6 +6870,13 @@ iasm_c_build_component_ref (tree typename, tree component)
else if (TREE_CODE (typename) == LABEL_DECL)
typename = DECL_NAME (typename);
+ /* We allow [eax].16 to refer to [eax + 16]. */
+ if (TREE_CODE (component) == INTEGER_CST
+ && TREE_CODE (typename) == BRACKET_EXPR)
+ {
+ return iasm_build_bracket (typename, component);
+ }
+
val = lookup_name (typename);
if (val)
{
@@ -6877,12 +6884,6 @@ iasm_c_build_component_ref (tree typename, tree component)
}
else
{
- /* We allow [eax].16 to refer to [eax + 16]. */
- if (TREE_CODE (component) == INTEGER_CST
- && TREE_CODE (typename) == BRACKET_EXPR)
- {
- return iasm_build_bracket (typename, component);
- }
/* A structure tag will have been assumed to be a label; pick
out the original name. */
if (strncmp ("LASM", IDENTIFIER_POINTER (typename), 4) == 0)
diff --git a/gcc/testsuite/ChangeLog.apple-ppc b/gcc/testsuite/ChangeLog.apple-ppc
index 8e1eed0a040..cd7c471da35 100644
--- a/gcc/testsuite/ChangeLog.apple-ppc
+++ b/gcc/testsuite/ChangeLog.apple-ppc
@@ -1,3 +1,9 @@
+2006-04-27 Mike Stump <mrs@apple.com>
+
+ Radar 4529992
+ * g++.apple/asm-block-50.C: Expect warning for [ptr][4].
+ * gcc.apple/asm-block-50.c: Likewise.
+
2006-04-26 Hui-May Chang <hm.chang@apple.com>
Radar 4314956
diff --git a/gcc/testsuite/g++.apple/asm-block-50.C b/gcc/testsuite/g++.apple/asm-block-50.C
index 7a4e06caa8e..bb5f064d8b0 100644
--- a/gcc/testsuite/g++.apple/asm-block-50.C
+++ b/gcc/testsuite/g++.apple/asm-block-50.C
@@ -10,8 +10,6 @@ void foo(int pa[5], int j) {
int i;
int a[5];
_asm {
- mov esi, [ptr][4]
- mov esi, [ptr+4]
mov esi, [ptr][0]
mov esi, [ptr]
mov esi, [esi][eax]
@@ -27,6 +25,8 @@ void foo(int pa[5], int j) {
mov esi, [c][4] /* { dg-warning "non-pic addressing form not suitible for pic code" } */
mov esi, [b] /* { dg-warning "non-pic addressing form not suitible for pic code" } */
mov esi, [c] /* { dg-warning "non-pic addressing form not suitible for pic code" } */
+ mov esi, [ptr][4] /* { dg-warning "will consume extra register" } */
+ mov esi, [ptr+4] /* { dg-warning "will consume extra register" } */
mov esi, [ptr][eax] /* { dg-warning "will consume extra register" } */
mov esi, [ptr+eax] /* { dg-warning "will consume extra register" } */
mov esi, [-4][pa+esi] /* { dg-warning "will consume extra register" } */
diff --git a/gcc/testsuite/gcc.apple/asm-block-50.c b/gcc/testsuite/gcc.apple/asm-block-50.c
index 7a4e06caa8e..bb5f064d8b0 100644
--- a/gcc/testsuite/gcc.apple/asm-block-50.c
+++ b/gcc/testsuite/gcc.apple/asm-block-50.c
@@ -10,8 +10,6 @@ void foo(int pa[5], int j) {
int i;
int a[5];
_asm {
- mov esi, [ptr][4]
- mov esi, [ptr+4]
mov esi, [ptr][0]
mov esi, [ptr]
mov esi, [esi][eax]
@@ -27,6 +25,8 @@ void foo(int pa[5], int j) {
mov esi, [c][4] /* { dg-warning "non-pic addressing form not suitible for pic code" } */
mov esi, [b] /* { dg-warning "non-pic addressing form not suitible for pic code" } */
mov esi, [c] /* { dg-warning "non-pic addressing form not suitible for pic code" } */
+ mov esi, [ptr][4] /* { dg-warning "will consume extra register" } */
+ mov esi, [ptr+4] /* { dg-warning "will consume extra register" } */
mov esi, [ptr][eax] /* { dg-warning "will consume extra register" } */
mov esi, [ptr+eax] /* { dg-warning "will consume extra register" } */
mov esi, [-4][pa+esi] /* { dg-warning "will consume extra register" } */