Goose  Diff

Differences From Artifact [9639b6f371]:

  • File bs/compile/compiler.cpp — part of check-in [dd5c48041c] at 2022-05-26 11:31:44 on branch cir-stack-language — Re-enabled codegen and related tests, and adapted it to the now stack-based CIR language (user: zlodo size: 6091)

To Artifact [b78f8040a3]:

  • File bs/compile/compiler.cpp — part of check-in [4f05876cc2] at 2022-06-08 22:38:10 on branch cir-stack-language — Refactored the verifier to use the stack-based CIR. It compiles but isn't re-enabled yet (user: zlodo size: 6135)

146
147
148
149
150
151
152
153
154
155
156
157
158
159
160

        if( cfg->currentBB() && !cfg->currentBB()->terminator() )
        {
            p.flushValue();
            cb->destroyAllLiveValues( c );

            if( returnType == GetValueType< void >() )
                cfg->emitTerminator( r->currentLocation(), cir::RetVoid() );
            else if( !defRetVal )
            {
                dm.emitSyntaxErrorMessage( r->currentLocation(), "missing return statement." );
                return nullptr;
            }
            else
            {







|







146
147
148
149
150
151
152
153
154
155
156
157
158
159
160

        if( cfg->currentBB() && !cfg->currentBB()->terminator() )
        {
            p.flushValue();
            cb->destroyAllLiveValues( c );

            if( returnType == GetValueType< void >() )
                cfg->emitTerminator( r->currentLocation(), cir::RetVoid( r->currentLocation() ) );
            else if( !defRetVal )
            {
                dm.emitSyntaxErrorMessage( r->currentLocation(), "missing return statement." );
                return nullptr;
            }
            else
            {
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
                            break;
                    }

                    return nullptr;
                }

                cfg->currentBB()->append( get< Value >( converted ) );
                cfg->emitTerminator( r->currentLocation(), cir::Ret() );
            }
        }

        // TODO_REENABLE_VERIFY
     /*   verify::Func fv( c, cfg, returnType );
        if( !fv.verify() )
            return nullptr;*/

        return cfg;
    }
}







|











172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
                            break;
                    }

                    return nullptr;
                }

                cfg->currentBB()->append( get< Value >( converted ) );
                cfg->emitTerminator( r->currentLocation(), cir::Ret( r->currentLocation() ) );
            }
        }

        // TODO_REENABLE_VERIFY
     /*   verify::Func fv( c, cfg, returnType );
        if( !fv.verify() )
            return nullptr;*/

        return cfg;
    }
}