1*43112SbosticTweaking the PCC to provide 64-bit integers 2*43112Sbostic------------------------------------------- 3*43112Sbostic 4*43112SbosticA 64-bit integer data type would be nice to have to implement data 5*43112Sbosticstructures such as millisecond time values, multi-gigabyte disk 6*43112Sbosticaddresses and so on. 7*43112Sbostic 8*43112SbosticSince the number of bits in the type field of the compiler type word is 9*43112Sbosticonly 16 and all 16 types are used, it makes sense to pick a type which 10*43112Sbosticis not useful and overload it for the 64-bit type. Thus we'll use LONG 11*43112Sbosticand ULONG types to represent signed and unsigned 64-bit integers 12*43112Sbosticinternally. Externally we must provide some name other than 'long' for 13*43112Sbosticthe type or else all hell will break loose with standard width 14*43112Sbosticdefinitions; it's been suggested that we use 'quad', following its use 15*43112Sbosticin VAX assembler. (I suppose a flag could be used to signal the 16*43112Sbosticcompiler that 'long' really should be 64 bits, so we can eventually 17*43112Sbosticconvert existing code to appropriately handle three integer sizes in 18*43112Sbosticlegal C.) 19*43112Sbostic 20*43112SbosticData structures 21*43112Sbostic--------------- 22*43112Sbostic 23*43112SbosticIt's probably simplest to just punt on quad constants for the time 24*43112Sbosticbeing. This would eliminate the only situation in which the compiler's 25*43112Sbosticown data structures would need to be adjusted to handle 64-bit 26*43112Sbosticintegers. Once the compiler has been bootstrapped for 64-bit 27*43112Sbosticvariables, 64-bit constants should follow with reasonable ease. 28*43112Sbostic 29*43112SbosticParameters in header files 30*43112Sbostic-------------------------- 31*43112Sbostic 32*43112SbosticThe size and alignment of LONG and ULONG will need to change in 33*43112Sbosticmacdefs.h. This shouldn't cause any problems (famous last words). 34*43112Sbostic 35*43112SbosticAlgorithm changes, file by file 36*43112Sbostic------------------------------- 37*43112Sbostic 38*43112Sbosticcgram.y 39*43112Sbostic The production for switch statements may need to change if we 40*43112Sbostic want to allow quad type switch expressions. Do PDP-11 41*43112Sbostic compilers permit long switch expressions? I doubt it... 42*43112Sbosticpftn.c 43*43112Sbostic dclstruct 44*43112Sbostic We will probably have to permit quad size enums eventually. 45*43112Sbostic Since the plan is to hold off on quad size constants, we can 46*43112Sbostic punt for now. 47*43112Sbosticcode.c 48*43112Sbostic type_move 49*43112Sbostic MOVL must become MOVQ. Since this code is intended for 50*43112Sbostic handling register variables, and we likely won't allow register 51*43112Sbostic quads, we don't need to worry too hard about this. 52*43112Sbosticlocal.c 53*43112Sbostic clocal 54*43112Sbostic PCONV and SCONV code may need be changed to know about quads. 55*43112Sbostic The SCONV code is primarily concerned with constants (again). 56*43112Sbostic cisreg 57*43112Sbostic LONG and ULONG will no longer be permitted types for register 58*43112Sbostic variables. 59*43112Sbostic ctype 60*43112Sbostic This routine converts 'unsupported' types into INT; now that 61*43112Sbostic LONG and ULONG have a separate meaning from INT, the routine 62*43112Sbostic becomes an identity function. 63*43112Sbostic tlen 64*43112Sbostic LONG and ULONG now have size 2. Cthulhu knows how much code 65*43112Sbostic assumes int types will always fit in 1 register. 66*43112Sbosticlocal2.c 67*43112Sbostic tlen 68*43112Sbostic Same as the first pass tlen. 69*43112Sbostic prtype 70*43112Sbostic Prints the letter ([blwfd]) which is appended to VAX 71*43112Sbostic instructions for operations of a particular type. We need to 72*43112Sbostic add 'q' for LONG and ULONG, although we won't be using prtype 73*43112Sbostic very much! 74*43112Sbostic zzzcode 75*43112Sbostic The tough code generation issues get tougher... The 'A' 76*43112Sbostic conversion code gets considerably more complex. The 'C' stack 77*43112Sbostic count code needs a little adjustment to work from SZINT instead 78*43112Sbostic of SZLONG. 79*43112Sbostic collapsible 80*43112Sbostic Again, conversions are a lot tougher with quads. 81*43112Sbostic shumul 82*43112Sbostic Pointers and arrays of quads need to be handled right. 83*43112Sbosticorder.c 84*43112Sbostic setbin 85*43112Sbostic setasop 86*43112Sbostic It won't be quite so simple to rewrite quads into register to 87*43112Sbostic make a stuck tree work. 88*43112Sbostic sucomp 89*43112Sbostic We need to take another look at the special case hacking for 90*43112Sbostic various flavors of integers. 91*43112Sbosticstab.c 92*43112Sbostic inittypes 93*43112Sbostic Add the 'quad' type. Does dbx know what to do with 64-bit 94*43112Sbostic integers? I sure doubt it. 95*43112Sbostictable.c 96*43112Sbostic Oof. Here is where the real work is. We get to use EMUL to 97*43112Sbostic calculate 64-bit products (the architecture handbook conveniently 98*43112Sbostic provides the algorithm) and other kinds of fun. 99