OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-binutils/] [binutils-2.19.1/] [cgen/] [semantics.scm] - Blame information for rev 6

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 6 jlechner
; Routines for instruction semantic analysis.
2
; Copyright (C) 2000, 2009 Red Hat, Inc.
3
; This file is part of CGEN.
4
; See file COPYING.CGEN for details.
5
;
6
; Semantic expression compilation.
7
; This is more involved than normal rtx compilation as we need to keep
8
; track of the inputs and outputs.  Various attributes that can be derived
9
; from the code are also computed.
10
 
11
; Two modes are equivalent if they're equal, or if their sem-mode fields
12
; are equal.
13
; Subroutine of semantic-compile to find OP in OP-LIST.
14
 
15
; The result is the list element or #f if not found.
16
; TYPE is one of -op- reg mem.
17
; EXPR is the constructed `xop' rtx expression for the operand,
18
;   ignored in the search.
19
; MODE must match, as defined by -rtx-mode-equiv?.
20
; NAME is the hardware element name, ifield name, or '-op-'.
21
; INDX-SEL must match if present in either.
22
;
23
 
24
; The first cdr is to drop the dummy first arg.
25
; Subroutine of semantic-compile to determine how the operand in
26
; position OP-POS of EXPR is used.
27
; The result is one of 'use, 'set, 'set-quiet.
28
; "use" means "input operand".
29
; operand 0 is the option list, operand 1 is the mode
30
; (if you want to complain, fine, it's not like it would be unexpected)
31
; Subroutine of semantic-compile:process-expr!, to simplify it.
32
; Looks up the operand in the current set, returns it if found,
33
; otherwise adds it.
34
; REF-TYPE is one of 'use, 'set, 'set-quiet.
35
 
36
;(display (list op-name mode ref-type)) (newline) (force-output)
37
; The first #f is a placeholder for the object.
38
; If already present, return the object, otherwise add it.
39
; We can't set the operand number yet 'cus we don't know it.
40
; However, when it's computed we'll need to set all associated
41
; operands.  This is done by creating shared rtx (a la gcc) - the
42
; operand number then need only be updated in one place.
43
; Set the object rtx in `try', now that we have it.
44
; Add the operand to in/out-ops.
45
; Subroutine of semantic-compile:process-expr!, to simplify it.
46
; If the mode is DFLT, use the object's natural mode.
47
; #f is a place-holder for the object (filled in later)
48
; If already present, return the object, otherwise add it.
49
; Set the object rtx in `try', now that we have it.
50
; Add the operand to in/out-ops.
51
"unknown reg"; Subroutine of semantic-compile:process-expr!, to simplify it.
52
"memory must have explicit mode"; If already present, return the object, otherwise add it.
53
 
54
; Add the operand to in/out-ops.
55
; Subroutine of semantic-compile:process-expr!, to simplify it.
56
"unknown ifield"; If already present, return the object, otherwise add it.
57
; Subroutine of semantic-compile:process-expr!, to simplify it.
58
 
59
; ??? There are various optimizations (both space usage in ARGBUF and time
60
; spent in semantic code) that can be done on code that uses index-of
61
; (see i960's movq insn).  Later.
62
"only `(index-of operand)' is currently supported""only ifield indices are currently supported"; The rest of this is identical to -build-ifield-operand!.
63
; If already present, return the object, otherwise add it.
64
; (send (op:type op) 'get-index-mode)
65
; Build the tstate known value list for INSN.
66
; This is built from the ifield-assertion list.
67
; Structure to record the result of semantic-compile.
68
; Accessors.
69
 
70
; and computing the input and output operands.
71
; The result is an object of four elements (built with csem-make).
72
; The first is a list of the canonical form of each element in SEM-CODE:
73
; operand and ifield elements specified without `operand' or `ifield' have it
74
; prepended, and operand numbers are computed for each operand.
75
 
76
; Having the operand numbers available is also useful for efficient
77
; modeling: recording operand references can be done with a bitmask (one host
78
; insn), and the code to do the modeling can be kept out of the code that
79
; performs the insn.
80
; The second is the list of input <operand> objects.
81
; The third is the list of output <operand> objects.
82
; The fourth is an <attr-list> object of attributes that can be computed from
83
; the semantics.
84
 
85
; ??? Combine *-CTI into an enum attribute.
86
;
87
; CONTEXT is a <context> object or #f if there is none.
88
; INSN is the <insn> object.
89
 
90
; ??? Specifying operand ordinals in the source would simplify this and speed
91
; it up.  On the other hand that makes the source form more complex.  Maybe the
92
 
93
; complication", we don't do this yet.
94
 
95
; input/output operands to the instruction description.
96
;
97
; ??? This calls rtx-simplify which calls rtx-traverse as it's simpler to
98
; simplify EXPR first, and then compile it.  On the other hand it's slower
99
 
100
; These record the result of traversing SEM-CODE.
101
; They're lists of (type object mode name [args ...]).
102
; TYPE is one of: -op- reg mem.
103
; `-op-' is just something unique and is only used internally.
104
; OBJECT is the constructed <operand> object.
105
; The first element is just a dummy so that append! always works.
106
; List of attributes computed from SEM-CODE.
107
; The first element is just a dummy so that append! always works.
108
 
109
; Don't waste cpu here, this is part of the slowest piece in CGEN.
110
 
111
; ??? could verify reg is a scalar
112
; The register number is either a number or an
113
; expression.
114
 
115
; significant ramifications.  On the other hand in cases
116
; where it matters the expression could always be
117
; required to reduce to a constant (or some such).
118
"invalid register number"; Memory.
119
; Operands.
120
; Give operand new name.
121
"name: invalid argument:"; (op:set-num! result (caddr expr))
122
; Specify a reference to a local variable
123
; nothing to do
124
 
125
"can't set an `ifield'"; Hardware indices.
126
; For registers this is the register number.
127
 
128
; For constants, this is the constant.
129
 
130
; Machine generate the DELAY-SLOT attribute.
131
; If this is a syntax expression, the operands won't have been
132
; processed, so tell our caller we want it to by returning #f.
133
; We do the same for non-syntax expressions to keep things
134
; simple.  This requires collaboration with the traversal
135
; handlers which are defined to do what we want if we return #f.
136
; Whew.  We're now ready to traverse the expression.
137
; Traverse the expression recording the operands and building objects
138
; for most elements in the source representation.
139
 
140
; In particular machine dependent code for non-selected machines
141
; is discarded.
142
 
143
;(display "out: ") (display out-ops) (newline)
144
 
145
; Now that we have the nub of all input and output operands,
146
; we can assign operand numbers.  Inputs and outputs are not defined
147
; separately, output operand numbers follow inputs.  This simplifies the
148
 
149
; The assignment is defined to be arbitrary.  If there comes a day
150
; when we need to prespecify operand numbers, revisit.
151
; The operand lists are sorted to avoid spurious differences in generated
152
 
153
; ARGBUF struct).
154
; Drop dummy first arg and sort operand lists.
155
 
156
; The result is an <attr-list> object of attributes that can be computed from
157
; the semantics.
158
 
159
; This computes the same values as semantic-compile, but for speed is
160
 
161
; ??? Combine *-CTI into an enum attribute.
162
;
163
; CONTEXT is a <context> object or #f if there is none.
164
; INSN is the <insn> object.
165
; List of attributes computed from SEM-CODE.
166
; The first element is just a dummy so that append! always works.
167
; Called for expressions encountered in SEM-CODE.
168
; Don't change these to '(FOO), since
169
; we use append!.
170
 
171
; processed, so tell our caller we want it to by returning #f.
172
 
173
; simple.  This requires collaboration with the traversal
174
; handlers which are defined to do what we want if we return #f.
175
; Traverse the expression recording the attributes.
176
 
177
""

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.