aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/rust-backend.h
diff options
context:
space:
mode:
authorArthur Cohen <arthur.cohen@embecosm.com>2022-08-26 08:44:02 +0200
committerArthur Cohen <arthur.cohen@embecosm.com>2022-08-26 08:44:02 +0200
commitfc82b68cc1ee2778f2bfc53c5de47e5b36ac8b7c (patch)
tree95454db7a9799f2ad2c16205fbc305e7ff7a09c0 /gcc/rust/rust-backend.h
parentff7d6bfed2e7bc08fba1cc456daf464e6176dd46 (diff)
downloadgcc-fc82b68cc1ee2778f2bfc53c5de47e5b36ac8b7c.zip
gcc-fc82b68cc1ee2778f2bfc53c5de47e5b36ac8b7c.tar.gz
gcc-fc82b68cc1ee2778f2bfc53c5de47e5b36ac8b7c.tar.bz2
backend: Add overflow checks to every arithmetic operation
Diffstat (limited to 'gcc/rust/rust-backend.h')
-rw-r--r--gcc/rust/rust-backend.h19
1 files changed, 15 insertions, 4 deletions
diff --git a/gcc/rust/rust-backend.h b/gcc/rust/rust-backend.h
index 126283c..cda2642 100644
--- a/gcc/rust/rust-backend.h
+++ b/gcc/rust/rust-backend.h
@@ -235,13 +235,24 @@ public:
// Supported values of OP are enumerated in ArithmeticOrLogicalOperator.
virtual tree arithmetic_or_logical_expression (ArithmeticOrLogicalOperator op,
tree left, tree right,
- Location)
+ Location loc)
+ = 0;
+
+ // 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 loc,
+ Bvariable *receiver)
= 0;
// 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)
+ tree right, Location loc)
= 0;
// Return an expression for the operation LEFT OP RIGHT.
@@ -416,8 +427,8 @@ public:
// variable, and may not be very useful. This function should
// return a variable which can be referenced later and should set
// *PSTATEMENT to a statement which initializes the variable.
- virtual Bvariable *temporary_variable (tree, tree, tree, tree init,
- bool address_is_taken,
+ virtual Bvariable *temporary_variable (tree fndecl, tree bind_tree, tree type,
+ tree init, bool address_is_taken,
Location location, tree *pstatement)
= 0;