@@ -258,14 +258,20 @@ class DAGOperand {
258
258
bit hasCompleteDecoder = true;
259
259
}
260
260
261
+ /// Abstract base class common to RegisterClass and
262
+ /// RegClassByHwMode. This permits using RegClassByHwMode in
263
+ /// RegisterOperand contexts without creating an artificial
264
+ /// RegisterClass.
265
+ class RegisterClassLike : DAGOperand;
266
+
261
267
// RegisterClass - Now that all of the registers are defined, and aliases
262
268
// between registers are defined, specify which registers belong to which
263
269
// register classes. This also defines the default allocation order of
264
270
// registers by register allocators.
265
271
//
266
272
class RegisterClass<string namespace, list<ValueType> regTypes, int alignment,
267
273
dag regList, RegAltNameIndex idx = NoRegAltName>
268
- : DAGOperand {
274
+ : RegisterClassLike {
269
275
string Namespace = namespace;
270
276
271
277
// The register size/alignment information, parameterized by a HW mode.
@@ -916,15 +922,30 @@ def decoder;
916
922
/// derived from this. TableGen treats the register class as having a symbolic
917
923
/// type that it doesn't know, and resolves the actual regclass to use by using
918
924
/// the TargetRegisterInfo::getPointerRegClass() hook at codegen time.
925
+ ///
926
+ /// This is deprecated in favor of RegClassByHwMode.
919
927
class PointerLikeRegClass<int Kind> {
920
928
int RegClassKind = Kind;
921
929
}
922
930
931
+ /// RegClassByHwMode - Operands that change the register class based
932
+ /// on the subtarget are derived from this. TableGen
933
+ /// treats the register class as having a symbolic kind that it
934
+ /// doesn't know, and resolves the actual regclass to use by using the
935
+ /// a mapping in TargetInstrInfo at codegen time. This can be used to
936
+ /// define operands which swap the register class with the pointer
937
+ /// type.
938
+ class RegClassByHwMode<list<HwMode> Modes,
939
+ list<RegisterClass> RegClasses>
940
+ : HwModeSelect<Modes, !size(RegClasses)>, RegisterClassLike {
941
+ list<RegisterClass> Objects = RegClasses;
942
+ }
923
943
924
944
/// ptr_rc definition - Mark this operand as being a pointer value whose
925
945
/// register class is resolved dynamically via a callback to TargetInstrInfo.
926
946
/// FIXME: We should probably change this to a class which contain a list of
927
947
/// flags. But currently we have but one flag.
948
+ // Deprecated, use RegClassByHwMode instead.
928
949
def ptr_rc : PointerLikeRegClass<0>;
929
950
930
951
/// unknown definition - Mark this operand as being of unknown type, causing
@@ -1024,10 +1045,10 @@ class Operand<ValueType ty> : DAGOperand {
1024
1045
AsmOperandClass ParserMatchClass = ImmAsmOperand;
1025
1046
}
1026
1047
1027
- class RegisterOperand<RegisterClass regclass, string pm = "printOperand">
1048
+ class RegisterOperand<RegisterClassLike regclass, string pm = "printOperand">
1028
1049
: DAGOperand {
1029
1050
// RegClass - The register class of the operand.
1030
- RegisterClass RegClass = regclass;
1051
+ RegisterClassLike RegClass = regclass;
1031
1052
// PrintMethod - The target method to call to print register operands of
1032
1053
// this type. The method normally will just use an alt-name index to look
1033
1054
// up the name to print. Default to the generic printOperand().
0 commit comments