tree boolean_constant_expression (bool val);
// Return an expression for the real part of BCOMPLEX.
- virtual tree real_part_expression (tree bcomplex, location_t) = 0;
+ tree real_part_expression (tree bcomplex, location_t);
// Return an expression for the imaginary part of BCOMPLEX.
- virtual tree imag_part_expression (tree bcomplex, location_t) = 0;
+ tree imag_part_expression (tree bcomplex, location_t);
// Return an expression for the complex number (BREAL, BIMAG).
- virtual tree complex_expression (tree breal, tree bimag, location_t) = 0;
+ tree complex_expression (tree breal, tree bimag, location_t);
// Return an expression that converts EXPR to TYPE.
- virtual tree convert_expression (tree type, tree expr, location_t) = 0;
+ tree convert_expression (tree type, tree expr, location_t);
// Return an expression for the field at INDEX in BSTRUCT.
- virtual tree struct_field_expression (tree bstruct, size_t index, location_t)
- = 0;
+ tree struct_field_expression (tree bstruct, size_t index, location_t);
// Create an expression that executes BSTAT before BEXPR.
- virtual tree compound_expression (tree bstat, tree bexpr, location_t) = 0;
+ tree compound_expression (tree bstat, tree bexpr, location_t);
// Return an expression that executes THEN_EXPR if CONDITION is true, or
// ELSE_EXPR otherwise and returns the result as type BTYPE, within the
// specified function FUNCTION. ELSE_EXPR may be NULL. BTYPE may be NULL.
- virtual tree conditional_expression (tree function, tree btype,
- tree condition, tree then_expr,
- tree else_expr, location_t)
- = 0;
+ tree conditional_expression (tree function, tree btype, tree condition,
+ tree then_expr, tree else_expr, location_t);
// Return an expression for the negation operation OP EXPR.
// Supported values of OP are enumerated in NegationOperator.
- virtual tree negation_expression (NegationOperator op, tree expr, location_t)
- = 0;
+ tree negation_expression (NegationOperator op, tree expr, location_t);
// Return an expression for the operation LEFT OP RIGHT.
// Supported values of OP are enumerated in ArithmeticOrLogicalOperator.
- virtual tree arithmetic_or_logical_expression (ArithmeticOrLogicalOperator op,
- tree left, tree right,
- location_t loc)
- = 0;
+ tree arithmetic_or_logical_expression (ArithmeticOrLogicalOperator op,
+ tree left, tree right, location_t loc);
// Return an expression for the operation LEFT OP RIGHT.
// Supported values of OP are enumerated in ArithmeticOrLogicalOperator.
// This function adds overflow checking and returns a list of statements to
// add to the current function context. The `receiver` variable refers to the
// variable which will contain the result of that operation.
- virtual tree
- arithmetic_or_logical_expression_checked (ArithmeticOrLogicalOperator op,
- tree left, tree right,
- location_t loc, Bvariable *receiver)
- = 0;
+ tree arithmetic_or_logical_expression_checked (ArithmeticOrLogicalOperator op,
+ tree left, tree right,
+ location_t loc,
+ Bvariable *receiver);
// Return an expression for the operation LEFT OP RIGHT.
// Supported values of OP are enumerated in ComparisonOperator.
- virtual tree comparison_expression (ComparisonOperator op, tree left,
- tree right, location_t loc)
- = 0;
+ tree comparison_expression (ComparisonOperator op, tree left, tree right,
+ location_t loc);
// Return an expression for the operation LEFT OP RIGHT.
// Supported values of OP are enumerated in LazyBooleanOperator.
- virtual tree lazy_boolean_expression (LazyBooleanOperator op, tree left,
- tree right, location_t)
- = 0;
+ tree lazy_boolean_expression (LazyBooleanOperator op, tree left, tree right,
+ location_t);
// Return an expression that constructs BTYPE with VALS. BTYPE must be the
// backend representation a of struct. VALS must be in the same order as the
// corresponding fields in BTYPE.
- virtual tree constructor_expression (tree btype, bool is_variant,
- const std::vector<tree> &vals, int,
- location_t)
- = 0;
+ tree constructor_expression (tree btype, bool is_variant,
+ const std::vector<tree> &vals, int, location_t);
// Return an expression that constructs an array of BTYPE with INDEXES and
// VALS. INDEXES and VALS must have the same amount of elements. Each index
// in INDEXES must be in the same order as the corresponding value in VALS.
- virtual tree
- array_constructor_expression (tree btype,
- const std::vector<unsigned long> &indexes,
- const std::vector<tree> &vals, location_t)
- = 0;
+ tree array_constructor_expression (tree btype,
+ const std::vector<unsigned long> &indexes,
+ const std::vector<tree> &vals, location_t);
- virtual tree array_initializer (tree, tree, tree, tree, tree, tree *,
- location_t)
- = 0;
+ tree array_initializer (tree, tree, tree, tree, tree, tree *, location_t);
// Return an expression for ARRAY[INDEX] as an l-value. ARRAY is a valid
// fixed-length array, not a slice.
- virtual tree array_index_expression (tree array, tree index, location_t) = 0;
+ tree array_index_expression (tree array, tree index, location_t);
// Create an expression for a call to FN with ARGS, taking place within
// caller CALLER.
- virtual tree call_expression (tree fn, const std::vector<tree> &args,
- tree static_chain, location_t)
- = 0;
+ tree call_expression (tree fn, const std::vector<tree> &args,
+ tree static_chain, location_t);
// Statements.
{
public:
Gcc_backend ();
-
- // Expressions.
-
- tree real_part_expression (tree bcomplex, location_t);
-
- tree imag_part_expression (tree bcomplex, location_t);
-
- tree complex_expression (tree breal, tree bimag, location_t);
-
- tree convert_expression (tree type, tree expr, location_t);
-
- tree struct_field_expression (tree, size_t, location_t);
-
- tree compound_expression (tree, tree, location_t);
-
- tree conditional_expression (tree, tree, tree, tree, tree, location_t);
-
- tree negation_expression (NegationOperator op, tree expr, location_t);
-
- tree arithmetic_or_logical_expression (ArithmeticOrLogicalOperator op,
- tree left, tree right, location_t);
-
- tree arithmetic_or_logical_expression_checked (ArithmeticOrLogicalOperator op,
- tree left, tree right,
- location_t,
- Bvariable *receiver);
-
- tree comparison_expression (ComparisonOperator op, tree left, tree right,
- location_t);
-
- tree lazy_boolean_expression (LazyBooleanOperator op, tree left, tree right,
- location_t);
-
- tree constructor_expression (tree, bool, const std::vector<tree> &, int,
- location_t);
-
- tree array_constructor_expression (tree, const std::vector<unsigned long> &,
- const std::vector<tree> &, location_t);
-
- tree array_initializer (tree, tree, tree, tree, tree, tree *, location_t);
-
- tree array_index_expression (tree array, tree index, location_t);
-
- tree call_expression (tree fn, const std::vector<tree> &args,
- tree static_chain, location_t);
};
#endif // RUST_BACKEND_H
// Return the real part of a complex expression.
tree
-Gcc_backend::real_part_expression (tree complex_tree, location_t location)
+Backend::real_part_expression (tree complex_tree, location_t location)
{
if (complex_tree == error_mark_node)
return error_mark_node;
// Return the imaginary part of a complex expression.
tree
-Gcc_backend::imag_part_expression (tree complex_tree, location_t location)
+Backend::imag_part_expression (tree complex_tree, location_t location)
{
if (complex_tree == error_mark_node)
return error_mark_node;
// Make a complex expression given its real and imaginary parts.
tree
-Gcc_backend::complex_expression (tree real_tree, tree imag_tree,
- location_t location)
+Backend::complex_expression (tree real_tree, tree imag_tree,
+ location_t location)
{
if (real_tree == error_mark_node || imag_tree == error_mark_node)
return error_mark_node;
// An expression that converts an expression to a different type.
tree
-Gcc_backend::convert_expression (tree type_tree, tree expr_tree,
- location_t location)
+Backend::convert_expression (tree type_tree, tree expr_tree,
+ location_t location)
{
if (type_tree == error_mark_node || expr_tree == error_mark_node
|| TREE_TYPE (expr_tree) == error_mark_node)
// Return an expression for the field at INDEX in BSTRUCT.
tree
-Gcc_backend::struct_field_expression (tree struct_tree, size_t index,
- location_t location)
+Backend::struct_field_expression (tree struct_tree, size_t index,
+ location_t location)
{
if (struct_tree == error_mark_node
|| TREE_TYPE (struct_tree) == error_mark_node)
// Return an expression that executes BSTAT before BEXPR.
tree
-Gcc_backend::compound_expression (tree stat, tree expr, location_t location)
+Backend::compound_expression (tree stat, tree expr, location_t location)
{
if (stat == error_mark_node || expr == error_mark_node)
return error_mark_node;
// ELSE_EXPR otherwise.
tree
-Gcc_backend::conditional_expression (tree, tree type_tree, tree cond_expr,
- tree then_expr, tree else_expr,
- location_t location)
+Backend::conditional_expression (tree, tree type_tree, tree cond_expr,
+ tree then_expr, tree else_expr,
+ location_t location)
{
if (type_tree == error_mark_node || cond_expr == error_mark_node
|| then_expr == error_mark_node || else_expr == error_mark_node)
// Return an expression for the negation operation OP EXPR.
tree
-Gcc_backend::negation_expression (NegationOperator op, tree expr_tree,
- location_t location)
+Backend::negation_expression (NegationOperator op, tree expr_tree,
+ location_t location)
{
/* Check if the expression is an error, in which case we return an error
expression. */
}
tree
-Gcc_backend::arithmetic_or_logical_expression (ArithmeticOrLogicalOperator op,
- tree left, tree right,
- location_t location)
+Backend::arithmetic_or_logical_expression (ArithmeticOrLogicalOperator op,
+ tree left, tree right,
+ location_t location)
{
/* Check if either expression is an error, in which case we return an error
expression. */
// Return an expression for the arithmetic or logical operation LEFT OP RIGHT
// with overflow checking when possible
tree
-Gcc_backend::arithmetic_or_logical_expression_checked (
+Backend::arithmetic_or_logical_expression_checked (
ArithmeticOrLogicalOperator op, tree left, tree right, location_t location,
Bvariable *receiver_var)
{
// Return an expression for the comparison operation LEFT OP RIGHT.
tree
-Gcc_backend::comparison_expression (ComparisonOperator op, tree left_tree,
- tree right_tree, location_t location)
+Backend::comparison_expression (ComparisonOperator op, tree left_tree,
+ tree right_tree, location_t location)
{
/* Check if either expression is an error, in which case we return an error
expression. */
// Return an expression for the lazy boolean operation LEFT OP RIGHT.
tree
-Gcc_backend::lazy_boolean_expression (LazyBooleanOperator op, tree left_tree,
- tree right_tree, location_t location)
+Backend::lazy_boolean_expression (LazyBooleanOperator op, tree left_tree,
+ tree right_tree, location_t location)
{
/* Check if either expression is an error, in which case we return an error
expression. */
// Return an expression that constructs BTYPE with VALS.
tree
-Gcc_backend::constructor_expression (tree type_tree, bool is_variant,
- const std::vector<tree> &vals,
- int union_index, location_t location)
+Backend::constructor_expression (tree type_tree, bool is_variant,
+ const std::vector<tree> &vals, int union_index,
+ location_t location)
{
if (type_tree == error_mark_node)
return error_mark_node;
}
tree
-Gcc_backend::array_constructor_expression (
+Backend::array_constructor_expression (
tree type_tree, const std::vector<unsigned long> &indexes,
const std::vector<tree> &vals, location_t location)
{
// Build insns to create an array, initialize all elements of the array to
// value, and return it
tree
-Gcc_backend::array_initializer (tree fndecl, tree block, tree array_type,
- tree length, tree value, tree *tmp,
- location_t locus)
+Backend::array_initializer (tree fndecl, tree block, tree array_type,
+ tree length, tree value, tree *tmp,
+ location_t locus)
{
std::vector<tree> stmts;
// Return an expression representing ARRAY[INDEX]
tree
-Gcc_backend::array_index_expression (tree array_tree, tree index_tree,
- location_t location)
+Backend::array_index_expression (tree array_tree, tree index_tree,
+ location_t location)
{
if (array_tree == error_mark_node || TREE_TYPE (array_tree) == error_mark_node
|| index_tree == error_mark_node)
// Create an expression for a call to FN_EXPR with FN_ARGS.
tree
-Gcc_backend::call_expression (tree fn, const std::vector<tree> &fn_args,
- tree chain_expr, location_t location)
+Backend::call_expression (tree fn, const std::vector<tree> &fn_args,
+ tree chain_expr, location_t location)
{
if (fn == error_mark_node || TREE_TYPE (fn) == error_mark_node)
return error_mark_node;