📄 readme-ns32k
字号:
Copyright (C) 1987 Free Software Foundation, Inc.Contributed by Michael Tiemann (tiemann@mcc.com)This file is part of GNU CC.GNU CC is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation; either version 1, or (at your option)any later version.GNU CC is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with GNU CC; see the file COPYING. If not, write tothe Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.This file describes the implementation notes of the GNU C Compiler forthe National Semiconductor 32032 chip (and 32000 family).The 32032 machine description and configuration file for this compileris, for NS32000 family machine, primarily machine independent.However, since this release still depends on vendor-suppliedassemblers and linkers, the compiler must obey the existingconventions of the actual machine to which this compiler is targeted.In this case, the actual machine which this compiler was targeted tois a Sequent Balance 8000, running DYNIX 2.1.The assembler for DYNIX 2.1 (and DYNIX 3.0, alas) does not cope withthe full generality of the addressing mode REGISTER RELATIVE.Specifically, it generates incorrect code for operands of thefollowing form: sym(rn)Where `rn' is one of the general registers. Correct code is generatedfor operands of the form sym(pn)where `pn' is one of the special processor registers (sb, fp, or sp).An equivalent operand can be generated by the form sym[rn:b]although this addressing mode is about twice as slow on the 32032.The more efficient addressing mode is controlled by defining theconstant SEQUENT_ADDRESS_BUG to 0. It is currently defined to be 1.Another bug in the assembler makes it impossible to compute withexplicit addresses. In order to compute with a symbolic address, itis necessary to load that address into a register using the "addr"instruction. For example, it is not possible to say cmpd _p,@_xRather one must say addr _x,rn cmpd _p,rnThe ns32032 chip has a number of known bugs. Any attempt to make thecompiler unaware of these deficiencies will surely bring disaster.The current list of know bugs are as follows (list provided by RichardStallman):1) instructions with two overlapping operands in memory(unlikely in C code, perhaps impossible).2) floating point conversion instructions with constantoperands (these may never happen, but I'm not certain).3) operands crossing a page boundary. These can be preventedby setting the flag in tm.h that requires strict alignment.4) Scaled indexing in an insn following an insn that has a read-writeoperand in memory. This can be prevented by placing a no-op inbetween. I, Michael Tiemann, do not understand what exactly is meantby `read-write operand in memory'. If this is refering to the specialTOS mode, for example "addd 5,tos" then one need not fear, since thiswill never be generated. However, is this includes "addd 5,-4(fp)"then there is room for disaster. The Sequent compiler does not inserta no-op for code involving the latter, and I have been informed thatSequent is aware of this list of bugs, so I must assume that it is nota problem.5) The 32032 cannot shift by 32 bits. It shifts modulo the word sizeof the operand. Therefore, for 32-bit operations, 32-bit shifts areinterpreted as zero bit shifts. 32-bit shifts have been removed fromthe compiler, but future hackers must be careful not to reintroducethem.6) The ns32032 is a very slow chip; however, some instructions arestill very much slower than one might expect. For example, it isalmost always faster to double a quantity by adding it to itself thanby shifting it by one, even if that quantity is deep in memory. TheMOVM instruction has a 20-cycle setup time, after which it moves dataat about the speed that normal moves would. It is also faster to useaddress generation instructions than shift instructions for leftshifts less than 4. I do not claim that I generate optimal code for allgiven patterns, but where I did escape from National's "cleanarchitecture", I did so because the timing specification from the databook says that I will win if I do. I suppose this is called the"performance gap".Signed bitfield extraction has not been implemented. It is notprovided by the NS32032, and while it is most certainly possible to dobetter than the standard shift-left/shift-right sequence, it is alsoquite hairy. Also, since signed bitfields do not yet exist in C, thisomission seems relatively harmless.Zero extractions could be better implemented if it were possible inGCC to provide sized zero extractions: i.e. a byte zero extractionwould be allowed to yield a byte result. The current implementationof GCC manifests 68000-ist thinking, where bitfields are extractedinto a register, and automatically sign/zero extended to fill theregister. See comments in ns32k.md around the "extzv" insn for moredetails.It should be noted that while the NS32000 family was designed toprovide odd-aligned addressing capability for multi-byte data (alsoprovided by the 68020, but not by the 68000 or 68010), many machinesdo not opt to take advantage of this. For example, on the sequent,although there is no advantage to long-word aligning word data, shortsmust be int-aligned in structs. This is an example of anothermachine-specific machine dependency.Because the ns32032 is has a coherent byte-order/bit-orderarchitecture, many instructions which would be different for68000-style machines, fold into the same instruction for the 32032.The classic case is push effective address, where it does not matterwhether one is pushing a long, word, or byte address. They all willpush the same address.The macro FUNCTION_VALUE_REGNO_P is probably not sufficient, what isneeded is FUNCTION_VALUE_P, which also takes a MODE parameter. Inthis way it will be possible to determine more exactly whether aregister is really a function value register, or just one that happensto look right.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -