diff options
author | David Chisnall <csdavec@swan.ac.uk> | 2012-07-04 11:52:24 +0000 |
---|---|---|
committer | David Chisnall <csdavec@swan.ac.uk> | 2012-07-04 11:52:24 +0000 |
commit | 2c7886ddec1e2cee68daee9866637d2e02f434ef (patch) | |
tree | aaa96f38ba3bd007af3d3efb876a1fd04a33a70b /include/clang/Basic/ObjCRuntime.h | |
parent | a422cd0ed4da8cb5a172498f29bb02065707c6ce (diff) |
Hoist the logic for selecting the Objective-C dispatch method into the runtime
class, from the target. No functionality change, just less duplicated logic.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159710 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/ObjCRuntime.h')
-rw-r--r-- | include/clang/Basic/ObjCRuntime.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/clang/Basic/ObjCRuntime.h b/include/clang/Basic/ObjCRuntime.h index 10922ed5af..228135d094 100644 --- a/include/clang/Basic/ObjCRuntime.h +++ b/include/clang/Basic/ObjCRuntime.h @@ -16,6 +16,7 @@ #define LLVM_CLANG_OBJCRUNTIME_H #include "clang/Basic/VersionTuple.h" +#include "llvm/ADT/Triple.h" #include "llvm/Support/ErrorHandling.h" namespace clang { @@ -84,6 +85,21 @@ public: /// implied behaviors for a "fragile" ABI? bool isFragile() const { return !isNonFragile(); } + /// The default dispatch mechanism to use for the specified architecture + bool isLegacyDispatchDefaultForArch(llvm::Triple::ArchType Arch) { + // The GNUstep runtime uses a newer dispatch method by default from + // version 1.6 onwards + if (getKind() == GNUstep && getVersion() >= VersionTuple(1, 6)) { + if (Arch == llvm::Triple::arm || + Arch == llvm::Triple::x86 || + Arch == llvm::Triple::x86_64) + return false; + // Mac runtimes use legacy dispatch everywhere except x86-64 + } else if (isNeXTFamily() && isNonFragile()) + return Arch != llvm::Triple::x86_64; + return true; + } + /// \brief Is this runtime basically of the GNUstep family of runtimes? bool isGNUFamily() const { switch (getKind()) { |