@@ -1864,7 +1864,7 @@ void Synthesiser::emitCode(std::ostream& out, const Statement& stmt) {
1864
1864
1865
1865
// strings
1866
1866
case BinaryConstraintOp::MATCH: {
1867
- if (const StringConstant* str = dynamic_cast < const StringConstant* >(&rel.getLHS ()); str) {
1867
+ if (const StringConstant* str = as< StringConstant>(&rel.getLHS ()); str) {
1868
1868
const auto & regex = synthesiser.compileRegex (str->getConstant ());
1869
1869
if (regex) {
1870
1870
out << " std::regex_match(symTable.decode(" ;
@@ -1884,7 +1884,7 @@ void Synthesiser::emitCode(std::ostream& out, const Statement& stmt) {
1884
1884
break ;
1885
1885
}
1886
1886
case BinaryConstraintOp::NOT_MATCH: {
1887
- if (const StringConstant* str = dynamic_cast < const StringConstant* >(&rel.getLHS ()); str) {
1887
+ if (const StringConstant* str = as< StringConstant>(&rel.getLHS ()); str) {
1888
1888
const auto & regex = synthesiser.compileRegex (str->getConstant ());
1889
1889
if (regex) {
1890
1890
out << " !std::regex_match(symTable.decode(" ;
@@ -2313,6 +2313,35 @@ void Synthesiser::emitCode(std::ostream& out, const Statement& stmt) {
2313
2313
case FunctorOp::URANGE:
2314
2314
case FunctorOp::FRANGE:
2315
2315
fatal (" ICE: functor `%s` must map onto `NestedIntrinsicOperator`" , op.getOperator ());
2316
+
2317
+ case FunctorOp::SSADD: {
2318
+ const StringConstant* lstr = as<StringConstant>(args[0 ]);
2319
+ const StringConstant* rstr = as<StringConstant>(args[1 ]);
2320
+ if (lstr && rstr) {
2321
+ out << " RamSigned("
2322
+ << synthesiser.convertSymbol2Idx (lstr->getConstant () + rstr->getConstant ()) << " )" ;
2323
+ } else {
2324
+ out << " symTable.encode(" ;
2325
+ if (lstr) {
2326
+ out << " R\" _(" << lstr->getConstant () << " )_\" " ;
2327
+ } else {
2328
+ out << " symTable.decode(" ;
2329
+ dispatch (*args[0 ], out);
2330
+ out << " )" ;
2331
+ }
2332
+ out << " + " ;
2333
+ if (rstr) {
2334
+ out << " R\" _(" << rstr->getConstant () << " )_\" " ;
2335
+ } else {
2336
+ out << " symTable.decode(" ;
2337
+ dispatch (*args[1 ], out);
2338
+ out << " )" ;
2339
+ }
2340
+ out << " )" ;
2341
+ }
2342
+ break ;
2343
+ }
2344
+
2316
2345
}
2317
2346
PRINT_END_COMMENT (out);
2318
2347
0 commit comments