@@ -3411,16 +3411,10 @@ fn analyze_specialized_builtin_call(
34113411 | SpecializedBuiltinKind :: BytesFromArrayU8
34123412 | SpecializedBuiltinKind :: BytesToUtf8Ascii
34133413 | SpecializedBuiltinKind :: BytesToArrayU8
3414- | SpecializedBuiltinKind :: ToString => {
3414+ | SpecializedBuiltinKind :: ToString
3415+ | SpecializedBuiltinKind :: RegexReplace => {
34153416 unreachable ! ( "spec-covered builtins are handled by the spec-driven path" )
34163417 }
3417- SpecializedBuiltinKind :: RegexReplace => {
3418- let _ = frame. pop ( ) ?;
3419- let _ = frame. pop ( ) ?;
3420- let _ = frame. pop ( ) ?;
3421- frame. push ( ValueInfo :: tagged_typed ( ValueType :: String ) ) ;
3422- Ok ( "regex_replace" )
3423- }
34243418 SpecializedBuiltinKind :: TypeOfKnown ( _) => {
34253419 let _ = frame. pop ( ) ?;
34263420 frame. push ( ValueInfo :: type_name ( ) ) ;
@@ -3535,49 +3529,10 @@ fn emit_specialized_builtin_call(
35353529 | SpecializedBuiltinKind :: BytesFromArrayU8
35363530 | SpecializedBuiltinKind :: BytesToUtf8Ascii
35373531 | SpecializedBuiltinKind :: BytesToArrayU8
3538- | SpecializedBuiltinKind :: ToString => {
3532+ | SpecializedBuiltinKind :: ToString
3533+ | SpecializedBuiltinKind :: RegexReplace => {
35393534 unreachable ! ( "spec-covered builtins are handled by the spec-driven path" )
35403535 }
3541- SpecializedBuiltinKind :: RegexReplace => {
3542- let replacement = ensure_heap_ptr (
3543- builder,
3544- block,
3545- ip,
3546- frame. pop ( ) ?,
3547- HeapContainerKind :: String . value_type ( ) ,
3548- ) ?;
3549- let text = ensure_heap_ptr (
3550- builder,
3551- block,
3552- ip,
3553- frame. pop ( ) ?,
3554- HeapContainerKind :: String . value_type ( ) ,
3555- ) ?;
3556- let pattern = ensure_heap_ptr (
3557- builder,
3558- block,
3559- ip,
3560- frame. pop ( ) ?,
3561- HeapContainerKind :: String . value_type ( ) ,
3562- ) ?;
3563- let out = builder
3564- . append_value_inst (
3565- block,
3566- ip,
3567- SsaValueRepr :: Tagged ,
3568- SsaInstKind :: RegexReplace {
3569- pattern : pattern. value . id ,
3570- text : text. value . id ,
3571- replacement : replacement. value . id ,
3572- } ,
3573- )
3574- . map ( |value| SymbolicValue {
3575- value,
3576- info : ValueInfo :: tagged_typed ( ValueType :: String ) ,
3577- } )
3578- . map_err ( |err| TraceRecordError :: InvalidIr ( err. to_string ( ) ) ) ?;
3579- Ok ( ( "regex_replace" , out) )
3580- }
35813536 SpecializedBuiltinKind :: TypeOfKnown ( value_type) => {
35823537 let _ = frame. pop ( ) ?;
35833538 let type_name = match value_type {
@@ -4009,6 +3964,15 @@ fn emit_spec_driven_builtin(
40093964 ValueInfo :: tagged_typed ( ValueType :: String ) ,
40103965 spec. name ,
40113966 ) ,
3967+ SpecializedBuiltinKind :: RegexReplace => (
3968+ SsaInstKind :: RegexReplace {
3969+ pattern : popped[ 2 ] . value . id ,
3970+ text : popped[ 1 ] . value . id ,
3971+ replacement : popped[ 0 ] . value . id ,
3972+ } ,
3973+ ValueInfo :: tagged_typed ( ValueType :: String ) ,
3974+ spec. name ,
3975+ ) ,
40123976 SpecializedBuiltinKind :: ArraySet => {
40133977 let value = & popped[ 0 ] ;
40143978 let index = & popped[ 1 ] ;
0 commit comments