Name |
Description |
Add |
|
ArithmeticType |
|
ArrayType |
|
Assign |
|
AssignList |
|
Attribute |
Expr.name: Expr must be a struct or union. |
BinaryArithmeticOp |
|
BinaryComparisonOp |
|
BinaryLogicalOp |
|
BinaryOp |
|
BinaryOpSupportingArithmeticOperands |
|
BinaryOpSupportingIntegralOperands |
|
BinaryOpSupportingOnlyIntegralOperands |
|
BitwiseAnd |
|
BitwiseNot |
~Expr: only takes integral Type. After semantic analysis, only the following 2 types are possible: 1) long 2) ulong |
BitwiseOr |
|
BreakStmt |
|
CaseLabelsGrabber |
|
CaseStmt |
|
CharType |
|
CompoundStmt |
|
ConditionalExpr |
|
ConstChar |
|
ConstDouble |
|
ConstExpr |
|
ConstFloat |
|
ConstLong |
|
ConstPtr |
|
ConstShort |
|
ConstStringLiteral |
|
ConstUChar |
|
ConstULong |
|
ConstUShort |
|
ContStmt |
|
Decln |
|
DefaultStmt |
|
Dereference |
*Expr: Expr must be a pointer. Arrays and functions are implicitly converted to pointers. This is an lvalue, so it has an address. |
Divide |
|
DoWhileStmt |
|
DoubleType |
|
EmptyFunctionType |
|
Env |
|
Env.Entry |
|
Env.Scope |
|
Env2 |
1. A global scope. 2. A function scope, with multiple name scopes. 3. ObjectId. 4. TypeId. |
Env2.EnumEntry |
|
Env2.FrameObjectEntry |
|
Env2.FunctionScope |
Function info, local symbol tables. |
Env2.GlobalSymbolTable |
|
Env2.LocalSymbolTable |
|
Env2.NamedObjectEntry |
|
Env2.ObjectEntry |
|
Env2.ParameterObjectEntry |
|
Env2.SymbolEntry |
|
Env2.SymbolTable |
|
Env2.TypeEntry |
|
Equal |
|
Expr |
The cdecl calling convention: 1. arguments are passed on the stack, right to left. 2. int values and pointer values are returned in %eax. 3. floats are returned in %st(0). 4. when calling a function, %st(0) ~ %st(7) are all free. 5. functions are free to use %eax, %ecx, %edx, because caller needs to save them. 6. stack must be aligned to 4 bytes (before gcc 4.5, for gcc 4.5+, aligned to 16 bytes). |
ExprStmt |
|
ExprType |
|
FloatType |
|
ForStmt |
|
FuncCall |
|
FuncDef |
|
FunctionType |
|
GEqual |
|
GotoLabelsGrabber |
|
GotoStmt |
|
Greater |
|
IfElseStmt |
|
IfStmt |
|
IncDecExpr |
|
IncompleteArrayType |
|
InitExpr |
|
InitList |
|
Initr |
1. Scalar: an expression, optionally enclosed in braces. int a = 1; // valid int a = { 1 }; // valid int a[] = { { 1 }, 2 }; // valid int a = {{ 1 }}; // warning in gcc, a == 1; error in MSVC int a = { { 1 }, 2 }; // warning in gcc, a == 1; error in MSVC int a = { 1, 2 }; // warning in gcc, a == 1; error in MSVC I'm following MSVC: you either put an expression, or add a single layer of brace. 2. Union: union A { int a; int b; }; union A u = { 1 }; // always initialize the first member, i.e. a, not b. union A u = {{ 1 }}; // valid union A u = another_union; // valid 3. Struct: struct A { int a; int b; }; struct A = another_struct; // valid struct A = { another_struct }; // error, once you put a brace, the compiler assumes you want to initialize members. From 2 and 3, once seen union or struct, either read expression or brace. 4. Array of characters: char a[] = { 'a', 'b' }; // valid char a[] = "abc"; // becomes char a[4]: include '\0' char a[3] = "abc"; // valid, ignore '\0' char a[2] = "abc"; // warning in gcc; error in MSVC If the aggregate contains members that are aggregates or unions, or if the first member of a union is an aggregate or union, the rules apply recursively to the subaggregates or contained unions. If the initializer of a subaggregate or contained union begins with a left brace, the initializers enclosed by that brace and its matching right brace initialize the members of the subaggregate or the first member of the contained union. Otherwise, only enough initializers from the list are taken to account for the members of the first subaggregate or the first member of the contained union; any remaining initializers are left to initialize the next member of the aggregate of which the current subaggregate or contained union is a part. |
IntegralType |
|
LEqual |
|
LShift |
|
LabeledStmt |
|
Less |
|
LogicalAnd |
|
LogicalNot |
!Expr: only takes scalar Type. After semantic analysis, only the following 4 types are possible: 1) long 2) ulong 3) float 4) double Pointers are converted to ulongs. |
LogicalOr |
Left || Right: can only take scalars (to compare with 0). After semantic analysis, each operand can only be long, ulong, float, double. Pointers are casted to ulongs. if Left != 0: return 1 else: return Right != 0 Generate the assembly in this fashion, then every route would only have one jump. +---------+ 1 | cmp lhs |-------+ +---------+ | | | | 0 | | | +----+----+ 1 | | cmp rhs |-------+ +---------+ | | | | 0 | | | +----+----+ | | eax = 0 | | +---------+ | | | +---------+ | | | | +------------+ label_set | | | +---------+ | | eax = 1 | | +---------+ | | +---------+ label_finish | |
LongType |
|
MemberIterator |
|
MemberIterator.Status |
|
Modulo |
|
Multiply |
|
Negative |
-Expr: only takes arithmetic Type. After semantic analysis, only the following 4 types are possible: 1) long 2) ulong 3) float 4) double |
NotEqual |
|
PointerType |
|
PostDecrement |
Expr--: must be a scalar |
PostIncrement |
Expr++: must be integral, float or pointer. If Expr is an array, it is converted to a pointer in semantic analysis. |
PreDecrement |
--Expr: must be a scalar |
PreIncrement |
++Expr: must be a scalar |
RShift |
|
Reference |
&Expr: get the address of Expr. |
ReturnStmt |
|
ScalarType |
|
ShortType |
|
Stmt |
|
StmtVisitor |
|
StructOrUnionType |
|
StructOrUnionType.StructOrUnionLayout |
|
Sub |
|
SwitchStmt |
|
TranslnUnit |
|
TypeCast |
|
UCharType |
|
ULongType |
|
UShortType |
|
UnaryArithOp |
|
Utils |
|
Utils.StoreEntry |
|
Variable |
|
VoidType |
|
WhileStmt |
|
Xor |
|