summaryrefslogtreecommitdiff
path: root/include/clang/Basic/TargetBuiltins.h
diff options
context:
space:
mode:
authorBob Wilson <bob.wilson@apple.com>2011-11-08 01:16:11 +0000
committerBob Wilson <bob.wilson@apple.com>2011-11-08 01:16:11 +0000
commitda95f73b59f9af964e33725c515139d34c90c863 (patch)
tree366c5e1ac7b2b1bdc51e0dad058c7155eb61dd08 /include/clang/Basic/TargetBuiltins.h
parentbc05f57cba6655d1f8ff7f17338dac63139b878e (diff)
downloadclang-da95f73b59f9af964e33725c515139d34c90c863.tar.gz
clang-da95f73b59f9af964e33725c515139d34c90c863.tar.bz2
clang-da95f73b59f9af964e33725c515139d34c90c863.tar.xz
Clean up type flags for overloaded Neon builtins. No functional change.
This patch just adds a simple NeonTypeFlags class to replace the various hardcoded constants that had been used until now. Unfortunately I couldn't figure out a good way to avoid duplicating that class between clang and TableGen, but since it's small and rarely changes, that's not so bad. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144054 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/TargetBuiltins.h')
-rw-r--r--include/clang/Basic/TargetBuiltins.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/include/clang/Basic/TargetBuiltins.h b/include/clang/Basic/TargetBuiltins.h
index 8bc60ff538..62e970c41b 100644
--- a/include/clang/Basic/TargetBuiltins.h
+++ b/include/clang/Basic/TargetBuiltins.h
@@ -56,6 +56,46 @@ namespace clang {
};
}
+ /// NeonTypeFlags - Flags to identify the types for overloaded Neon
+ /// builtins. These must be kept in sync with the flags in
+ /// utils/TableGen/NeonEmitter.h.
+ class NeonTypeFlags {
+ enum {
+ EltTypeMask = 0xf,
+ UnsignedFlag = 0x10,
+ QuadFlag = 0x20
+ };
+ uint32_t Flags;
+
+ public:
+ enum EltType {
+ Int8,
+ Int16,
+ Int32,
+ Int64,
+ Poly8,
+ Poly16,
+ Float16,
+ Float32
+ };
+
+ NeonTypeFlags(unsigned F) : Flags(F) {}
+ NeonTypeFlags(EltType ET, bool IsUnsigned, bool IsQuad) : Flags(ET) {
+ if (IsUnsigned)
+ Flags |= UnsignedFlag;
+ if (IsQuad)
+ Flags |= QuadFlag;
+ }
+
+ EltType getEltType() const { return (EltType)(Flags & EltTypeMask); }
+ bool isPoly() const {
+ EltType ET = getEltType();
+ return ET == Poly8 || ET == Poly16;
+ }
+ bool isUnsigned() const { return (Flags & UnsignedFlag) != 0; }
+ bool isQuad() const { return (Flags & QuadFlag) != 0; }
+ };
+
} // end namespace clang.
#endif