* plugin/m2rte.cc: Further reformatting of comments.
* gm2-gcc/m2statement.cc: Corrected comment formatting and
removed usused debugging code.
+ * gm2-gcc/m2assert.cc: Corrected comment formatting.
+ * gm2-gcc/m2block.cc: Corrected comment formatting.
+ * gm2-gcc/m2builtins.cc: Corrected comment formatting.
+ * gm2-gcc/m2convert.cc: Corrected comment formatting.
+ * gm2-gcc/m2decl.cc: Corrected comment formatting.
+ * gm2-gcc/m2except.cc: Corrected comment formatting.
+ * gm2-gcc/m2expr.cc: Corrected comment formatting.
+ * gm2-gcc/m2linemap.cc: Corrected comment formatting.
+ * gm2-gcc/m2statement.cc: Corrected comment formatting.
+ * gm2-gcc/m2treelib.cc: Corrected comment formatting.
+ * gm2-gcc/m2type.cc: Corrected comment formatting.
+ * gm2-gcc/rtegraph.cc: Corrected comment formatting.
2022-05-16 Gaius Mulley <gaius.mulley@southwales.ac.uk>
void
m2assert_AssertLocation (location_t location)
{
- /* internally the compiler will use unknown location and
+ /* Internally the compiler will use unknown location and
builtins_location so we ignore these values. */
if (location == BUILTINS_LOCATION || location == UNKNOWN_LOCATION)
return;
init_binding_level (newlevel);
- /* now we a push_statement_list. */
+ /* Now we a push_statement_list. */
vec_safe_push (newlevel->m2_statements, m2block_begin_statement_list ());
return newlevel;
}
tree
m2block_end_statement_list (tree t)
{
- /* should we do anything with, t? Specifically we may need to test
- for the presence of a label --fixme-- check this */
+ /* Should we do anything with, t? Specifically we may need to test
+ for the presence of a label --fixme-- check this. */
return t;
}
printf ("pushFunctionScope\n");
#endif
- /* allow multiple consecutive pushes of the same scope. */
+ /* Allow multiple consecutive pushes of the same scope. */
if (current_binding_level != NULL
&& (current_binding_level->fndecl == fndecl))
return;
}
- /* firstly check to see that fndecl is not already on the binding
+ /* Firstly check to see that fndecl is not already on the binding
stack. */
for (b = current_binding_level; b != NULL; b = b->next)
- /* only allowed one instance of the binding on the stack at a time. */
+ /* Only allowed one instance of the binding on the stack at a time. */
ASSERT_CONDITION (b->fndecl != fndecl);
n = findLevel (fndecl);
if (current_binding_level->count > 0)
{
- /* multiple pushes have occurred of the same function scope (and
+ /* Multiple pushes have occurred of the same function scope (and
ignored), pop them likewise. */
current_binding_level->count--;
return fndecl;
}
ASSERT_CONDITION (current_binding_level->fndecl
- != NULL_TREE); /* expecting local scope. */
+ != NULL_TREE); /* Expecting local scope. */
ASSERT_CONDITION (current_binding_level->constants
- == NULL_TREE); /* should not be used. */
+ == NULL_TREE); /* Should not be used. */
ASSERT_CONDITION (current_binding_level->names
- == NULL_TREE); /* should be cleared. */
+ == NULL_TREE); /* Should be cleared. */
ASSERT_CONDITION (current_binding_level->decl
- == NULL_TREE); /* should be cleared. */
+ == NULL_TREE); /* Should be cleared. */
current_binding_level = current_binding_level->next;
return fndecl;
m2block_popGlobalScope (void)
{
ASSERT_CONDITION (
- current_binding_level->is_global); /* expecting global scope. */
+ current_binding_level->is_global); /* Expecting global scope. */
ASSERT_CONDITION (current_binding_level == global_binding_level);
if (current_binding_level->count > 0)
tree return_node;
};
-/* entries are added by examining gcc/builtins.def and copying those
+/* Entries are added by examining gcc/builtins.def and copying those
functions which can be applied to Modula-2. */
static struct builtin_function_entry list_of_builtins[] = {
{ "__builtin_scalbnl", BT_FN_LONG_DOUBLE_LONG_DOUBLE_INT, BUILT_IN_SCALBNL,
BUILT_IN_NORMAL, "scalblnl", NULL, NULL },
- /* complex intrinsic functions. */
+ /* Complex intrinsic functions. */
{ "__builtin_cabs", BT_FN_DOUBLE_DCOMPLEX, BUILT_IN_CABS, BUILT_IN_NORMAL,
"cabs", NULL, NULL },
{ "__builtin_cabsf", BT_FN_FLOAT_FCOMPLEX, BUILT_IN_CABSF, BUILT_IN_NORMAL,
static GTY (()) tree floatptr_type_node;
static GTY (()) tree builtin_ftype_int_var;
-/* prototypes for locally defined functions. */
+/* Prototypes for locally defined functions. */
static tree DoBuiltinAlloca (location_t location, tree n);
static tree DoBuiltinMemCopy (location_t location, tree dest, tree src,
tree n);
static tree doexception (location_t location, tree type);
static tree doextend (location_t location, tree type);
static tree donModes (location_t location, tree type);
-/* prototypes finish here. */
+/* Prototypes finish here. */
#define m2builtins_c
#include "m2builtins.h"
}
/* BuiltInIsfinite - return integer 1 if the real expression is
- finite. return integer 0 if it is not finite. */
+ finite otherwise return integer 0. */
tree
m2builtins_BuiltInIsfinite (location_t location, tree expression)
enum conversion_safety
unsafe_conversion_p (location_t loc, tree type, tree expr, bool produce_warns)
{
- enum conversion_safety give_warning = SAFE_CONVERSION; /* is 0 or false. */
+ enum conversion_safety give_warning = SAFE_CONVERSION; /* Is 0 or false. */
tree expr_type = TREE_TYPE (expr);
if (TREE_CODE (expr) == REAL_CST || TREE_CODE (expr) == INTEGER_CST)
/* (Taken from c-common.cc and trimmed for Modula-2)
-Warns if the conversion of EXPR to TYPE may alter a value. This is a
- helper function for warnings_for_convert_and_check. */
+ Warns if the conversion of EXPR to TYPE may alter a value. This is
+ a helper function for warnings_for_convert_and_check. */
static void
conversion_warning (location_t loc, tree type, tree expr)
case TRUTH_NOT_EXPR:
/* Conversion from boolean to a signed:1 bit-field (which only can
- hold the values 0 and -1) doesn't lose information - but it does
- change the value. */
+ hold the values 0 and -1) doesn't lose information - but it does
+ change the value. */
if (TYPE_PRECISION (type) == 1 && !TYPE_UNSIGNED (type))
warning_at (loc, OPT_Wconversion,
"conversion to %qT from boolean expression", type);
{
/* In case of COND_EXPR, we do not care about the type of COND_EXPR,
- only about the conversion of each operand. */
+ only about the conversion of each operand. */
tree op1 = TREE_OPERAND (expr, 1);
tree op2 = TREE_OPERAND (expr, 2);
return;
}
- default: /* 'expr' is not a constant. */
+ default: /* 'expr' is not a constant. */
conversion_kind = unsafe_conversion_p (loc, type, expr, true);
if (conversion_kind == UNSAFE_REAL)
warning_at (loc, OPT_Wfloat_conversion,
{
/* Do not diagnose overflow in a constant expression merely because a
- conversion overflowed. */
+ conversion overflowed. */
if (TREE_OVERFLOW (result))
TREE_OVERFLOW (result) = TREE_OVERFLOW (expr);
if (TYPE_UNSIGNED (type))
{
- /* This detects cases like converting -129 or 256 to unsigned char.
- */
+ /* This detects cases like converting -129 or 256 to unsigned
+ char. */
if (!int_fits_type_p (expr, m2type_gm2_signed_type (type)))
warning_at (loc, OPT_Woverflow,
"large integer implicitly truncated to unsigned type");
tree expr_for_warning;
/* Convert from a value with possible excess precision rather than
- via the semantic type, but do not warn about values not fitting
- exactly in the semantic type. */
+ via the semantic type, but do not warn about values not fitting
+ exactly in the semantic type. */
if (TREE_CODE (expr) == EXCESS_PRECISION_EXPR)
{
tree orig_type = TREE_TYPE (expr);
tree value_type = m2tree_skip_type_decl (TREE_TYPE (value));
if (value_type == type)
- /* we let the caller deal with this. */
+ /* We let the caller deal with this. */
return FALSE;
if ((TREE_CODE (value) == INTEGER_CST) && (type == generic_type))
nul[0] = (char)0;
- /* store the initial char. */
+ /* Store the initial char. */
m2type_BuildArrayConstructorElement (c, value, i);
i = m2expr_BuildAdd (location, i, m2decl_BuildIntegerConstant (1), FALSE);
- /* now pad out the remaining elements with nul chars. */
+ /* Now pad out the remaining elements with nul chars. */
while (m2expr_CompareTrees (i, n) < 0)
{
m2type_BuildArrayConstructorElement (
{
if (TREE_TYPE (value) == m2type_GetM2CharType ())
- /* passing a const char to an array [..] of char. So we convert
+ /* Passing a const char to an array [..] of char. So we convert
const char into the correct length string. */
return convert_char_to_array (location, type, value);
if (TREE_CODE (value) == STRING_CST)
- /* convert a string into an array constant, padding with zeros if
+ /* Convert a string into an array constant, padding with zeros if
necessary. */
return convert_string_to_array (location, type, value);
}
/* Used in BuildStartFunctionType. */
static GTY (()) tree param_type_list;
-static GTY (()) tree param_list = NULL_TREE; /* ready for the next time we
+static GTY (()) tree param_list = NULL_TREE; /* Ready for the next time we
call/define a function. */
/* DeclareKnownVariable - declares a variable in scope, funcscope.
tree
m2decl_DeclareKnownConstant (location_t location, tree type, tree value)
{
- tree id = make_node (IDENTIFIER_NODE); /* ignore the name of the constant. */
+ tree id = make_node (IDENTIFIER_NODE); /* Ignore the name of the constant. */
tree decl;
m2assert_AssertLocation (location);
param_type_list = NULL_TREE;
else
param_type_list = tree_cons (NULL_TREE, void_type_node, NULL_TREE);
- param_list = NULL_TREE; /* ready for when we define a function. */
+ param_list = NULL_TREE; /* Ready for when we define a function. */
}
/* BuildEndFunctionDeclaration - build a function which will return a
ASSERT_BOOL (isnested);
ASSERT_BOOL (ispublic);
returntype = m2tree_skip_type_decl (returntype);
- /* the function type depends on the return type and type of args,
+ /* The function type depends on the return type and type of args,
both of which we have created in BuildParameterDeclaration */
if (returntype == NULL_TREE)
returntype = void_type_node;
rest_of_decl_compilation (fndecl, 1, 0);
param_list
- = NULL_TREE; /* ready for the next time we call/define a function. */
+ = NULL_TREE; /* Ready for the next time we call/define a function. */
return fndecl;
}
"Please report this crash to the GNU Modula-2 mailing list " \
"<gm2@nongnu.org>\n"
-/* external functions. */
+/* External functions. */
#define m2except_c
#include "m2assert.h"
#include "m2treelib.h"
#include "m2type.h"
-/* local prototypes. */
+/* Local prototypes. */
#include "m2except.h"
void _M2_gm2except_init (void);
void _M2_gm2except_finally (void);
-/* exception handling library functions. */
+/* Exception handling library functions. */
static GTY (()) tree fn_begin_catch_tree = NULL_TREE;
static GTY (()) tree fn_end_catch_tree = NULL_TREE;
location, location, "__cxa_free_exception", ptr_type_node, TRUE, FALSE,
TRUE);
- /* define integer type exception type which will match C++ int type
+ /* Define integer type exception type which will match C++ int type
in the C++ runtime library. */
gm2_eh_int_type = build_eh_type_type (location, integer_type_node);
m2block_popGlobalScope ();
m2assert_AssertLocation (location);
if (exp == NULL_TREE)
- /* rethrow the current exception. */
+ /* Rethrow the current exception. */
exp = build1 (THROW_EXPR, void_type_node, do_rethrow (location));
else
{
TRY_HANDLERS (try_block) = m2block_begin_statement_list ();
- /* now ensure that all successive add_stmts adds to this statement
+ /* Now ensure that all successive add_stmts adds to this statement
sequence. */
m2block_push_statement_list (TRY_HANDLERS (try_block));
}
HANDLER_BODY (r) = m2block_begin_statement_list ();
- /* now ensure that all successive add_stmts adds to this
+ /* Now ensure that all successive add_stmts adds to this
statement sequence. */
m2block_push_statement_list (HANDLER_BODY (r));
return r;
static void
finish_handler (location_t location, tree handler)
{
- /* we might need to rethrow the exception if we reach the end.
+ /* We might need to rethrow the exception if we reach the end.
use this code: finish_expr_stmt (build_throw (NULL_TREE)); */
tree body = m2block_pop_statement_list ();
finish_handler_parms (location_t location, tree handler)
{
m2assert_AssertLocation (location);
- /* equivalent to C++ catch (...). */
+ /* Equivalent to C++ catch (...). */
finish_expr_stmt (location, do_begin_catch (location));
HANDLER_TYPE (handler) = NULL_TREE;
m2assert_AssertLocation (location);
TRY_STMTS (r) = m2block_begin_statement_list ();
- /* now ensure that all successive add_stmts adds to this statement
+ /* Now ensure that all successive add_stmts adds to this statement
sequence. */
m2block_push_statement_list (TRY_STMTS (r));
return r;
static tree
maybe_cleanup_point_expr_void (tree expr)
{
- /* if (stmts_are_full_exprs_p ()). */
return fold_build_cleanup_point_expr (void_type_node, expr);
}
#include "../m2-tree.h"
#include "m2convert.h"
-/* prototypes. */
+/* Prototypes. */
#define m2expr_c
#include "m2assert.h"
m2assert_AssertLocation (location);
- /* ensure we wrap the rotate. */
+ /* Ensure we wrap the rotate. */
op2min = m2expr_BuildModTrunc (
location, m2convert_ToCardinal (location, op2),
m2convert_ToCardinal (location, nBits), needconvert);
- /* optimize if we are we going to rotate a TSIZE(BITSET) set. */
+ /* Optimize if we are we going to rotate a TSIZE(BITSET) set. */
if (m2expr_CompareTrees (
m2decl_BuildIntegerConstant (m2decl_GetBitsPerBitset ()), nBits)
tree mask = m2expr_BuildMask (location, nBits, needconvert);
tree left, right;
- /* make absolutely sure there are no high order bits lying around. */
+ /* Make absolutely sure there are no high order bits lying around. */
op1 = m2expr_BuildLogicalAnd (location, op1, mask, needconvert);
left = m2expr_BuildLSL (location, op1, op2min, needconvert);
m2assert_AssertLocation (location);
- /* ensure we wrap the rotate. */
+ /* Ensure we wrap the rotate. */
op2min = m2expr_BuildModTrunc (
location, m2convert_ToCardinal (location, op2),
m2convert_ToCardinal (location, nBits), needconvert);
- /* optimize if we are we going to rotate a TSIZE(BITSET) set. */
+ /* Optimize if we are we going to rotate a TSIZE(BITSET) set. */
if (m2expr_CompareTrees (
m2decl_BuildIntegerConstant (m2decl_GetBitsPerBitset ()), nBits)
tree mask = m2expr_BuildMask (location, nBits, needconvert);
tree left, right;
- /* make absolutely sure there are no high order bits lying around. */
+ /* Make absolutely sure there are no high order bits lying around. */
op1 = m2expr_BuildLogicalAnd (location, op1, mask, needconvert);
right = m2expr_BuildLSR (location, op1, op2min, needconvert);
if (m2expr_CompareTrees (
size, m2decl_BuildIntegerConstant (SET_WORD_SIZE / BITS_PER_UNIT))
<= 0)
- /* small set size <= TSIZE(WORD). */
+ /* Small set size <= TSIZE(WORD). */
(*binop) (location,
m2treelib_get_rvalue (location, op1, settype, is_op1lvalue),
m2treelib_get_rvalue (location, op2, settype, is_op2lvalue),
FALSE)),
m2expr_GetCardinalOne (location), FALSE);
- /* if op3 is constant then make op3 positive and remember which
+ /* If op3 is constant then make op3 positive and remember which
direction we are shifting. */
op3 = m2tree_skip_const_decl (op3);
op3, FALSE);
}
- /* these parameters must match the prototypes of the procedures:
+ /* These parameters must match the prototypes of the procedures:
ShiftLeft, ShiftRight, ShiftVal, RotateLeft, RotateRight, RotateVal
inside gm2-iso/SYSTEM.mod. */
/* Remember we must build the parameters in reverse. */
- /* parameter 4 amount. */
+ /* Parameter 4 amount. */
m2statement_BuildParam (
location,
m2convert_BuildConvert (
is_op3lvalue),
FALSE));
- /* parameter 3 nBits. */
+ /* Parameter 3 nBits. */
m2statement_BuildParam (
location,
m2convert_BuildConvert (location, m2type_GetM2CardinalType (),
m2expr_FoldAndStrip (nBits), FALSE));
- /* parameter 2 destination set. */
+ /* Parameter 2 destination set. */
m2statement_BuildParam (
location,
buildUnboundedArrayOf (
unbounded,
m2treelib_get_set_address (location, op1, is_op1lvalue), high));
- /* parameter 1 source set. */
+ /* Parameter 1 source set. */
m2statement_BuildParam (
location,
buildUnboundedArrayOf (
unbounded,
m2treelib_get_set_address (location, op2, is_op2lvalue), high));
- /* now call the appropriate procedure inside SYSTEM.mod. */
+ /* Now call the appropriate procedure inside SYSTEM.mod. */
if (is_const)
if (is_left)
result = m2statement_BuildProcedureCallTree (location, leftproc,
else if (m2expr_CompareTrees (max, m2expr_GetIntegerZero (location)) == -1)
/* max is less than zero therefore value will always be < 0. */
return m2expr_GetIntegerOne (location);
- /* we now know 0 lies in the range min..max so we can safely cast
+ /* We now know 0 lies in the range min..max so we can safely cast
zero to type. */
return m2expr_BuildLessThan (
location, value,
/* max is less than or equal to zero therefore value will always be
<= 0. */
return m2expr_GetIntegerZero (location);
- /* we now know 0 lies in the range min..max so we can safely cast
+ /* We now know 0 lies in the range min..max so we can safely cast
zero to type. */
return m2expr_BuildGreaterThan (
location, value,
/* max is less than or equal to zero therefore value will always be <
0. */
return m2expr_GetIntegerZero (location);
- /* we now know 0 lies in the range min..max so we can safely cast
+ /* We now know 0 lies in the range min..max so we can safely cast
zero to type. */
return m2expr_BuildEqualTo (
location, value,
/* max is less than or equal to zero therefore value will always be
true. */
return m2expr_GetIntegerOne (location);
- /* we now know 0 lies in the range min..max so we can safely cast
+ /* We now know 0 lies in the range min..max so we can safely cast
zero to type. */
return m2expr_BuildNotEqualTo (
location, value,
else if (m2expr_CompareTrees (max, m2expr_GetIntegerZero (location)) < 0)
/* max is less than zero therefore value will always be < 0. */
return m2expr_GetIntegerZero (location);
- /* we now know 0 lies in the range min..max so we can safely cast
+ /* We now know 0 lies in the range min..max so we can safely cast
zero to type. */
return m2expr_BuildGreaterThan (
location, value,
else if (m2expr_CompareTrees (max, m2expr_GetIntegerZero (location)) <= 0)
/* max is less than or equal to zero therefore value will always be <= 0. */
return m2expr_GetIntegerOne (location);
- /* we now know 0 lies in the range min..max so we can safely cast
+ /* We now know 0 lies in the range min..max so we can safely cast
zero to type. */
return m2expr_BuildLessThanOrEqual (
location, value,
PROCEDURE divtruncexpr (a, b: INTEGER) : BOOLEAN ;
BEGIN
- (* firstly catch division by 0. *)
+ (* Firstly catch division by 0. *)
RETURN ((b = 0) OR
- (* case 2 range is always negative. *)
- (* in which case a division will be illegal as result will be positive. *)
+ (* Case 2 range is always negative. *)
+ (* In which case a division will be illegal as result will be positive. *)
(max < 0) OR
- (* case 1 both min / max are positive, check for underflow. *)
+ (* Case 1 both min / max are positive, check for underflow. *)
((min >= 0) AND (max >= 0) AND (multMinOverflow (b) OR (a < b * min))) OR
- (* case 1 both min / max are positive, check for overflow. *)
+ (* Case 1 both min / max are positive, check for overflow. *)
((min >= 0) AND (max >= 0) AND (divMinUnderflow (a) OR (b > a DIV min))) OR
- (* case 3 mixed range, need to check underflow. *)
+ (* Case 3 mixed range, need to check underflow. *)
((min < 0) AND (max >= 0) AND (a < 0) AND (b < 0) AND (b >= a DIV min)) OR
((min < 0) AND (max >= 0) AND (a < 0) AND (b > 0) AND (b <= a DIV max)) OR
((min < 0) AND (max >= 0) AND (a >= 0) AND (b < 0) AND (a DIV b < min)))
i, j, lowest, min, max));
if (M2Options_GetISO ())
- /* ISO Modula-2 raises an exception if the right hand operand is < 0. */
+ /* ISO Modula-2 raises an exception if the right hand operand is < 0. */
j_lt_zero = m2expr_FoldAndStrip (m2expr_BuildLessThanZero (location, j, lowest, min, max));
else
j_lt_zero = m2expr_GetIntegerZero (location);
m2expr_FoldAndStrip (op2));
}
-/* BuildNegateCheck builds a negate tree. */
+/* BuildNegateCheck builds a negate tree. */
tree
m2expr_BuildNegateCheck (location_t location, tree arg, tree lowest, tree min,
return m2expr_build_binary_op (location, MULT_EXPR, op1, op2, needconvert);
}
-/* BuildMultCheck builds a multiplication tree. */
+/* BuildMultCheck builds a multiplication tree. */
tree
m2expr_BuildMultCheck (location_t location, tree op1, tree op2, tree lowest,
}
/* boolean_enum_to_unsigned convert a BOOLEAN_TYPE, t, or
-ENUMERAL_TYPE to an unsigned type. */
+ ENUMERAL_TYPE to an unsigned type. */
static tree
boolean_enum_to_unsigned (location_t location, tree t)
{
m2assert_AssertLocation (location);
if (m2tree_skip_type_decl (TREE_TYPE (op)) == badType)
- /* cannot compare array contents in m2expr_build_binary_op. */
+ /* Cannot compare array contents in m2expr_build_binary_op. */
return m2expr_BuildIndirect (
location, m2expr_BuildAddr (location, op, FALSE), goodType);
return op;
if (m2expr_CompareTrees (
size, m2decl_BuildIntegerConstant (SET_WORD_SIZE / BITS_PER_UNIT))
<= 0)
- /* small set size <= TSIZE(WORD). */
+ /* Small set size <= TSIZE(WORD). */
m2treelib_do_jump_if_bit (
location, NE_EXPR,
m2treelib_get_rvalue (location, varset, type, is_lvalue), constel,
if (m2expr_CompareTrees (
size, m2decl_BuildIntegerConstant (SET_WORD_SIZE / BITS_PER_UNIT))
<= 0)
- /* small set size <= TSIZE(WORD). */
+ /* Small set size <= TSIZE(WORD). */
m2treelib_do_jump_if_bit (
location, EQ_EXPR,
m2treelib_get_rvalue (location, varset, type, is_lvalue), constel,
tree high ATTRIBUTE_UNUSED, char *label)
{
tree size = m2expr_GetSizeOf (location, type);
- /* calculate the index from the first bit, ie bit 0 represents low value. */
+ /* Calculate the index from the first bit, ie bit 0 represents low value. */
tree index = m2expr_BuildSub (
location, m2convert_BuildConvert (location, m2type_GetIntegerType (),
varel, FALSE),
if (m2expr_CompareTrees (
size, m2decl_BuildIntegerConstant (SET_WORD_SIZE / BITS_PER_UNIT))
<= 0)
- /* small set size <= TSIZE(WORD). */
+ /* Small set size <= TSIZE(WORD). */
m2treelib_do_jump_if_bit (
location, NE_EXPR,
m2treelib_get_rvalue (location, varset, type, is_lvalue), index,
else
{
tree p1 = m2treelib_get_set_address (location, varset, is_lvalue);
- /* which word do we need to fetch? */
+ /* Which word do we need to fetch? */
tree word_index = m2expr_FoldAndStrip (m2expr_BuildDivTrunc (
location, index, m2decl_BuildIntegerConstant (SET_WORD_SIZE),
FALSE));
- /* calculate the bit in this word. */
+ /* Calculate the bit in this word. */
tree offset_into_word = m2expr_FoldAndStrip (m2expr_BuildModTrunc (
location, index, m2decl_BuildIntegerConstant (SET_WORD_SIZE),
FALSE));
location, word_index,
m2decl_BuildIntegerConstant (SET_WORD_SIZE / BITS_PER_UNIT), FALSE));
- /* calculate the address of the word we are interested in. */
+ /* Calculate the address of the word we are interested in. */
p1 = m2expr_BuildAddAddress (location,
m2convert_convertToPtr (location, p1), p2);
- /* fetch the word, extract the bit and test for != 0. */
+ /* Fetch the word, extract the bit and test for != 0. */
m2treelib_do_jump_if_bit (
location, NE_EXPR,
m2expr_BuildIndirect (location, p1, m2type_GetBitsetType ()),
tree high ATTRIBUTE_UNUSED, char *label)
{
tree size = m2expr_GetSizeOf (location, type);
- /* calculate the index from the first bit, ie bit 0 represents low value. */
+ /* Calculate the index from the first bit, ie bit 0 represents low value. */
tree index = m2expr_BuildSub (
location, m2convert_BuildConvert (location, m2type_GetIntegerType (),
m2expr_FoldAndStrip (varel), FALSE),
if (m2expr_CompareTrees (
size, m2decl_BuildIntegerConstant (SET_WORD_SIZE / BITS_PER_UNIT))
<= 0)
- /* small set size <= TSIZE(WORD). */
+ /* Small set size <= TSIZE(WORD). */
m2treelib_do_jump_if_bit (
location, EQ_EXPR,
m2treelib_get_rvalue (location, varset, type, is_lvalue), index,
else
{
tree p1 = m2treelib_get_set_address (location, varset, is_lvalue);
- /* calculate the index from the first bit. */
+ /* Calculate the index from the first bit. */
- /* which word do we need to fetch? */
+ /* Which word do we need to fetch? */
tree word_index = m2expr_FoldAndStrip (m2expr_BuildDivTrunc (
location, index, m2decl_BuildIntegerConstant (SET_WORD_SIZE),
FALSE));
- /* calculate the bit in this word. */
+ /* Calculate the bit in this word. */
tree offset_into_word = m2expr_FoldAndStrip (m2expr_BuildModTrunc (
location, index, m2decl_BuildIntegerConstant (SET_WORD_SIZE),
FALSE));
location, word_index,
m2decl_BuildIntegerConstant (SET_WORD_SIZE / BITS_PER_UNIT), FALSE));
- /* calculate the address of the word we are interested in. */
+ /* Calculate the address of the word we are interested in. */
p1 = m2expr_BuildAddAddress (location, p1, p2);
- /* fetch the word, extract the bit and test for == 0. */
+ /* Fetch the word, extract the bit and test for == 0. */
m2treelib_do_jump_if_bit (
location, EQ_EXPR,
m2expr_BuildIndirect (location, p1, m2type_GetBitsetType ()),
m2convert_BuildConvert (location, TREE_TYPE (op2),
m2expr_GetIntegerZero (location), FALSE));
- /* return the result of the modulus. */
+ /* Return the result of the modulus. */
return fold_build3 (COND_EXPR, TREE_TYPE (op1), cond,
/* op2 < 0. */
m2expr_BuildModCeilCheck (location, op1, op2, lowest, min, max),
if (m2expr_CompareTrees (
size, m2decl_BuildIntegerConstant (SET_WORD_SIZE / BITS_PER_UNIT))
<= 0)
- /* small set size <= TSIZE(WORD). */
+ /* Small set size <= TSIZE(WORD). */
m2statement_BuildAssignmentTree (
location, m2treelib_get_rvalue (location, op1, type, is_op1lvalue),
(*binop) (
m2treelib_get_rvalue (location, op3, type, is_op3lvalue), FALSE));
else
{
- /* large set size > TSIZE(WORD). */
+ /* Large set size > TSIZE(WORD). */
tree p2 = m2treelib_get_set_address_if_var (location, op2, is_op2lvalue,
is_op2const);
else
{
overflow = append_digit (low, high, c, base);
- max = 0; /* from now on we always use append_digit. */
+ max = 0; /* From now on we always use append_digit. */
}
}
}
else
{
overflow = append_m2_digit (low, high, c, base);
- max = 0; /* from now on we always use append_digit. */
+ max = 0; /* From now on we always use append_digit. */
}
}
}
#include "gcc-consolidation.h"
-/* utilize some of the C build routines */
+/* Utilize some of the C build routines */
#include "../gm2-lang.h"
#include "../m2-tree.h"
location_t
m2linemap_GetLocationBinary (location_t caret, location_t start, location_t finish)
{
-#if 1
if (isSrcLocation (start) && isSrcLocation (finish) && isSrcLocation (caret)
&& (m2linemap_GetFilenameFromLocation (start) != NULL))
{
linemap_add (line_table, LC_ENTER, false, xstrdup (m2linemap_GetFilenameFromLocation (start)), 1);
gcc_assert (inFile);
location_t location = make_location (caret, start, finish);
- /* error_at (location, "testing here"); */
return location;
}
-#endif
return caret;
}
#include "../gm2-lang.h"
#include "../m2-tree.h"
-/* prototypes. */
+/* Prototypes. */
#define m2statement_c
#include "m2assert.h"
#include "m2treelib.h"
#include "m2type.h"
-static GTY (()) tree param_list = NULL_TREE; /* ready for the next time we
+static GTY (()) tree param_list = NULL_TREE; /* Ready for the next time we
call/define a function. */
static GTY (()) tree last_function = NULL_TREE;
/* Begin the statement tree for this function. */
DECL_SAVED_TREE (fndecl) = NULL_TREE;
- /* set the context of these parameters to this function. */
+ /* Set the context of these parameters to this function. */
for (param_decl = DECL_ARGUMENTS (fndecl); param_decl;
param_decl = TREE_CHAIN (param_decl))
DECL_CONTEXT (param_decl) = fndecl;
gm2_gimplify_function_node (tree fndecl)
{
/* Convert all nested functions to GIMPLE now. We do things in this
- order so that items like VLA sizes are expanded properly in the
- context of the correct function. */
+ order so that items like VLA sizes are expanded properly in the
+ context of the correct function. */
struct cgraph_node *cgn;
dump_function (TDI_original, fndecl);
m2assert_AssertLocation (location);
ASSERT_CONDITION (
last_function
- == NULL_TREE); /* previous function value has not been collected. */
+ == NULL_TREE); /* Previous function value has not been collected. */
TREE_USED (procedure) = TRUE;
for (i = 0; i < n; i++)
#endif
param_list
- = NULL_TREE; /* ready for the next time we call a procedure. */
+ = NULL_TREE; /* Ready for the next time we call a procedure. */
last_function = NULL_TREE;
return call;
}
TREE_USED (last_function) = TRUE;
TREE_SIDE_EFFECTS (last_function) = TRUE;
param_list
- = NULL_TREE; /* ready for the next time we call a procedure. */
+ = NULL_TREE; /* Ready for the next time we call a procedure. */
return last_function;
}
}
m2assert_AssertLocation (location);
/* ASM statements without outputs, including simple ones, are treated
- as volatile. */
+ as volatile. */
ASM_INPUT_P (args) = isSimple;
ASM_VOLATILE_P (args) = isVolatile;
always has the same type as the LHS argument. */
ASSERT_CONDITION (olhstype == TREE_TYPE (result));
- /* in Modula-2 I'm assuming this will be true this maybe wrong, but
+ /* In Modula-2 I'm assuming this will be true this maybe wrong, but
at least I'll know about it soon. If true then we do not need to
implement convert_for_assignment - which is a huge win. */
struct GTY (()) struct_constructor
{
- /* constructor_type, the type that we are constructing. */
+ /* Constructor_type, the type that we are constructing. */
tree GTY ((skip (""))) constructor_type;
- /* constructor_fields, the list of fields belonging to
+ /* Constructor_fields, the list of fields belonging to
constructor_type. Used by SET and RECORD constructors. */
tree GTY ((skip (""))) constructor_fields;
- /* constructor_element_list, the list of constants used by SET and
+ /* Constructor_element_list, the list of constants used by SET and
RECORD constructors. */
tree GTY ((skip (""))) constructor_element_list;
- /* constructor_elements, used by an ARRAY initializer all elements
+ /* Constructor_elements, used by an ARRAY initializer all elements
are held in reverse order. */
vec<constructor_elt, va_gc> *constructor_elements;
- /* level, the next level down in the constructor stack. */
+ /* Level, the next level down in the constructor stack. */
struct struct_constructor *level;
};
ASSERT_CONDITION (index_type != NULL_TREE);
if (elt_type == NULL_TREE)
{
- /* cannot use GCC canonicalization routines yet, so we use our front
+ /* Cannot use GCC canonicalization routines yet, so we use our front
end version based on the front end type. */
return gm2_canonicalize_array (index_type, type);
}
}
/* ValueInTypeRange returns TRUE if the constant, value, lies within
-the range of, type. */
+ the range of, type. */
int
m2type_ValueInTypeRange (tree type, tree value)
}
/* ValueOutOfTypeRange returns TRUE if the constant, value, exceeds
-the range of, type. */
+ the range of, type. */
int
m2type_ValueOutOfTypeRange (tree type, tree value)
return m2_iso_loc_type_node;
}
-/* --fixme-- section check these gaius - the function names are misleading
- * --fixme-- once the compiler is building correctly. */
/* GetWordType - return the C unsigned data type. */
tree
return long_double_type_node;
}
-/* GetRealType - */
+/* GetRealType - returns the C double_type_node. */
tree
m2type_GetRealType (void)
{
return double_type_node;
}
-/* end of --fixme-- section. */
/* GetBitnumType - return the ISO bitnum type. */
}
/* Output the assembler code and/or RTL code for variables and
- functions, unless the type is an undefined structure or union. If
- not, it will get done when the type is completed. */
+ functions, unless the type is an undefined structure or union. If
+ not, it will get done when the type is completed. */
if (TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == FUNCTION_DECL)
{
|| DECL_INITIAL (decl) == error_mark_node)
/* Don't output anything when a tentative file-scope definition is
- seen. But at end of compilation, do output code for them. */
+ seen. But at end of compilation, do output code for them. */
DECL_DEFER_OUTPUT (decl) = 1;
rest_of_decl_compilation (decl, true, 0);
}
{
/* Recompute the RTL of a local array now if it used to be an
- incomplete type. */
+ incomplete type. */
if (was_incomplete && !TREE_STATIC (decl) && !DECL_EXTERNAL (decl))
{
/* If we used it already as memory, it must stay in memory. */
m2assert_AssertLocation (location);
/* Define `WORD' as specified in ISO m2
-WORD = ARRAY [0..SizeOfWord / SizeOfLoc] OF LOC ; */
+ WORD = ARRAY [0..SizeOfWord / SizeOfLoc] OF LOC ; */
if (m2decl_GetBitsPerInt () == BITS_PER_UNIT)
c = m2type_GetISOLocType ();
/* Define `BYTE' as specified in ISO m2
-BYTE = ARRAY [0..SizeOfByte / SizeOfLoc] OF LOC ; */
+ BYTE = ARRAY [0..SizeOfByte / SizeOfLoc] OF LOC ; */
if (BITS_PER_UNIT == 8)
c = m2type_GetISOLocType ();
return build_m2_specific_size_type (location, INTEGER_TYPE, bits, FALSE);
}
-/* InitBaseTypes - */
+/* InitBaseTypes create the Modula-2 base types. */
void
m2type_InitBaseTypes (location_t location)
/* BuildStartType - given a, type, with a, name, return a GCC
declaration of this type. TYPE name = foo ;
-the type, foo, maybe a partially created type (which has yet to be
- 'gm2_finish_decl'ed. */
+ the type, foo, maybe a partially created type (which has
+ yet to be 'gm2_finish_decl'ed). */
tree
m2type_BuildStartType (location_t location, char *name, tree type)
m2type_BuildTypeDeclaration (location, TREE_TYPE (type));
m2block_pushDecl (
build_stmt (location, DECL_EXPR,
- type)); /* is this safe? --fixme-- gaius got here. */
+ type)); /* Is this safe? --fixme--. */
}
-
-#if 0
- add_stmt (build_stmt (location, DECL_EXPR, type));
- add_stmt (build_stmt (location, DECL_EXPR, build_decl (location, TYPE_DECL, NULL, type)));
-#endif
}
/* Begin compiling the definition of an enumeration type. NAME is
IDENTIFIER_POINTER (name));
/* Completely replace its old definition. The old enumerators remain
- defined, however. */
+ defined, however. */
TYPE_VALUES (enumtype) = 0;
}
tree gccenum = gm2_build_enumerator (location, id, copy_of_value);
m2assert_AssertLocation (location);
- /* choose copy_of_value for enum value. */
+ /* Choose copy_of_value for enum value. */
*enumvalues = chainon (gccenum, *enumvalues);
return copy_of_value;
}
if ((name != NULL) && (strcmp (name, "") != 0))
{
- /* declared as TYPE foo = [x..y]; */
+ /* Declared as TYPE foo = [x..y]; */
range_type = m2type_DeclareKnownType (location, name, range_type);
layout_type (m2tree_skip_type_decl (range_type));
}
else
id = get_identifier (name);
- TYPE_PACKED (s) = FALSE; /* this is set TRUE later if necessary. */
+ TYPE_PACKED (s) = FALSE; /* This maybe set TRUE later if necessary. */
m2block_pushDecl (build_decl (location, TYPE_DECL, id, s));
return s;
/* Now we have the truly final field list. Store it in this type and
in the variants. */
- ASSERT_CONDITION (TYPE_FIELDS (record)
- == fieldlist); /* --fixme-- remove this. */
- TYPE_FIELDS (record)
- = fieldlist; /* and this once the condition always passes. */
-
for (x = TYPE_MAIN_VARIANT (record); x; x = TYPE_NEXT_VARIANT (x))
{
TYPE_FIELDS (x) = TYPE_FIELDS (record);
TYPE_STUB_DECL (record) = d;
/* Finish debugging output for this type. This must be done after we have
- * called build_decl. */
+ called build_decl. */
rest_of_type_compilation (record, m2block_toplevel ());
return record;
void rtegraph_include_rtscall (rtenode *func)
{
- /* this is a runtime exception, mark it as such. */
+ /* This is a runtime exception, mark it as such. */
func->exception_routine = true;
- /* and remember it. */
+ /* And remember it. */
vec_safe_push (rtegraph_current_function->rts_call, func);
}