diff options
author | Dan Gohman <gohman@apple.com> | 2007-06-28 23:29:44 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2007-06-28 23:29:44 +0000 |
commit | b6f5b00c3bad3415d3f2ee1a6d5ee5a6f66a4540 (patch) | |
tree | 947f899171731ae494ba7f5c6c3454df9ee23844 /include/llvm/Target/TargetLowering.h | |
parent | 28552da9c3c8bc9865b9cff4fe64dad9da7a57a3 (diff) | |
download | external_llvm-b6f5b00c3bad3415d3f2ee1a6d5ee5a6f66a4540.zip external_llvm-b6f5b00c3bad3415d3f2ee1a6d5ee5a6f66a4540.tar.gz external_llvm-b6f5b00c3bad3415d3f2ee1a6d5ee5a6f66a4540.tar.bz2 |
Add new TargetLowering code to provide the final register type that an
illegal value type will be transformed to, for code that needs the
register type after all transformations instead of just after the first
transformation.
Factor out the code that uses this information to do copy-from-regs and
copy-to-regs for various purposes into separate functions so that they
are done consistently.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37781 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Target/TargetLowering.h')
-rw-r--r-- | include/llvm/Target/TargetLowering.h | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/include/llvm/Target/TargetLowering.h b/include/llvm/Target/TargetLowering.h index 1966a43..a95a03b 100644 --- a/include/llvm/Target/TargetLowering.h +++ b/include/llvm/Target/TargetLowering.h @@ -212,12 +212,13 @@ public: /// Similarly, MVT::v2i64 turns into 4 MVT::i32 values with both PPC and X86. /// /// This method returns the number of registers needed, and the VT for each - /// register. It also returns the VT of the VectorType elements before they - /// are promoted/expanded. + /// register. It also returns the VT and quantity of the intermediate values + /// before they are promoted/expanded. /// unsigned getVectorTypeBreakdown(MVT::ValueType VT, - MVT::ValueType &ElementVT, - MVT::ValueType &LegalElementVT) const; + MVT::ValueType &IntermediateVT, + unsigned &NumIntermediates, + MVT::ValueType &RegisterVT) const; typedef std::vector<double>::const_iterator legal_fpimm_iterator; legal_fpimm_iterator legal_fpimm_begin() const { @@ -360,6 +361,18 @@ public: return VT == MVT::iPTR ? PointerTy : VT; } + /// getRegisterType - Return the type of registers that this ValueType will + /// eventually require. + MVT::ValueType getRegisterType(MVT::ValueType VT) const { + if (!MVT::isExtendedVT(VT)) + return RegisterTypeForVT[VT]; + + MVT::ValueType VT1, RegisterVT; + unsigned NumIntermediates; + (void)getVectorTypeBreakdown(VT, VT1, NumIntermediates, RegisterVT); + return RegisterVT; + } + /// getNumRegisters - Return the number of registers that this ValueType will /// eventually require. This is one for any types promoted to live in larger /// registers, but may be more than one for types (like i64) that are split @@ -369,7 +382,8 @@ public: return NumRegistersForVT[VT]; MVT::ValueType VT1, VT2; - return getVectorTypeBreakdown(VT, VT1, VT2); + unsigned NumIntermediates; + return getVectorTypeBreakdown(VT, VT1, NumIntermediates, VT2); } /// hasTargetDAGCombine - If true, the target has custom DAG combine @@ -1034,6 +1048,7 @@ private: /// each ValueType the target supports natively. TargetRegisterClass *RegClassForVT[MVT::LAST_VALUETYPE]; unsigned char NumRegistersForVT[MVT::LAST_VALUETYPE]; + MVT::ValueType RegisterTypeForVT[MVT::LAST_VALUETYPE]; /// TransformToType - For any value types we are promoting or expanding, this /// contains the value type that we are changing to. For Expanded types, this |