diff options
author | Chris Lattner <sabre@nondot.org> | 2010-11-02 18:10:06 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-11-02 18:10:06 +0000 |
commit | ec6f096c36f4144ff9b3b24c2939720cdcbb7bcc (patch) | |
tree | d1bdfedd5e517a609dc72fd5226736142caa5c34 /utils/TableGen/CodeGenTarget.cpp | |
parent | 1aabe1b49371f7e7a9898a3060653fcfa6ee497c (diff) |
a bunch of random cleanup, move a helper to CGT where it belongs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118031 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/CodeGenTarget.cpp')
-rw-r--r-- | utils/TableGen/CodeGenTarget.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/utils/TableGen/CodeGenTarget.cpp b/utils/TableGen/CodeGenTarget.cpp index 7a1c4f7b50..f8ba6748a1 100644 --- a/utils/TableGen/CodeGenTarget.cpp +++ b/utils/TableGen/CodeGenTarget.cpp @@ -190,6 +190,19 @@ void CodeGenTarget::ReadRegisterClasses() const { RegisterClasses.assign(RegClasses.begin(), RegClasses.end()); } +/// getRegisterByName - If there is a register with the specific AsmName, +/// return it. +const CodeGenRegister *CodeGenTarget::getRegisterByName(StringRef Name) const { + const std::vector<CodeGenRegister> &Regs = getRegisters(); + for (unsigned i = 0, e = Regs.size(); i != e; ++i) { + const CodeGenRegister &Reg = Regs[i]; + if (Reg.TheDef->getValueAsString("AsmName") == Name) + return &Reg; + } + + return 0; +} + std::vector<MVT::SimpleValueType> CodeGenTarget:: getRegisterVTs(Record *R) const { std::vector<MVT::SimpleValueType> Result; |