@@ -13809,6 +13809,10 @@ output_pic_addr_const (FILE *file, rtx x, int code)
machopic_output_function_base_name (file);
break;
#endif
+ case UNSPEC_SIZEOF:
+ fputs ("@SIZE", file);
+ break;
+
default:
output_operand_lossage ("invalid UNSPEC as operand");
break;
@@ -15387,6 +15391,11 @@ i386_asm_output_addr_const_extra (FILE *file, rtx x)
}
break;
+ case UNSPEC_SIZEOF:
+ output_addr_const (file, op);
+ fputs ("@SIZE", file);
+ break;
+
default:
return false;
}
@@ -79,6 +79,7 @@
UNSPEC_PLTOFF
UNSPEC_MACHOPIC_OFFSET
UNSPEC_PCREL
+ UNSPEC_SIZEOF
;; Prologue support
UNSPEC_STACK_ALLOC
@@ -18446,6 +18447,14 @@
"bndstx\t{%2, %3|%3, %2}"
[(set_attr "type" "mpxst")])
+(define_insn "move_size_reloc_<mode>"
+ [(set (match_operand:SWI48 0 "register_operand" "=r")
+ (match_operand:<MODE> 1 "size_relocation" "Z"))]
+ ""
+{
+ return "mov{<imodesuffix>}\t{%1, %0|%0, %1}";
+})
+
(include "mmx.md")
(include "sse.md")
(include "sync.md")
@@ -119,6 +119,15 @@
(match_test "TARGET_64BIT")
(match_test "REGNO (op) > BX_REG")))
+;; Return true if VALUE is size relocation
+(define_predicate "size_relocation"
+ (match_code "const")
+{
+ return (GET_CODE (op) == CONST
+ && GET_CODE (XEXP (op, 0)) == UNSPEC
+ && XINT (XEXP (op, 0), 1) == UNSPEC_SIZEOF);
+})
+
;; Return true if VALUE can be stored in a sign extended immediate field.
(define_predicate "x86_64_immediate_operand"
(match_code "const_int,symbol_ref,label_ref,const")
@@ -323,6 +332,13 @@
return false;
}
}
+ else if (GET_CODE (XEXP (op, 0)) == UNSPEC)
+ {
+ if (XINT (XEXP (op, 0), 1) == UNSPEC_SIZEOF
+ && XVECLEN (XEXP (op, 0), 0) == 1
+ && GET_CODE (XVECEXP (XEXP (op, 0), 0, 0)) == SYMBOL_REF)
+ return true;
+ }
break;
default: