aboutsummaryrefslogtreecommitdiff
path: root/gas/config/tc-vax.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2015-08-12 04:40:42 -0700
committerH.J. Lu <hjl.tools@gmail.com>2015-08-12 04:40:42 -0700
commit3739860c11a9cfcdaa4d5d204ea3536784de7bb3 (patch)
tree8d2bb6bc306f152fada587521629e926815a8499 /gas/config/tc-vax.c
parent1b7868733d45220e63b72a1814f30e090f761821 (diff)
downloadgdb-3739860c11a9cfcdaa4d5d204ea3536784de7bb3.zip
gdb-3739860c11a9cfcdaa4d5d204ea3536784de7bb3.tar.gz
gdb-3739860c11a9cfcdaa4d5d204ea3536784de7bb3.tar.bz2
Remove trailing spaces in gas
Diffstat (limited to 'gas/config/tc-vax.c')
-rw-r--r--gas/config/tc-vax.c110
1 files changed, 55 insertions, 55 deletions
diff --git a/gas/config/tc-vax.c b/gas/config/tc-vax.c
index b99d525..b64b8cb 100644
--- a/gas/config/tc-vax.c
+++ b/gas/config/tc-vax.c
@@ -783,11 +783,11 @@ static const short int vax_operand_width_size[256] =
ban these opcodes. They are mnemonics for "elastic" instructions
that are supposed to assemble into the fewest bytes needed to do a
branch, or to do a conditional branch, or whatever.
-
+
The opcode is in the usual place [low-order n*8 bits]. This means
that if you mask off the bucky bits, the usual rules apply about
how long the opcode is.
-
+
All VAX branch displacements come at the end of the instruction.
For simple branches (1-byte opcode + 1-byte displacement) the last
operand is coded 'b?' where the "data type" '?' is a clue that we
@@ -795,14 +795,14 @@ static const short int vax_operand_width_size[256] =
and branch around a jump. This is by far the most common case.
That is why the VIT_OPCODE_SYNTHETIC bit is set: it says this is
a 0-byte op-code followed by 2 or more bytes of operand address.
-
+
If the op-code has VIT_OPCODE_SPECIAL set, then we have a more unusual
case.
-
+
For JBSB & JBR the treatment is the similar, except (1) we have a 'bw'
option before (2) we can directly JSB/JMP because there is no condition.
These operands have 'b-' as their access/data type.
-
+
That leaves a bunch of random opcodes: JACBx, JxOBxxx. In these
cases, we do the same idea. JACBxxx are all marked with a 'b!'
JAOBxxx & JSOBxxx are marked with a 'b:'. */
@@ -977,14 +977,14 @@ vip_begin (int synthetic_too, /* 1 means include jXXX op-codes. */
/* Take 3 char.s, the last of which may be `\0` (non-existent)
and return the VAX register number that they represent.
-
+
Return -1 if they don't form a register name. Good names return
a number from 0:15 inclusive.
-
+
Case is not important in a name.
-
+
Register names understood are:
-
+
R0
R1
R2
@@ -1081,20 +1081,20 @@ vax_reg_parse (char c1, char c2, char c3, char c4)
For speed, expect a string of whitespace to be reduced to a single ' '.
This is the case for GNU AS, and is easy for other DEC-compatible
assemblers.
-
+
Knowledge about DEC VAX assembler operand notation lives here.
This doesn't even know what a register name is, except it believes
all register names are 2 or 3 characters, and lets vax_reg_parse() say
what number each name represents.
It does, however, know that PC, SP etc are special registers so it can
detect addressing modes that are silly for those registers.
-
+
Where possible, it delivers 1 fatal or 1 warning message if the operand
is suspect. Exactly what we test for is still evolving.
---
Arg block.
-
+
There were a number of 'mismatched argument type' bugs to vip_op.
The most general solution is to typedef each (of many) arguments.
We used instead a typedef'd argument block. This is less modular
@@ -1102,7 +1102,7 @@ vax_reg_parse (char c1, char c2, char c3, char c4)
on most engines, and seems to keep programmers happy. It will have
to be done properly if we ever want to use vip_op as a general-purpose
module (it was designed to be).
-
+
G^
Doesn't support DEC "G^" format operands. These always take 5 bytes
@@ -1113,14 +1113,14 @@ vax_reg_parse (char c1, char c2, char c3, char c4)
If there is some other use for "G^", feel free to code it in!
speed
-
+
If I nested if()s more, I could avoid testing (*err) which would save
time, space and page faults. I didn't nest all those if()s for clarity
and because I think the mode testing can be re-arranged 1st to test the
- commoner constructs 1st. Does anybody have statistics on this?
-
+ commoner constructs 1st. Does anybody have statistics on this?
+
error messages
-
+
In future, we should be able to 'compose' error messages in a scratch area
and give the user MUCH more informative error messages. Although this takes
a little more code at run-time, it will make this module much more self-
@@ -1129,18 +1129,18 @@ vax_reg_parse (char c1, char c2, char c3, char c4)
the Un*x characters "$`*", that most users will expect from this AS.
----
-
+
The input is a string, ending with '\0'.
-
+
We also require a 'hint' of what kind of operand is expected: so
we can remind caller not to write into literals for instance.
-
+
The output is a skeletal instruction.
-
+
The algorithm has two parts.
1. extract the syntactic features (parse off all the @^#-()+[] mode crud);
2. express the @^#-()+[] as some parameters suited to further analysis.
-
+
2nd step is where we detect the googles of possible invalid combinations
a human (or compiler) might write. Note that if we do a half-way
decent assembler, we don't know how long to make (eg) displacement
@@ -1157,19 +1157,19 @@ vax_reg_parse (char c1, char c2, char c3, char c4)
- error text(s) why we couldn't understand the operand
----
-
+
To decode output of this, test errtxt. If errtxt[0] == '\0', then
we had no errors that prevented parsing. Also, if we ever report
an internal bug, errtxt[0] is set non-zero. So one test tells you
if the other outputs are to be taken seriously.
----
-
+
Dec defines the semantics of address modes (and values)
by a two-letter code, explained here.
-
+
letter 1: access type
-
+
a address calculation - no data access, registers forbidden
b branch displacement
m read - let go of bus - write back "modify"
@@ -1177,9 +1177,9 @@ vax_reg_parse (char c1, char c2, char c3, char c4)
v bit field address: like 'a' but registers are OK
w write
space no operator (eg ".long foo") [our convention]
-
+
letter 2: data type (i.e. width, alignment)
-
+
b byte
d double precision floating point (D format)
f single precision floating point (F format)
@@ -1192,11 +1192,11 @@ vax_reg_parse (char c1, char c2, char c3, char c4)
? simple synthetic branch operand
- unconditional synthetic JSB/JSR operand
! complex synthetic branch operand
-
+
The '-?!' letter 2's are not for external consumption. They are used
for various assemblers. Generally, all unknown widths are assumed 0.
We don't limit your choice of width character.
-
+
DEC operands are hard work to parse. For example, '@' as the first
character means indirect (deferred) mode but elsewhere it is a shift
operator.
@@ -1205,9 +1205,9 @@ vax_reg_parse (char c1, char c2, char c3, char c4)
We try hard not to parse anything that MIGHT be part of the expression
buried in that syntax. For example if we see @...(Rn) we don't check
for '-' before the '(' because mode @-(Rn) does not exist.
-
+
After parsing we have:
-
+
at 1 if leading '@' (or Un*x '*')
len takes one value from " bilsw". eg B^ -> 'b'.
hash 1 if leading '#' (or Un*x '$')
@@ -1218,7 +1218,7 @@ vax_reg_parse (char c1, char c2, char c3, char c4)
paren 1 if () are around register
reg major register number 0:15 -1 means absent
ndx index register number 0:15 -1 means absent
-
+
Again, I dare not explain it: just trace ALL the code!
Summary of vip_op outputs.
@@ -1316,7 +1316,7 @@ vip_op (char *optext, struct vop *vopP)
/* p points to what may be the beginning of an expression.
We have peeled off the front all that is peelable.
We know at, len, hash.
-
+
Lets point q at the end of the text and parse that (backwards). */
for (q = p; *q; q++)
@@ -1491,7 +1491,7 @@ vip_op (char *optext, struct vop *vopP)
We will deliver a 4-bit reg, and a 4-bit mode. */
/* Case of branch operand. Different. No L^B^W^I^S^ allowed for instance.
-
+
in: at ?
len ?
hash ?
@@ -1500,7 +1500,7 @@ vip_op (char *optext, struct vop *vopP)
paren ?
reg ?
ndx ?
-
+
out: mode 0
reg -1
len ' '
@@ -1519,7 +1519,7 @@ vip_op (char *optext, struct vop *vopP)
/* Since nobody seems to use it: comment this 'feature'(?) out for now. */
#ifdef NEVER
/* Case of stand-alone operand. e.g. ".long foo"
-
+
in: at ?
len ?
hash ?
@@ -1528,7 +1528,7 @@ vip_op (char *optext, struct vop *vopP)
paren ?
reg ?
ndx ?
-
+
out: mode 0
reg -1
len ' '
@@ -1565,7 +1565,7 @@ vip_op (char *optext, struct vop *vopP)
#endif
/* Case of S^#.
-
+
in: at 0
len 's' definition
hash 1 demand
@@ -1574,7 +1574,7 @@ vip_op (char *optext, struct vop *vopP)
paren 0 by "()" scan logic because "S^" seen
reg -1 or nn by mistake
ndx -1
-
+
out: mode 0
reg -1
len 's'
@@ -1606,9 +1606,9 @@ vip_op (char *optext, struct vop *vopP)
err = _("S^# may only read-access");
}
}
-
+
/* Case of -(Rn), which is weird case.
-
+
in: at 0
len '
hash 0
@@ -1617,7 +1617,7 @@ vip_op (char *optext, struct vop *vopP)
paren 1 by definition
reg present by definition
ndx optional
-
+
out: mode 7
reg present
len ' '
@@ -1648,7 +1648,7 @@ vip_op (char *optext, struct vop *vopP)
}
/* Case of (Rn)+, which is slightly different.
-
+
in: at
len ' '
hash 0
@@ -1657,7 +1657,7 @@ vip_op (char *optext, struct vop *vopP)
paren 1 by definition
reg present by definition
ndx optional
-
+
out: mode 8+@
reg present
len ' '
@@ -1679,7 +1679,7 @@ vip_op (char *optext, struct vop *vopP)
}
/* Case of #, without S^.
-
+
in: at
len ' ' or 'i'
hash 1 by definition
@@ -1688,7 +1688,7 @@ vip_op (char *optext, struct vop *vopP)
paren 0
reg absent
ndx optional
-
+
out: mode 8+@
reg PC
len ' ' or 'i'
@@ -1727,7 +1727,7 @@ vip_op (char *optext, struct vop *vopP)
/* Case of Rn. We separate this one because it has a few special
errors the remaining modes lack.
-
+
in: at optional
len ' '
hash 0 by program logic
@@ -1736,7 +1736,7 @@ vip_op (char *optext, struct vop *vopP)
paren 0 by definition
reg present by definition
ndx optional
-
+
out: mode 5+@
reg present
len ' ' enforce no length
@@ -1773,7 +1773,7 @@ vip_op (char *optext, struct vop *vopP)
paren == 1 OR reg==-1 */
/* Rest of cases fit into one bunch.
-
+
in: at optional
len ' ' or 'b' or 'w' or 'l'
hash 0 by program logic
@@ -1782,7 +1782,7 @@ vip_op (char *optext, struct vop *vopP)
paren optional
reg optional
ndx optional
-
+
out: mode 10 + @ + len
reg optional
len ' ' or 'b' or 'w' or 'l'
@@ -1832,15 +1832,15 @@ vip_op (char *optext, struct vop *vopP)
knowledge of how you parse (or evaluate) your expressions.
We do however strip off and decode addressing modes and operation
mnemonic.
-
+
The exploded instruction is returned to a struct vit of your choice.
#include "vax-inst.h" to know what a struct vit is.
-
+
This function's value is a string. If it is not "" then an internal
logic error was found: read this code to assign meaning to the string.
No argument string should generate such an error string:
it means a bug in our code, not in the user's text.
-
+
You MUST have called vip_begin() once before using this function. */
static void
@@ -1865,7 +1865,7 @@ vip (struct vit *vitP, /* We build an exploded instruction here. */
if (*instring == ' ')
++instring;
-
+
/* MUST end in end-of-string or exactly 1 space. */
for (p = instring; *p && *p != ' '; p++)
;