diff options
author | Nate Begeman <natebegeman@mac.com> | 2005-07-12 03:04:49 +0000 |
---|---|---|
committer | Nate Begeman <natebegeman@mac.com> | 2005-07-12 03:04:49 +0000 |
commit | 8d2623d49a7b53f2bb25f2b61c14aecb91e19154 (patch) | |
tree | 79711a71a493b3e744d0354baf5b1ec8cc35be8f | |
parent | d73e4608dba2cd42d1a3d6d16d1491eedcb05301 (diff) | |
download | external_llvm-8d2623d49a7b53f2bb25f2b61c14aecb91e19154.zip external_llvm-8d2623d49a7b53f2bb25f2b61c14aecb91e19154.tar.gz external_llvm-8d2623d49a7b53f2bb25f2b61c14aecb91e19154.tar.bz2 |
Clean up and add comments to the newly implemented subtarget code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22396 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/Target/TargetMachine.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/include/llvm/Target/TargetMachine.h b/include/llvm/Target/TargetMachine.h index efeb61d..5376f45 100644 --- a/include/llvm/Target/TargetMachine.h +++ b/include/llvm/Target/TargetMachine.h @@ -64,6 +64,10 @@ protected: // Can only create subclasses... /// TargetMachine(const std::string &name, IntrinsicLowering *IL, const Module &M); + + /// getSubtargetImpl - virtual method implemented by subclasses that returns + /// a reference to that target's TargetSubtarget-derived member variable. + virtual const TargetSubtarget *getSubtargetImpl() const { return 0; } public: virtual ~TargetMachine(); @@ -98,11 +102,14 @@ public: virtual const TargetFrameInfo *getFrameInfo() const { return 0; } const TargetData &getTargetData() const { return DataLayout; } - virtual const TargetSubtarget *getSubtargetImpl() const { return 0; } + /// getSubtarget - This method returns a pointer to the specified type of + /// TargetSubtarget. In debug builds, it verifies that the object being + /// returned is of the correct type. template<typename STC> STC *getSubtarget() const { - assert(getSubtargetImpl() && dynamic_cast<STC*>(getSubtargetImpl()) && + const TargetSubtarget *TST = getSubtargetImpl(); + assert(getSubtargetImpl() && dynamic_cast<STC*>(TST) && "Not the right kind of subtarget!"); - return (STC*)getSubtargetImpl(); + return (STC*)TST; } /// getRegisterInfo - If register information is available, return it. If |