if (FrameParams > 0 && (Func->Flags & FD_FASTCALL) != 0) {
/* Last parameter is not pushed */
const SymEntry* LastParam = Func->SymTab->SymTail;
- FrameSize -= SizeOf (LastParam->Type);
+ FrameSize -= CheckedSizeOf (LastParam->Type);
--FrameParams;
}
* use a special function that may optimize.
*/
CFlags = CF_NONE;
- if (!Ellipsis && SizeOf (Param->Type) == 1) {
+ if (!Ellipsis && CheckedSizeOf (Param->Type) == 1) {
CFlags = CF_FORCECHAR;
}
Flags = CF_NONE;
if (IsClassPtr (tptr1)) {
/* Scale the subscript value according to element size */
- lval2.ConstVal *= PSizeOf (tptr1);
+ lval2.ConstVal *= CheckedPSizeOf (tptr1);
/* Remove code for lhs load */
RemoveCode (Mark1);
lval2.Type = Indirect (tptr2);
/* Scale the rhs value in the primary register */
- g_scale (TypeOf (tptr1), SizeOf (lval2.Type));
+ g_scale (TypeOf (tptr1), CheckedSizeOf (lval2.Type));
/* */
lval->Type = lval2.Type;
} else {
* portion of the index (which is in (e)ax, so there's no further
* action required).
*/
- g_scale (CF_INT, SizeOf (lval->Type));
+ g_scale (CF_INT, CheckedSizeOf (lval->Type));
} else if (IsClassPtr (tptr2)) {
}
/* Scale it */
- g_scale (TypeOf (tptr1), SizeOf (lval2.Type));
+ g_scale (TypeOf (tptr1), CheckedSizeOf (lval2.Type));
lval->Type = lval2.Type;
} else {
Error ("Cannot subscript");
(rflags & E_MGLOBAL) != 0 || /* Static array, or ... */
rflags == E_MLOCAL; /* Local array */
- if (ConstSubAddr && SizeOf (lval->Type) == 1) {
+ if (ConstSubAddr && CheckedSizeOf (lval->Type) == 1) {
type* SavedType;
/* Reverse the order of evaluation */
- unsigned flags = (SizeOf (lval2.Type) == 1)? CF_CHAR : CF_INT;
+ unsigned flags = (CheckedSizeOf (lval2.Type) == 1)? CF_CHAR : CF_INT;
RemoveCode (Mark2);
/* Get a pointer to the array into the primary. We have changed
flags = TypeOf (lval->Type) | CF_FORCECHAR | CF_CONST;
/* Get the increment value in bytes */
- val = (lval->Type [0] == T_PTR)? PSizeOf (lval->Type) : 1;
+ val = (lval->Type [0] == T_PTR)? CheckedPSizeOf (lval->Type) : 1;
/* We're currently only able to handle some adressing modes */
if ((lval->Flags & E_MGLOBAL) == 0 && /* Global address? */
/* If we have a pointer expression, increment by the size of the type */
if (lval->Type[0] == T_PTR) {
- inc (flags | CF_CONST | CF_FORCECHAR, SizeOf (lval->Type + 1));
+ inc (flags | CF_CONST | CF_FORCECHAR, CheckedSizeOf (lval->Type + 1));
} else {
inc (flags | CF_CONST | CF_FORCECHAR, 1);
}
if (IsClassInt (Type)) {
/* Get the current and new size of the value */
- unsigned OldSize = SizeOf (lval->Type);
- unsigned NewSize = SizeOf (Type);
+ unsigned OldSize = CheckedSizeOf (lval->Type);
+ unsigned NewSize = CheckedSizeOf (Type);
unsigned OldBits = OldSize * 8;
unsigned NewBits = NewSize * 8;
if (istypeexpr ()) {
type Type[MAXTYPELEN];
NextToken ();
- lval->ConstVal = SizeOf (ParseType (Type));
+ lval->ConstVal = CheckedSizeOf (ParseType (Type));
ConsumeRParen ();
} else {
/* Remember the output queue pointer */
CodeMark Mark = GetCodePos ();
hie10 (lval);
- lval->ConstVal = SizeOf (lval->Type);
+ lval->ConstVal = CheckedSizeOf (lval->Type);
/* Remove any generated code */
RemoveCode (Mark);
}
/* Both expressions are constants. Check for pointer arithmetic */
if (IsClassPtr (lhst) && IsClassInt (rhst)) {
/* Left is pointer, right is int, must scale rhs */
- lval->ConstVal = lval->ConstVal + lval2.ConstVal * PSizeOf (lhst);
+ lval->ConstVal += lval2.ConstVal * CheckedPSizeOf (lhst);
/* Result type is a pointer */
} else if (IsClassInt (lhst) && IsClassPtr (rhst)) {
/* Left is int, right is pointer, must scale lhs */
- lval->ConstVal = lval->ConstVal * PSizeOf (rhst) + lval2.ConstVal;
+ lval->ConstVal = lval->ConstVal * CheckedPSizeOf (rhst) + lval2.ConstVal;
/* Result type is a pointer */
lval->Type = lval2.Type;
} else if (IsClassInt (lhst) && IsClassInt (rhst)) {
/* Check for pointer arithmetic */
if (IsClassPtr (lhst) && IsClassInt (rhst)) {
/* Left is pointer, right is int, must scale rhs */
- g_scale (CF_INT, PSizeOf (lhst));
+ g_scale (CF_INT, CheckedPSizeOf (lhst));
/* Operate on pointers, result type is a pointer */
flags |= CF_PTR;
/* Generate the code for the add */
} else if (IsClassInt (lhst) && IsClassPtr (rhst)) {
/* Left is int, right is pointer, must scale lhs. */
- unsigned ScaleFactor = PSizeOf (rhst);
+ unsigned ScaleFactor = CheckedPSizeOf (rhst);
/* Operate on pointers, result type is a pointer */
flags |= CF_PTR;
/* Check for pointer arithmetic */
if (IsClassPtr (lhst) && IsClassInt (rhst)) {
/* Left is pointer, right is int, must scale rhs */
- lval2.ConstVal *= PSizeOf (lhst);
+ lval2.ConstVal *= CheckedPSizeOf (lhst);
/* Operate on pointers, result type is a pointer */
flags = CF_PTR;
} else if (IsClassInt (lhst) && IsClassPtr (rhst)) {
/* Left is int, right is pointer, must scale lhs (ptr only) */
- g_scale (CF_INT | CF_CONST, PSizeOf (rhst));
+ g_scale (CF_INT | CF_CONST, CheckedPSizeOf (rhst));
/* Operate on pointers, result type is a pointer */
flags = CF_PTR;
lval->Type = lval2.Type;
/* Check for pointer arithmetic */
if (IsClassPtr (lhst) && IsClassInt (rhst)) {
/* Left is pointer, right is int, must scale rhs */
- g_scale (CF_INT, PSizeOf (lhst));
+ g_scale (CF_INT, CheckedPSizeOf (lhst));
/* Operate on pointers, result type is a pointer */
flags = CF_PTR;
} else if (IsClassInt (lhst) && IsClassPtr (rhst)) {
/* Left is int, right is pointer, must scale lhs */
g_tosint (TypeOf (rhst)); /* Make sure, TOS is int */
g_swap (CF_INT); /* Swap TOS and primary */
- g_scale (CF_INT, PSizeOf (rhst));
+ g_scale (CF_INT, CheckedPSizeOf (rhst));
/* Operate on pointers, result type is a pointer */
flags = CF_PTR;
lval->Type = lval2.Type;
/* Check for pointer arithmetic */
if (IsClassPtr (lhst) && IsClassInt (rhst)) {
/* Left is pointer, right is int, must scale rhs */
- lval->ConstVal -= lval2.ConstVal * PSizeOf (lhst);
+ lval->ConstVal -= lval2.ConstVal * CheckedPSizeOf (lhst);
/* Operate on pointers, result type is a pointer */
} else if (IsClassPtr (lhst) && IsClassPtr (rhst)) {
/* Left is pointer, right is pointer, must scale result */
if (TypeCmp (Indirect (lhst), Indirect (rhst)) < TC_QUAL_DIFF) {
Error ("Incompatible pointer types");
} else {
- lval->ConstVal = (lval->ConstVal - lval2.ConstVal) / PSizeOf (lhst);
+ lval->ConstVal = (lval->ConstVal - lval2.ConstVal) /
+ CheckedPSizeOf (lhst);
}
/* Operate on pointers, result type is an integer */
lval->Type = type_int;
if (IsClassPtr (lhst) && IsClassInt (rhst)) {
/* Left is pointer, right is int, must scale rhs */
- lval2.ConstVal *= PSizeOf (lhst);
+ lval2.ConstVal *= CheckedPSizeOf (lhst);
/* Operate on pointers, result type is a pointer */
flags = CF_PTR;
} else if (IsClassPtr (lhst) && IsClassPtr (rhst)) {
if (TypeCmp (Indirect (lhst), Indirect (rhst)) < TC_QUAL_DIFF) {
Error ("Incompatible pointer types");
} else {
- rscale = PSizeOf (lhst);
+ rscale = CheckedPSizeOf (lhst);
}
/* Operate on pointers, result type is an integer */
flags = CF_PTR;
/* Check for pointer arithmetic */
if (IsClassPtr (lhst) && IsClassInt (rhst)) {
/* Left is pointer, right is int, must scale rhs */
- g_scale (CF_INT, PSizeOf (lhst));
+ g_scale (CF_INT, CheckedPSizeOf (lhst));
/* Operate on pointers, result type is a pointer */
flags = CF_PTR;
} else if (IsClassPtr (lhst) && IsClassPtr (rhst)) {
if (TypeCmp (Indirect (lhst), Indirect (rhst)) < TC_QUAL_DIFF) {
Error ("Incompatible pointer types");
} else {
- rscale = PSizeOf (lhst);
+ rscale = CheckedPSizeOf (lhst);
}
/* Operate on pointers, result type is an integer */
flags = CF_PTR;
}
if (MustScale) {
/* lhs is a pointer, scale rhs */
- lval2.ConstVal *= SizeOf (lval->Type+1);
+ lval2.ConstVal *= CheckedSizeOf (lval->Type+1);
}
/* If the lhs is character sized, the operation may be later done
* with characters.
*/
- if (SizeOf (lval->Type) == 1) {
+ if (CheckedSizeOf (lval->Type) == 1) {
flags |= CF_FORCECHAR;
}
/* rhs is not constant and already in the primary register */
if (MustScale) {
/* lhs is a pointer, scale rhs */
- g_scale (TypeOf (lval2.Type), SizeOf (lval->Type+1));
+ g_scale (TypeOf (lval2.Type), CheckedSizeOf (lval->Type+1));
}
/* If the lhs is character sized, the operation may be later done
* with characters.
*/
- if (SizeOf (lval->Type) == 1) {
+ if (CheckedSizeOf (lval->Type) == 1) {
flags |= CF_FORCECHAR;
}
/* The resulting value is a constant. */
if (MustScale) {
/* lhs is a pointer, scale rhs */
- lval2.ConstVal *= SizeOf (lval->Type+1);
+ lval2.ConstVal *= CheckedSizeOf (lval->Type+1);
}
rflags |= CF_CONST;
lflags |= CF_CONST;
/* rhs is not constant and already in the primary register */
if (MustScale) {
/* lhs is a pointer, scale rhs */
- g_scale (TypeOf (lval2.Type), SizeOf (lval->Type+1));
+ g_scale (TypeOf (lval2.Type), CheckedSizeOf (lval->Type+1));
}
}
}
/* Load the size of the struct into the primary */
- g_getimmed (CF_INT | CF_UNSIGNED | CF_CONST, SizeOf (ltype), 0);
+ g_getimmed (CF_INT | CF_UNSIGNED | CF_CONST, CheckedSizeOf (ltype), 0);
/* Call the memcpy function */
g_call (CF_FIXARGC, "memcpy", 4);
PushAddr (lval);
/* No struct, setup flags for the load */
- flags = SizeOf (ltype) == 1? CF_FORCECHAR : CF_NONE;
+ flags = CheckedSizeOf (ltype) == 1? CF_FORCECHAR : CF_NONE;
/* Get the expression on the right of the '=' into the primary */
if (evalexpr (flags, hie1, &lval2) == 0) {