2626class PlatformInfo (object ):
2727 def __init__ (self , json ):
2828 self ._platform = json ['platform' ]
29- self ._intrinsic_prefix = json ['intrinsic_prefix' ]
3029
31- def intrinsic_prefix (self ):
32- return self ._intrinsic_prefix
30+ def platform_prefix (self ):
31+ return self ._platform
3332
3433class IntrinsicSet (object ):
3534 def __init__ (self , platform , json ):
35+
3636 self ._llvm_prefix = json ['llvm_prefix' ]
3737 self ._type_info = json ['number_info' ]
3838 self ._intrinsics = json ['intrinsics' ]
3939 self ._widths = json ['width_info' ]
4040 self ._platform = platform
41+ self ._intrinsic_prefix = json ['intrinsic_prefix' ]
4142
4243 def intrinsics (self ):
4344 for raw in self ._intrinsics :
@@ -48,6 +49,9 @@ def intrinsics(self):
4849 def platform (self ):
4950 return self ._platform
5051
52+ def intrinsic_prefix (self ):
53+ return self ._intrinsic_prefix
54+
5155 def llvm_prefix (self ):
5256 return self ._llvm_prefix
5357
@@ -538,8 +542,14 @@ def intrinsic_suffix(self):
538542 * self ._args ,
539543 width = self ._width )
540544
545+ def platform_prefix (self ):
546+ return self ._platform .platform ().platform_prefix ()
547+
548+ def intrinsic_set_name (self ):
549+ return self ._platform .intrinsic_prefix ()
550+
541551 def intrinsic_name (self ):
542- return self ._platform .platform (). intrinsic_prefix () + self .intrinsic_suffix ()
552+ return self ._platform .intrinsic_prefix () + self .intrinsic_suffix ()
543553
544554 def compiler_args (self ):
545555 return ', ' .join (arg .compiler_ctor_ref () for arg in self ._args_raw )
@@ -751,8 +761,9 @@ def open(self, platform):
751761 return 'extern "platform-intrinsic" {'
752762
753763 def render (self , mono ):
754- return ' fn {}{};' .format (mono .intrinsic_name (),
755- mono .intrinsic_signature ())
764+ return ' fn {}{}{};' .format (mono .platform_prefix (),
765+ mono .intrinsic_name (),
766+ mono .intrinsic_signature ())
756767
757768 def close (self ):
758769 return '}'
@@ -786,15 +797,15 @@ def open(self, platform):
786797#[inline(never)]
787798pub fn find(name: &str) -> Option<Intrinsic> {{
788799 if !name.starts_with("{0}") {{ return None }}
789- Some(match &name["{0}".len()..] {{''' .format (platform .intrinsic_prefix ())
800+ Some(match &name["{0}".len()..] {{''' .format (platform .platform_prefix ())
790801
791802 def render (self , mono ):
792803 return '''\
793804 "{}" => Intrinsic {{
794805 inputs: {{ static INPUTS: [&'static Type; {}] = [{}]; &INPUTS }},
795806 output: {},
796807 definition: Named("{}")
797- }},''' .format (mono .intrinsic_suffix (),
808+ }},''' .format (mono .intrinsic_set_name () + mono . intrinsic_suffix (),
798809 len (mono ._args_raw ),
799810 mono .compiler_args (),
800811 mono .compiler_ret (),
0 commit comments