1 |
6 |
jlechner |
; Macro instruction definitions.
|
2 |
|
|
; Copyright (C) 2000, 2009 Red Hat, Inc.
|
3 |
|
|
; This file is part of CGEN.
|
4 |
|
|
; See file COPYING.CGEN for details.
|
5 |
|
|
|
6 |
|
|
; If the macro expands to a string, arguments in the input string
|
7 |
|
|
; are refered to with %N. Multiple insns are separated with '\n'.
|
8 |
|
|
; String expansion is a special case of the normal form which is a Scheme
|
9 |
|
|
; expression that controls the expansion. The Scheme expression will be able
|
10 |
|
|
; to refer to the current assembly state to decide how to perform the
|
11 |
|
|
; expansion. Special expression `emit' is used to call the assembler emitter
|
12 |
|
|
; for a particular insn. Special expression `expand' is used to return a
|
13 |
|
|
; string to be reparsed (which is special cased).
|
14 |
|
|
; Parse a list of macro-instruction expansion descriptions.
|
15 |
|
|
|
16 |
|
|
; description in the .cpu file.
|
17 |
|
|
; All arguments are in raw (non-evaluated) form.
|
18 |
|
|
; ??? At present we only support macros that are aliases of one real insn.
|
19 |
|
|
; Object to describe a macro-insn.
|
20 |
|
|
|
21 |
|
|
; list of expansion expressions
|
22 |
|
|
|
23 |
|
|
; Return a list of the machs that support MINSN.
|
24 |
|
|
|
25 |
|
|
; This is computed from the syntax string.
|
26 |
|
|
; Return enum cgen_minsn_types value for MINSN.
|
27 |
|
|
"@ARCH@_MINSN_"; Parse a macro-insn expansion description.
|
28 |
|
|
; ??? At present we only support unconditional simple expansion.
|
29 |
|
|
"invalid macro expansion""invalid macro expansion, must be `(emit ...)'"; Parse a macro-instruction description.
|
30 |
|
|
; This is the main routine for building a macro-insn object from a
|
31 |
|
|
; description in the .cpu file.
|
32 |
|
|
; All arguments are in raw (non-evaluated) form.
|
33 |
|
|
; The result is the parsed object or #f if object isn't for selected mach(s).
|
34 |
|
|
"Processing macro-insn "" ...\n""invalid macro expansion list";; Pick out name first to augment the error context.
|
35 |
|
|
"cgen_minsn""Ignoring "".\n"; Read a macro-insn description
|
36 |
|
|
|
37 |
|
|
; CONTEXT is a <context> object for error messages.
|
38 |
|
|
; ARG-LIST is an associative list of field name and field value.
|
39 |
|
|
|
40 |
|
|
""""; Loop over each element in ARG-LIST, recording what's found.
|
41 |
|
|
|
42 |
|
|
; Define a macro-insn object, name/value pair list version.
|
43 |
|
|
; don't waste time if simulator
|
44 |
|
|
|
45 |
|
|
; This only supports one expansion.
|
46 |
|
|
|
47 |
|
|
; yet :-).
|
48 |
|
|
; don't waste time if simulator
|
49 |
|
|
"define-full-minsn"; Compute the ifield list for an alias macro-insn.
|
50 |
|
|
|
51 |
|
|
; known quantities to operands that have fixed values in the macro-insn.
|
52 |
|
|
; List of "free variables", i.e. operands.
|
53 |
|
|
|
54 |
|
|
; parsed the associated element in ifld-names is deleted. At the
|
55 |
|
|
|
56 |
|
|
; element in a list, so we insert a fencepost.
|
57 |
|
|
|
58 |
|
|
; For each macro-insn ifield expression, look it up in the real insn's
|
59 |
|
|
; ifield list. If an operand without a prespecified value, leave
|
60 |
|
|
; unchanged. If an operand or ifield with a value, assign the value to
|
61 |
|
|
|
62 |
|
|
; If `op-name' is an operand, use its ifield.
|
63 |
|
|
; Otherwise `op-name' must be an ifield name.
|
64 |
|
|
|
65 |
|
|
"unknown operand"; Ensure `f' is an operand.
|
66 |
|
|
"not an operand""incomplete operand list, missing: "; Create an aliased real insn from an alias macro-insn.
|
67 |
|
|
; Must emit exactly one real insn.
|
68 |
|
|
"not an alias macro-insn""unknown real insn in expansion"": "; ifield-assertion
|
69 |
|
|
; semantics
|
70 |
|
|
; timing
|
71 |
|
|
; FIXME: use same format entry as real insn,
|
72 |
|
|
|
73 |
|
|
; (car (ifmt-analyze i #f))))
|
74 |
|
|
;(insn-set-ifmt! i (insn-ifmt alias-of))
|
75 |
|
|
; Called before a .cpu file is read in.
|
76 |
|
|
"\
|
77 |
|
|
Define a macro instruction, name/value pair list version.
|
78 |
|
|
|
79 |
|
|
Define a macro instruction, all arguments specified.
|
80 |
|
|
"; Called after the .cpu file has been read in.
|
81 |
|
|
|