#include <stdint.h>
#include <stdlib.h>
#include <dirent.h>
#include <fstream>
#include <iostream>
#include <string>
#include <map>
#include <sstream>
#include <errno.h>
#include "Version.hxx"
#include "UocInfo.hxx"
#include "AST.hxx"
#include "Environment.hxx"
#include "inter-pass.hxx"
#include "backend.hxx"
Go to the source code of this file.
Functions | |
| static shared_ptr< AST > | getTypeAst (shared_ptr< AST > fld) |
| Given a sub-form describing a field, return the AST describing its type. | |
| static size_t | bitOffset (shared_ptr< AST > leg, size_t n) |
| Compute the bit offset of a field within its containing union. | |
| static bool | TypesAgree (shared_ptr< AST > fld1, shared_ptr< AST > fld2) |
| Compare types of two fields. | |
| bool | reprCheck (std::ostream &errStream, shared_ptr< AST > ast) |
| Enforce the sanity requirements on REPR declarations. | |
Consider the defrepr:
(defrepr name
(Ctr1 f11:type f21:type ... fn1:type
(where fp1=val11 fq1=val21 ... fm1=valm1))
(Ctr2 f12:type f22:type ... fn2:type
(where fp2=val12 fq2=val22 ... fm2=valm2))
... )
</ped>
The following restrictions apply:
For all constructors Ctrx, Ctry, Ctrz ...:
This pass tests that all of these requirements are satisfied.
Definition in file DefreprCheck.cxx.
| static size_t bitOffset | ( | shared_ptr< AST > | leg, | |
| size_t | n | |||
| ) | [static] |
Compute the bit offset of a field within its containing union.
Note that this computation is target dependent if the Word type is being used.
Definition at line 122 of file DefreprCheck.cxx.
References at_bitfieldType, and getTypeAst().
Referenced by reprCheck().
Given a sub-form describing a field, return the AST describing its type.
Definition at line 101 of file DefreprCheck.cxx.
References assert(), at_field, at_fill, at_methdecl, and boost::GC_NULL.
Referenced by bitOffset(), and TypesAgree().
| bool reprCheck | ( | std::ostream & | errStream, | |
| shared_ptr< AST > | ast | |||
| ) |
Enforce the sanity requirements on REPR declarations.
Definition at line 157 of file DefreprCheck.cxx.
References assert(), at_declrepr, at_defrepr, at_defunion, at_field, at_reprctr, at_reprctrs, bitOffset(), CHKERR, FLD_IS_DISCM, TypesAgree(), and UNION_IS_REPR.
Compare types of two fields.
If a field appears in multiple legs of a DEFREPR, it must have the same type in all legs. If it is of bitfield type, it must also have the same number of bits in all occurrences.
Definition at line 143 of file DefreprCheck.cxx.
References getTypeAst().
Referenced by reprCheck().
1.4.7