File: constraints.md

package info (click to toggle)
gcc-arm-none-eabi 15%3A8-2019-q3-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 571,828 kB
  • sloc: ansic: 2,937,651; cpp: 881,644; ada: 597,189; makefile: 65,528; asm: 56,499; xml: 46,621; exp: 24,747; sh: 19,684; python: 7,256; pascal: 4,370; awk: 3,497; perl: 2,695; yacc: 316; ml: 285; f90: 234; lex: 198; objc: 194; haskell: 119
file content (95 lines) | stat: -rw-r--r-- 3,143 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
;;  Machine Description for TI MSP43* processors
;;  Copyright (C) 2013-2018 Free Software Foundation, Inc.
;;  Contributed by Red Hat.

;; This file is part of GCC.

;; GCC is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.

;; GCC is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GCC; see the file COPYING3.  If not see
;; <http://www.gnu.org/licenses/>.

(define_register_constraint "R12" "R12_REGS"
  "Register R12.")

(define_register_constraint "R13" "R13_REGS"
  "Register R13.")

(define_constraint "K"
  "Integer constant 1."
  (and (match_code "const_int")
       (match_test "IN_RANGE (ival, 1, 1)")))

(define_constraint "L"
  "Integer constant -1^20..1^19."
  (and (match_code "const_int")
       (match_test "IN_RANGE (ival, HOST_WIDE_INT_M1U << 20, 1 << 19)")))

(define_constraint "M"
  "Integer constant 1-4."
  (and (match_code "const_int")
       (match_test "IN_RANGE (ival, 1, 4)")))

(define_constraint "N"
  "Integer constant 0-255."
  (and (match_code "const_int")
       (match_test "IN_RANGE (ival, 0, 255)")))

(define_constraint "O"
  "Integer constant 256-65535."
  (and (match_code "const_int")
       (match_test "IN_RANGE (ival, 256, 65535)")))

;; We do not allow arbitrary constants, eg symbols or labels,
;; because their address may be above the 16-bit address limit
;; supported by the offset used in the MOVA instruction.
(define_constraint "Ya"
  "Memory reference, any type, but restricted range of constants"
  (and (match_code "mem")
       (ior (match_code "reg" "0")
	    (and (match_code "plus" "0")
		 (match_code "reg" "00")
		 (match_test ("CONST_INT_P (XEXP (XEXP (op, 0), 1))")))
	    (match_test "CONSTANT_P (XEXP (op, 0))")
	    )))

(define_constraint "Yl"
  "Memory reference, labels only."
  (and (match_code "mem")
       (match_code "label_ref" "0")))


;; These are memory references that are safe to use without the X suffix,
;; because we know/assume they need not index across the 64k boundary.
(define_constraint "Ys"
  "Memory reference, stack only."
  (and (match_code "mem")
       (ior
	(and (match_code "plus" "0")
	     (and (match_code "reg" "00")
		  (match_test ("CONST_INT_P (XEXP (XEXP (op, 0), 1))"))
		  (match_test ("IN_RANGE (INTVAL (XEXP (XEXP (op, 0), 1)), HOST_WIDE_INT_M1U << 15, (1 << 15)-1)"))))
	(match_code "reg" "0")
	)))

(define_constraint "Yc"
  "Memory reference, for CALL - we can't use SP."
  (and (match_code "mem")
       (match_code "mem" "0")
       (not (ior
	     (and (match_code "plus" "00")
		  (and (match_code "reg" "000")
		       (match_test ("REGNO (XEXP (XEXP (op, 0), 0)) != SP_REGNO"))))
	     (and (match_code "reg" "0")
		  (match_test ("REGNO (XEXP (XEXP (op, 0), 0)) != SP_REGNO")))
	     ))))