* [PATCH, AArch64] Support --mcmodel=tiny.
@ 2013-05-29 13:08 Marcus Shawcroft
2013-05-29 13:10 ` Marcus Shawcroft
0 siblings, 1 reply; 2+ messages in thread
From: Marcus Shawcroft @ 2013-05-29 13:08 UTC (permalink / raw)
To: gcc-patches
Hi, This patch adds support for the tiny absolute memory model.
Regressed for aarch64-none-elf with each of
-mcmodel=tiny
-mcmodel=small
-mcmodel=small -fPIC
Applied.
/Marcus
2012-05-29 Chris Schlumberger-Socha <chris.schlumberger-socha@arm.com>
Marcus Shawcroft <marcus.shawcroft@arm.com>
* config/aarch64/aarch64-protos.h (aarch64_symbol_type): Define
SYMBOL_TINY_ABSOLUTE.
* config/aarch64/aarch64.c (aarch64_load_symref_appropriately):
Handle
SYMBOL_TINY_ABSOLUTE.
(aarch64_expand_mov_immediate): Likewise.
(aarch64_classify_symbol): Likewise.
(aarch64_mov_operand_p): Remove ATTRIBUTE_UNUSED.
Permit SYMBOL_TINY_ABSOLUTE.
* config/aarch64/predicates.md (aarch64_mov_operand): Permit CONST.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH, AArch64] Support --mcmodel=tiny.
2013-05-29 13:08 [PATCH, AArch64] Support --mcmodel=tiny Marcus Shawcroft
@ 2013-05-29 13:10 ` Marcus Shawcroft
0 siblings, 0 replies; 2+ messages in thread
From: Marcus Shawcroft @ 2013-05-29 13:10 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 979 bytes --]
On 29/05/13 14:08, Marcus Shawcroft wrote:
> Hi, This patch adds support for the tiny absolute memory model.
>
> Regressed for aarch64-none-elf with each of
> -mcmodel=tiny
> -mcmodel=small
> -mcmodel=small -fPIC
>
> Applied.
This time with patch attached, oops, sorry.
/Marcus
>
> /Marcus
>
> 2012-05-29 Chris Schlumberger-Socha <chris.schlumberger-socha@arm.com>
> Marcus Shawcroft <marcus.shawcroft@arm.com>
>
> * config/aarch64/aarch64-protos.h (aarch64_symbol_type): Define
> SYMBOL_TINY_ABSOLUTE.
> * config/aarch64/aarch64.c (aarch64_load_symref_appropriately):
> Handle
> SYMBOL_TINY_ABSOLUTE.
> (aarch64_expand_mov_immediate): Likewise.
> (aarch64_classify_symbol): Likewise.
> (aarch64_mov_operand_p): Remove ATTRIBUTE_UNUSED.
> Permit SYMBOL_TINY_ABSOLUTE.
> * config/aarch64/predicates.md (aarch64_mov_operand): Permit
> CONST.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: gcc-tiny-absolute.diff --]
[-- Type: text/x-patch; name=gcc-tiny-absolute.diff, Size: 2957 bytes --]
diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h
index 91fcde8..bdb6b04 100644
--- a/gcc/config/aarch64/aarch64-protos.h
+++ b/gcc/config/aarch64/aarch64-protos.h
@@ -81,6 +81,7 @@ enum aarch64_symbol_type
SYMBOL_SMALL_TLSDESC,
SYMBOL_SMALL_GOTTPREL,
SYMBOL_SMALL_TPREL,
+ SYMBOL_TINY_ABSOLUTE,
SYMBOL_FORCE_TO_MEM
};
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index cbe7847..074eb1c 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -524,6 +524,10 @@ aarch64_load_symref_appropriately (rtx dest, rtx imm,
return;
}
+ case SYMBOL_TINY_ABSOLUTE:
+ emit_insn (gen_rtx_SET (Pmode, dest, imm));
+ return;
+
case SYMBOL_SMALL_GOT:
{
rtx tmp_reg = dest;
@@ -826,6 +830,7 @@ aarch64_expand_mov_immediate (rtx dest, rtx imm)
case SYMBOL_SMALL_TPREL:
case SYMBOL_SMALL_ABSOLUTE:
+ case SYMBOL_TINY_ABSOLUTE:
aarch64_load_symref_appropriately (dest, imm, sty);
return;
@@ -5030,6 +5035,8 @@ aarch64_classify_symbol (rtx x,
case AARCH64_CMODEL_TINY_PIC:
case AARCH64_CMODEL_TINY:
+ return SYMBOL_TINY_ABSOLUTE;
+
case AARCH64_CMODEL_SMALL_PIC:
case AARCH64_CMODEL_SMALL:
return SYMBOL_SMALL_ABSOLUTE;
@@ -5051,6 +5058,10 @@ aarch64_classify_symbol (rtx x,
switch (aarch64_cmodel)
{
case AARCH64_CMODEL_TINY:
+ if (SYMBOL_REF_WEAK (x))
+ return SYMBOL_FORCE_TO_MEM;
+ return SYMBOL_TINY_ABSOLUTE;
+
case AARCH64_CMODEL_SMALL:
if (SYMBOL_REF_WEAK (x))
return SYMBOL_FORCE_TO_MEM;
@@ -6444,10 +6455,9 @@ aarch64_simd_imm_scalar_p (rtx x, enum machine_mode mode ATTRIBUTE_UNUSED)
bool
aarch64_mov_operand_p (rtx x,
- enum aarch64_symbol_context context ATTRIBUTE_UNUSED,
+ enum aarch64_symbol_context context,
enum machine_mode mode)
{
-
if (GET_CODE (x) == HIGH
&& aarch64_valid_symref (XEXP (x, 0), GET_MODE (XEXP (x, 0))))
return true;
@@ -6458,7 +6468,8 @@ aarch64_mov_operand_p (rtx x,
if (GET_CODE (x) == SYMBOL_REF && mode == DImode && CONSTANT_ADDRESS_P (x))
return true;
- return false;
+ return aarch64_classify_symbolic_expression (x, context)
+ == SYMBOL_TINY_ABSOLUTE;
}
/* Return a const_int vector of VAL. */
diff --git a/gcc/config/aarch64/predicates.md b/gcc/config/aarch64/predicates.md
index 16c4385..3248f61 100644
--- a/gcc/config/aarch64/predicates.md
+++ b/gcc/config/aarch64/predicates.md
@@ -166,7 +166,7 @@
})
(define_predicate "aarch64_mov_operand"
- (and (match_code "reg,subreg,mem,const_int,symbol_ref,high")
+ (and (match_code "reg,subreg,mem,const,const_int,symbol_ref,label_ref,high")
(ior (match_operand 0 "register_operand")
(ior (match_operand 0 "memory_operand")
(match_test "aarch64_mov_operand_p (op, SYMBOL_CONTEXT_ADR, mode)")))))
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-05-29 13:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-29 13:08 [PATCH, AArch64] Support --mcmodel=tiny Marcus Shawcroft
2013-05-29 13:10 ` Marcus Shawcroft
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).