1 /* May-return analysis.
2 * This makes sense only for functions that return a value. The analysis
3 * determines the set of variables that may transitively reach the return
6 function MayReturnAnalysis() {
7 BackwardAnalysis
.apply(this, arguments
);
8 // May-return variables. We collect them all here.
9 this.vbls
= create_decl_set();
10 // The return value variable itself
11 this.retvar
= undefined;
14 MayReturnAnalysis
.prototype = new BackwardAnalysis
;
16 MayReturnAnalysis
.prototype.flowState = function(isn
, state
) {
17 if (TREE_CODE(isn
) == RETURN_EXPR
) {
18 let gms
= TREE_OPERAND(isn
, 0);
20 // gms is usually a GIMPLE_MODIFY_STMT but can be a RESULT_DECL
21 if (TREE_CODE(gms
) == GIMPLE_MODIFY_STMT
) {
22 let v
= GIMPLE_STMT_OPERAND(gms
, 1);
26 } else if (TREE_CODE(gms
) == RESULT_DECL
) {
27 throw new Error("Weird case hit");
30 } else if (TREE_CODE(isn
) == GIMPLE_MODIFY_STMT
) {
31 let lhs
= GIMPLE_STMT_OPERAND(isn
, 0);
32 let rhs
= GIMPLE_STMT_OPERAND(isn
, 1);
33 if (DECL_P(rhs
) && DECL_P(lhs
) && state
.has(lhs
)) {
38 for (let e
in isn_defs(isn
, 'strong')) {