2003-06-03 23:41:12 +08:00
|
|
|
|
; Collection of macros, for GNU Binutils .cpu files. -*- Scheme -*-
|
|
|
|
|
;
|
2009-07-17 01:53:25 +08:00
|
|
|
|
; Copyright 2000, 2007, 2009 Free Software Foundation, Inc.
|
2003-06-03 23:41:12 +08:00
|
|
|
|
;
|
|
|
|
|
; Contributed by Red Hat Inc.
|
|
|
|
|
;
|
|
|
|
|
; This file is part of the GNU Binutils.
|
|
|
|
|
;
|
|
|
|
|
; This program is free software; you can redistribute it and/or modify
|
|
|
|
|
; it under the terms of the GNU General Public License as published by
|
2007-07-05 17:49:03 +08:00
|
|
|
|
; the Free Software Foundation; either version 3 of the License, or
|
2003-06-03 23:41:12 +08:00
|
|
|
|
; (at your option) any later version.
|
|
|
|
|
;
|
|
|
|
|
; This program 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 this program; if not, write to the Free Software
|
2007-07-05 17:49:03 +08:00
|
|
|
|
; Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
|
|
|
|
; MA 02110-1301, USA.
|
2003-06-03 23:41:12 +08:00
|
|
|
|
|
|
|
|
|
; Enums.
|
|
|
|
|
|
|
|
|
|
; Define a normal enum without using name/value pairs.
|
|
|
|
|
; This is currently the same as define-full-enum but it needn't remain
|
|
|
|
|
; that way (it's define-full-enum that would change).
|
|
|
|
|
|
|
|
|
|
(define-pmacro (define-normal-enum name comment attrs prefix vals)
|
2009-07-17 01:53:25 +08:00
|
|
|
|
"Define a normal enum, fixed number of arguments."
|
2003-06-03 23:41:12 +08:00
|
|
|
|
(define-full-enum name comment attrs prefix vals)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
; Define a normal insn enum.
|
|
|
|
|
|
|
|
|
|
(define-pmacro (define-normal-insn-enum name comment attrs prefix fld vals)
|
2009-07-17 01:53:25 +08:00
|
|
|
|
"Define a normal instruction opcode enum."
|
2003-06-03 23:41:12 +08:00
|
|
|
|
(define-full-insn-enum name comment attrs prefix fld vals)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
; Instruction fields.
|
|
|
|
|
|
2009-07-17 01:53:25 +08:00
|
|
|
|
; Normally, fields are unsigned and have no encode/decode needs.
|
2003-06-03 23:41:12 +08:00
|
|
|
|
|
|
|
|
|
(define-pmacro (define-normal-ifield name comment attrs start length)
|
2009-07-17 01:53:25 +08:00
|
|
|
|
"Define a normal instruction field."
|
2003-06-03 23:41:12 +08:00
|
|
|
|
(define-full-ifield name comment attrs start length UINT #f #f)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
; For those who don't like typing.
|
|
|
|
|
|
2009-07-17 01:53:25 +08:00
|
|
|
|
(define-pmacro (df name comment attrs start length mode encode decode)
|
|
|
|
|
"Shorthand form of normal fields requiring mode, encode/decode."
|
|
|
|
|
(define-full-ifield name comment attrs start length mode encode decode)
|
2003-06-03 23:41:12 +08:00
|
|
|
|
)
|
|
|
|
|
(define-pmacro dnf
|
2009-07-17 01:53:25 +08:00
|
|
|
|
"Shorthand form of define-normal-ifield."
|
2003-06-03 23:41:12 +08:00
|
|
|
|
define-normal-ifield
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
; Define a normal multi-ifield.
|
|
|
|
|
|
|
|
|
|
(define-pmacro (define-normal-multi-ifield name comment attrs
|
|
|
|
|
mode subflds insert extract)
|
2009-07-17 01:53:25 +08:00
|
|
|
|
"Define a normal multi-part instruction field."
|
2003-06-03 23:41:12 +08:00
|
|
|
|
(define-full-multi-ifield name comment attrs mode subflds insert extract)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
; For those who don't like typing.
|
|
|
|
|
|
|
|
|
|
(define-pmacro dnmf
|
2009-07-17 01:53:25 +08:00
|
|
|
|
"Shorthand form of define-normal-multi-ifield."
|
2003-06-03 23:41:12 +08:00
|
|
|
|
define-normal-multi-ifield
|
|
|
|
|
)
|
|
|
|
|
|
2009-07-17 01:53:25 +08:00
|
|
|
|
; Simple multi-ifields: mode is UINT, default insert/extract support,
|
|
|
|
|
; default encode/decode support.
|
2003-06-03 23:41:12 +08:00
|
|
|
|
|
|
|
|
|
(define-pmacro (dsmf name comment attrs subflds)
|
2009-07-17 01:53:25 +08:00
|
|
|
|
"Define a simple multi-part instruction field."
|
2003-06-03 23:41:12 +08:00
|
|
|
|
(define-full-multi-ifield name comment attrs UINT subflds #f #f)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
; Hardware.
|
|
|
|
|
|
|
|
|
|
; Simpler version for most hardware elements.
|
2009-07-17 01:53:25 +08:00
|
|
|
|
; Allow special assembler support specification but no semantic-name,
|
|
|
|
|
; getter/setter, or layout specs.
|
2003-06-03 23:41:12 +08:00
|
|
|
|
|
|
|
|
|
(define-pmacro (define-normal-hardware name comment attrs type
|
|
|
|
|
indices values handlers)
|
2009-07-17 01:53:25 +08:00
|
|
|
|
"Define a normal hardware element."
|
2003-06-03 23:41:12 +08:00
|
|
|
|
(define-full-hardware name comment attrs name type
|
|
|
|
|
indices values handlers () () ())
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
; For those who don't like typing.
|
|
|
|
|
|
|
|
|
|
(define-pmacro dnh
|
2009-07-17 01:53:25 +08:00
|
|
|
|
"Shorthand form of define-normal-hardware."
|
2003-06-03 23:41:12 +08:00
|
|
|
|
define-normal-hardware
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
; Simpler version of dnh that leaves out the indices, values, handlers,
|
2009-07-17 01:53:25 +08:00
|
|
|
|
; getter/setter, and layout specs.
|
2003-06-03 23:41:12 +08:00
|
|
|
|
; This is useful for 1 bit registers.
|
|
|
|
|
; ??? While dsh and dnh aren't that distinguishable when perusing a .cpu file,
|
|
|
|
|
; they both take a fixed number of positional arguments, and dsh is a proper
|
|
|
|
|
; subset of dnh with all arguments in the same positions, so methinks things
|
|
|
|
|
; are ok.
|
|
|
|
|
|
|
|
|
|
(define-pmacro (define-simple-hardware name comment attrs type)
|
2009-07-17 01:53:25 +08:00
|
|
|
|
"Define a simple hardware element (usually a scalar register)."
|
2003-06-03 23:41:12 +08:00
|
|
|
|
(define-full-hardware name comment attrs name type () () () () () ())
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(define-pmacro dsh
|
2009-07-17 01:53:25 +08:00
|
|
|
|
"Shorthand form of define-simple-hardware."
|
2003-06-03 23:41:12 +08:00
|
|
|
|
define-simple-hardware
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
; Operands.
|
|
|
|
|
|
2009-07-17 01:53:25 +08:00
|
|
|
|
; Simpler version for most operands.
|
|
|
|
|
; Allow special assembler support specification but no handlers or
|
|
|
|
|
; getter/setter specs.
|
|
|
|
|
|
2003-06-03 23:41:12 +08:00
|
|
|
|
(define-pmacro (define-normal-operand name comment attrs type index)
|
2009-07-17 01:53:25 +08:00
|
|
|
|
"Define a normal operand."
|
2003-06-03 23:41:12 +08:00
|
|
|
|
(define-full-operand name comment attrs type DFLT index () () ())
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
; For those who don't like typing.
|
2009-07-17 01:53:25 +08:00
|
|
|
|
|
|
|
|
|
(define-pmacro dno
|
|
|
|
|
"Shorthand form of define-normal-operand."
|
|
|
|
|
define-normal-operand
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
; Deprecated, but still in wide use.
|
2003-06-03 23:41:12 +08:00
|
|
|
|
|
|
|
|
|
(define-pmacro dnop
|
2009-07-17 01:53:25 +08:00
|
|
|
|
"Shorthand form of define-normal-operand."
|
2003-06-03 23:41:12 +08:00
|
|
|
|
define-normal-operand
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(define-pmacro (dndo x-name x-mode x-args
|
|
|
|
|
x-syntax x-base-ifield x-encoding x-ifield-assertion
|
|
|
|
|
x-getter x-setter)
|
|
|
|
|
"Define a normal derived operand."
|
|
|
|
|
(define-derived-operand
|
|
|
|
|
(name x-name)
|
|
|
|
|
(mode x-mode)
|
|
|
|
|
(args x-args)
|
|
|
|
|
(syntax x-syntax)
|
|
|
|
|
(base-ifield x-base-ifield)
|
|
|
|
|
(encoding x-encoding)
|
|
|
|
|
(ifield-assertion x-ifield-assertion)
|
|
|
|
|
(getter x-getter)
|
|
|
|
|
(setter x-setter)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
; Instructions.
|
|
|
|
|
|
|
|
|
|
; Define an instruction object, normal version.
|
|
|
|
|
; At present all fields must be specified.
|
|
|
|
|
; Fields ifield-assertion is absent.
|
|
|
|
|
|
|
|
|
|
(define-pmacro (define-normal-insn name comment attrs syntax fmt semantics timing)
|
2009-07-17 01:53:25 +08:00
|
|
|
|
"Define a normal instruction."
|
2003-06-03 23:41:12 +08:00
|
|
|
|
(define-full-insn name comment attrs syntax fmt () semantics timing)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
; To reduce the amount of typing.
|
|
|
|
|
; Note that this is the same name as the D'ni in MYST. Oooohhhh.....
|
|
|
|
|
; this must be the right way to go. :-)
|
|
|
|
|
|
|
|
|
|
(define-pmacro dni
|
2009-07-17 01:53:25 +08:00
|
|
|
|
"Shorthand form of define-normal-insn."
|
2003-06-03 23:41:12 +08:00
|
|
|
|
define-normal-insn
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
; Macro instructions.
|
|
|
|
|
|
|
|
|
|
; Define a macro-insn object, normal version.
|
|
|
|
|
; This only supports expanding to one real insn.
|
|
|
|
|
|
|
|
|
|
(define-pmacro (define-normal-macro-insn name comment attrs syntax expansion)
|
2009-07-17 01:53:25 +08:00
|
|
|
|
"Define a normal macro instruction."
|
2003-06-03 23:41:12 +08:00
|
|
|
|
(define-full-minsn name comment attrs syntax expansion)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
; To reduce the amount of typing.
|
|
|
|
|
|
|
|
|
|
(define-pmacro dnmi
|
2009-07-17 01:53:25 +08:00
|
|
|
|
"Shorthand form of define-normal-macro-insn."
|
2003-06-03 23:41:12 +08:00
|
|
|
|
define-normal-macro-insn
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
; Modes.
|
|
|
|
|
; ??? Not currently available for use.
|
|
|
|
|
;
|
|
|
|
|
; Define Normal Mode
|
|
|
|
|
;
|
|
|
|
|
;(define-pmacro (define-normal-mode name comment attrs bits bytes
|
|
|
|
|
; non-mode-c-type printf-type sem-mode ptr-to host?)
|
|
|
|
|
; "Define a normal mode.\n"
|
|
|
|
|
; (define-full-mode name comment attrs bits bytes
|
|
|
|
|
; non-mode-c-type printf-type sem-mode ptr-to host?)
|
|
|
|
|
;)
|
|
|
|
|
;
|
|
|
|
|
; For those who don't like typing.
|
|
|
|
|
;(define-pmacro dnm
|
|
|
|
|
; "Shorthand form of define-normal-mode.\n"
|
|
|
|
|
; define-normal-mode
|
|
|
|
|
;)
|