[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gm2] cvs changes: bitfield checkin
From: |
Gaius Mulley |
Subject: |
[Gm2] cvs changes: bitfield checkin |
Date: |
Wed, 15 Feb 2012 13:36:32 +0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) |
Hi,
The following changes are made to the type declaration system
which is necessary to implement bit alignment of record fields.
These changes are incomplete but in theory shouldn't break the
existing codebase (modulo bugs).
The only significant change is that alignment of record fields now uses
the ISO pragma syntax rather than __ATTRIBUTE__ (( )). As these changes
are finalised I'd like to move to using the <* *> pragma's for
alignment. Currently all other alignment is achieved with __ATTRIBUTE__
(()).
The current ebnf is given at http://www.nongnu.org/gm2/ebnf.html. I'll
try and introduce a 'deprecated message' when future alignment changes
are implemented. The record packing is not functional at present,
currently it only defines the packed types (and does not accurately
assign correct bit fields either!). But bitfield packing has demanded a
huge change to gm2/gm2-compiler/M2GCCDeclare.mod.
Here is an example of how, in the future, users can use record packing:
TYPE
bits3c = [0..7] ;
bits3i = [-4..3] ;
bits2 = [0..1] ;
byte = RECORD
<* bytealignment(0) *>
x: bits3c ;
z: bits2 <* unused *> ;
y: bits3i ;
END ;
notice that there is a default alignment pragma. It is also possible to
specify alignment per field. In the above example field, z, is declared
as unused. I hope to implement <* unused *> in parameters as well.
regards,
Gaius
* gm2/gm2-compiler/M2DebugStack.def: New file.
* gm2/gm2-compiler/M2DebugStack.mod: New file.
* gm2/Make-lang.in: tidied up the file and introduced a commented
rule which allows stage2 to be built from a prebuilt stage1. This
is only ever used during heavy development and allows debugging in
Modula-2 to occur rather than in the translated, C, files.
* gm2/gccgm2.c: gccgm2_BuildStartEnumeration, gccgm2_BuildEndRecord,
start_enum (new parameter ispacked). New functions
(gccgm2_SetTypePacked, gccgm2_SetDeclPacked,
gccgm2_GetPackedBooleanType, gccgm2_SetRecordFieldOffset,
gccgm2_GetTBitSize, noBitsRequired, gccgm2_BuildStartVarient,
gccgm2_BuildEndVarient, gccgm2_BuildSmallestTypeRange,
gccgm2_BuildTBitSize).
* gm2/lang.opt: introduce debugging option -fd.
* gm2/m2.flex: introduce <* *> into the set of lexical tokens.
* gm2/m2pp.c: pretty print union types and also whether records and their
fields are aligned, packed, offset values and addressible.
* gm2/bnf/gm2l.bnf: introduce <* *> into the set of lexical tokens.
* gm2/bnf/gm2m.bnf: introduce <* *> into the set of lexical tokens.
* gm2/bnf/m2-2.bnf: introduce <* *> into the set of lexical tokens.
extended the ebnf to include a default record alignment using pragmas.
Also extended the ebnf to include field alignment and packing using
pragmas.
* gm2/bnf/m2-3.bnf: introduce <* *> into the set of lexical tokens.
extended the ebnf to include a default record alignment using pragmas.
Also extended the ebnf to include field alignment and packing using
pragmas.
* gm2/bnf/m2-c.bnf: introduce <* *> into the set of lexical tokens.
extended the ebnf to include a default record alignment using pragmas.
Also extended the ebnf to include field alignment and packing using
pragmas.
* gm2/bnf/m2-h.bnf: introduce <* *> into the set of lexical tokens.
extended the ebnf to include a default record alignment using pragmas.
Also extended the ebnf to include field alignment and packing using
pragmas.
* gm2/bnf/m2.bnf: introduce <* *> into the set of lexical tokens.
extended the ebnf to include a default record alignment using pragmas.
Also extended the ebnf to include field alignment and packing using
pragmas.
* gm2/el/g-mode.el: removed PACKED as a keyword.
* gm2/gm2-compiler/M2GCCDeclare.mod: huge number of changes and
many aspects have been rewritten. The main changes occur from
delaying a records declaration into a GCC Tree until its alignment
is known. Varient records are also handled in this way. Much
debugging code added as well. Simple types can also be declared
as packed (Subranges, Boolean) and enumeration types.
* gm2/gm2-compiler/M2Quads.def: new procedures BuildBitLength,
BuildPragmaField, BuildDefaultFieldAlignment, OperandAnno,
Annotate).
* gm2/gm2-compiler/M2Quads.mod: implement all of the above.
Provide a useful internal debugging procedure function 'ds'
which display the quadruple stack.
* gm2/gm2-compiler/M2Reserved.def: add LDirectiveTok and
RDirectiveTok.
* gm2/gm2-compiler/M2Reserved.mod: implement above.
* gm2/gm2-compiler/P2SymBuild.def: new procedure functions
P2BuildDefaultFieldAlignment, BuildPragmaConst.
* gm2/gm2-compiler/P2SymBuild.mod: implement above.
* gm2/gm2-compiler/Sets.mod: no longer import BITSET from SYSTEM.
* gm2/gm2-compiler/SymbolTable.def: new procedures
(GetDefaultRecordFieldAlignment, PutDeclaredPacked,
IsDeclaredPacked, IsDeclaredPackedResolved,
GetPackedEquivalent, GetNonPackedEquivalent,
PutDefaultRecordFieldAlignment, PutUnused, IsUnused).
* gm2/gm2-compiler/SymbolTable.mod: implement above.
* gm2/gm2-compiler/gccgm2.def: remove procedure function
BuildStartVarientRecord and add procedure functions
BuildStartVarient, BuildEndVarient, BuildSmallestTypeRange,
GetPackedBooleanType, SetDeclPacked, SetTypePacked,
SetRecordFieldOffset, BuildTBitSize.
* gm2/gm2-compiler/ppg.mod: remove BITSET from SYSTEM
import list.
* gm2/gm2-libs-iso/SYSTEM.def: define new builtin procedure
function TBITSIZE.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gm2] cvs changes: bitfield checkin,
Gaius Mulley <=