@@ -711,31 +711,6 @@ std::vector<uint32_t> spirv::readStreamOfWords(std::istream* in)
711711 return words;
712712}
713713
714- void spirv::addFunctionAliases (Module& module )
715- {
716- /*
717- * Add function aliases
718- *
719- * This is required, since SPIR-V maps e.g. OpenCL 1.2 standard function atomic_inc(x) as well as OpenCL 1.0
720- * extension function atom_inc(x) to an OpAtomicIIncrement instruction. Since we can only map this instruction
721- * to one call-site, we need to alias the other one.
722- *
723- * So we map e.g. OpAtomicIIncrement to a call to "atomic_inc". But in case this does not exist (i.e. originally,
724- * "atom_inc" was called), we add an alias back to the old OpenCL 1.0 extension function.
725- */
726- module .functionAliases .emplace (" atomic_add" , " atom_add" );
727- module .functionAliases .emplace (" atomic_sub" , " atom_sub" );
728- module .functionAliases .emplace (" atomic_xchg" , " atom_xchg" );
729- module .functionAliases .emplace (" atomic_inc" , " atom_inc" );
730- module .functionAliases .emplace (" atomic_dec" , " atom_dec" );
731- module .functionAliases .emplace (" atomic_cmpxchg" , " atom_cmpxchg" );
732- module .functionAliases .emplace (" atomic_min" , " atom_min" );
733- module .functionAliases .emplace (" atomic_max" , " atom_max" );
734- module .functionAliases .emplace (" atomic_and" , " atom_and" );
735- module .functionAliases .emplace (" atomic_or" , " atom_or" );
736- module .functionAliases .emplace (" atomic_xor" , " atom_xor" );
737- }
738-
739714std::string spirv::demangleFunctionName (const std::string& name)
740715{
741716 if (name.find (" _Z" ) != 0 )
@@ -762,3 +737,27 @@ std::string spirv::demangleFunctionName(const std::string& name)
762737#endif
763738}
764739
740+ void spirv::addFunctionAliases (Module& module )
741+ {
742+ /*
743+ * Add function aliases
744+ *
745+ * This is required, since SPIR-V maps e.g. OpenCL 1.2 standard function atomic_inc(x) as well as OpenCL 1.0
746+ * extension function atom_inc(x) to an OpAtomicIIncrement instruction. Since we can only map this instruction
747+ * to one call-site, we need to alias the other one.
748+ *
749+ * So we map e.g. OpAtomicIIncrement to a call to "atomic_inc". But in case this does not exist (i.e. originally,
750+ * "atom_inc" was called), we add an alias back to the old OpenCL 1.0 extension function.
751+ */
752+ module .functionAliases .emplace (" atomic_add" , " atom_add" );
753+ module .functionAliases .emplace (" atomic_sub" , " atom_sub" );
754+ module .functionAliases .emplace (" atomic_xchg" , " atom_xchg" );
755+ module .functionAliases .emplace (" atomic_inc" , " atom_inc" );
756+ module .functionAliases .emplace (" atomic_dec" , " atom_dec" );
757+ module .functionAliases .emplace (" atomic_cmpxchg" , " atom_cmpxchg" );
758+ module .functionAliases .emplace (" atomic_min" , " atom_min" );
759+ module .functionAliases .emplace (" atomic_max" , " atom_max" );
760+ module .functionAliases .emplace (" atomic_and" , " atom_and" );
761+ module .functionAliases .emplace (" atomic_or" , " atom_or" );
762+ module .functionAliases .emplace (" atomic_xor" , " atom_xor" );
763+ }
0 commit comments