diff options
Diffstat (limited to 'include/llvm')
-rw-r--r-- | include/llvm/Target/Target.td | 8 | ||||
-rw-r--r-- | include/llvm/Target/TargetInstrInfo.h | 9 | ||||
-rw-r--r-- | include/llvm/Target/TargetRegisterInfo.h | 47 |
3 files changed, 54 insertions, 10 deletions
diff --git a/include/llvm/Target/Target.td b/include/llvm/Target/Target.td index 99b314c..3ce360b 100644 --- a/include/llvm/Target/Target.td +++ b/include/llvm/Target/Target.td @@ -400,6 +400,14 @@ def SUBREG_TO_REG : Instruction { let Namespace = "TargetInstrInfo"; let neverHasSideEffects = 1; } +def COPY_TO_SUBCLASS : Instruction { + let OutOperandList = (ops unknown:$dst); + let InOperandList = (ops unknown:$src, i32imm:$regclass); + let AsmString = ""; + let Namespace = "TargetInstrInfo"; + let neverHasSideEffects = 1; + let isAsCheapAsAMove = 1; +} //===----------------------------------------------------------------------===// // AsmWriter - This class can be implemented by targets that need to customize diff --git a/include/llvm/Target/TargetInstrInfo.h b/include/llvm/Target/TargetInstrInfo.h index 6637424..fb41e4d 100644 --- a/include/llvm/Target/TargetInstrInfo.h +++ b/include/llvm/Target/TargetInstrInfo.h @@ -73,7 +73,14 @@ public: /// is often zero, as is commonly used to implement zext operations on /// target architectures which support it, such as with x86-64 (with /// zext from i32 to i64 via implicit zero-extension). - SUBREG_TO_REG = 9 + SUBREG_TO_REG = 9, + + /// COPY_TO_SUBCLASS - This instruction is a placeholder for a plain + /// register-to-register copy into a specific register class. This is only + /// used between instruction selection and MachineInstr creation, before + /// virtual registers have been created for all the instructions. As with + /// normal copies, these may be optimized away by the coalescer. + COPY_TO_SUBCLASS = 10 }; unsigned getNumOpcodes() const { return NumOpcodes; } diff --git a/include/llvm/Target/TargetRegisterInfo.h b/include/llvm/Target/TargetRegisterInfo.h index 6901147..92f709f 100644 --- a/include/llvm/Target/TargetRegisterInfo.h +++ b/include/llvm/Target/TargetRegisterInfo.h @@ -62,6 +62,8 @@ private: const vt_iterator VTs; const sc_iterator SubClasses; const sc_iterator SuperClasses; + const sc_iterator SubRegClasses; + const sc_iterator SuperRegClasses; const unsigned RegSize, Alignment; // Size & Alignment of register in bytes const int CopyCost; const iterator RegsBegin, RegsEnd; @@ -72,9 +74,12 @@ public: const MVT *vts, const TargetRegisterClass * const *subcs, const TargetRegisterClass * const *supcs, + const TargetRegisterClass * const *subregcs, + const TargetRegisterClass * const *superregcs, unsigned RS, unsigned Al, int CC, iterator RB, iterator RE) : ID(id), Name(name), VTs(vts), SubClasses(subcs), SuperClasses(supcs), + SubRegClasses(subregcs), SuperRegClasses(superregcs), RegSize(RS), Alignment(Al), CopyCost(CC), RegsBegin(RB), RegsEnd(RE) { for (iterator I = RegsBegin, E = RegsEnd; I != E; ++I) RegSet.insert(*I); @@ -132,8 +137,32 @@ public: return I; } - /// hasSubClass - return true if the specified TargetRegisterClass is a - /// sub-register class of this TargetRegisterClass. + /// subregclasses_begin / subregclasses_end - Loop over all of + /// the subreg register classes of this register class. + sc_iterator subregclasses_begin() const { + return SubRegClasses; + } + + sc_iterator subregclasses_end() const { + sc_iterator I = SubRegClasses; + while (*I != NULL) ++I; + return I; + } + + /// superregclasses_begin / superregclasses_end - Loop over all of + /// the superreg register classes of this register class. + sc_iterator superregclasses_begin() const { + return SuperRegClasses; + } + + sc_iterator superregclasses_end() const { + sc_iterator I = SuperRegClasses; + while (*I != NULL) ++I; + return I; + } + + /// hasSubClass - return true if the the specified TargetRegisterClass + /// is a proper subset of this TargetRegisterClass. bool hasSubClass(const TargetRegisterClass *cs) const { for (int i = 0; SubClasses[i] != NULL; ++i) if (SubClasses[i] == cs) @@ -141,8 +170,8 @@ public: return false; } - /// subclasses_begin / subclasses_end - Loop over all of the sub-classes of - /// this register class. + /// subclasses_begin / subclasses_end - Loop over all of the classes + /// that are proper subsets of this register class. sc_iterator subclasses_begin() const { return SubClasses; } @@ -154,7 +183,7 @@ public: } /// hasSuperClass - return true if the specified TargetRegisterClass is a - /// super-register class of this TargetRegisterClass. + /// proper superset of this TargetRegisterClass. bool hasSuperClass(const TargetRegisterClass *cs) const { for (int i = 0; SuperClasses[i] != NULL; ++i) if (SuperClasses[i] == cs) @@ -162,8 +191,8 @@ public: return false; } - /// superclasses_begin / superclasses_end - Loop over all of the super-classes - /// of this register class. + /// superclasses_begin / superclasses_end - Loop over all of the classes + /// that are proper supersets of this register class. sc_iterator superclasses_begin() const { return SuperClasses; } @@ -174,8 +203,8 @@ public: return I; } - /// isASubClass - return true if this TargetRegisterClass is a sub-class of at - /// least one other TargetRegisterClass. + /// isASubClass - return true if this TargetRegisterClass is a subset + /// class of at least one other TargetRegisterClass. bool isASubClass() const { return SuperClasses[0] != 0; } |