Skip to content

Commit eaaec34

Browse files
Revert SPIRVHelper.h and .cpp
1 parent c2e2e31 commit eaaec34

File tree

2 files changed

+27
-30
lines changed

2 files changed

+27
-30
lines changed

src/spirv/SPIRVHelper.cpp

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -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-
739714
std::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+
}

src/spirv/SPIRVHelper.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@
1414

1515
#include <sstream>
1616

17-
#endif
18-
19-
#include <string>
20-
2117
namespace vc4c
2218
{
2319
class Module;
@@ -46,9 +42,11 @@ namespace vc4c
4642

4743
std::vector<uint32_t> readStreamOfWords(std::istream* in);
4844

49-
void addFunctionAliases(Module& module);
5045
std::string demangleFunctionName(const std::string& name);
5146

47+
void addFunctionAliases(Module& module);
48+
5249
} // namespace spirv
5350
} // namespace vc4c
5451

52+
#endif /* SPIRVHELPER_H */

0 commit comments

Comments
 (0)