@@ -74,7 +74,7 @@ class MachineOperand {
74
74
private:
75
75
// / OpKind - Specify what kind of operand this is. This discriminates the
76
76
// / union.
77
- MachineOperandType OpKind : 8 ;
77
+ unsigned OpKind : 8 ;
78
78
79
79
// / Subregister number for MO_Register. A value of 0 indicates the
80
80
// / MO_Register has no subReg.
@@ -85,32 +85,32 @@ class MachineOperand {
85
85
// / TiedTo - Non-zero when this register operand is tied to another register
86
86
// / operand. The encoding of this field is described in the block comment
87
87
// / before MachineInstr::tieOperands().
88
- unsigned char TiedTo : 4 ;
88
+ unsigned TiedTo : 4 ;
89
89
90
90
// / IsDef - True if this is a def, false if this is a use of the register.
91
91
// / This is only valid on register operands.
92
92
// /
93
- bool IsDef : 1 ;
93
+ unsigned IsDef : 1 ;
94
94
95
95
// / IsImp - True if this is an implicit def or use, false if it is explicit.
96
96
// / This is only valid on register opderands.
97
97
// /
98
- bool IsImp : 1 ;
98
+ unsigned IsImp : 1 ;
99
99
100
100
// / IsDeadOrKill
101
101
// / For uses: IsKill - True if this instruction is the last use of the
102
102
// / register on this path through the function.
103
103
// / For defs: IsDead - True if this register is never used by a subsequent
104
104
// / instruction.
105
105
// / This is only valid on register operands.
106
- bool IsDeadOrKill : 1 ;
106
+ unsigned IsDeadOrKill : 1 ;
107
107
108
108
// / IsRenamable - True if this register may be renamed, i.e. it does not
109
109
// / generate a value that is somehow read in a way that is not represented by
110
110
// / the Machine IR (e.g. to meet an ABI or ISA requirement). This is only
111
111
// / valid on physical register operands. Virtual registers are assumed to
112
112
// / always be renamable regardless of the value of this field.
113
- bool IsRenamable : 1 ;
113
+ unsigned IsRenamable : 1 ;
114
114
115
115
// / IsUndef - True if this register operand reads an "undef" value, i.e. the
116
116
// / read value doesn't matter. This flag can be set on both use and def
@@ -129,7 +129,7 @@ class MachineOperand {
129
129
// / Any register can be used for %2, and its value doesn't matter, but
130
130
// / the two operands must be the same register.
131
131
// /
132
- bool IsUndef : 1 ;
132
+ unsigned IsUndef : 1 ;
133
133
134
134
// / IsInternalRead - True if this operand reads a value that was defined
135
135
// / inside the same instruction or bundle. This flag can be set on both use
@@ -140,16 +140,16 @@ class MachineOperand {
140
140
// / When this flag is set, the instruction bundle must contain at least one
141
141
// / other def of the register. If multiple instructions in the bundle define
142
142
// / the register, the meaning is target-defined.
143
- bool IsInternalRead : 1 ;
143
+ unsigned IsInternalRead : 1 ;
144
144
145
145
// / IsEarlyClobber - True if this MO_Register 'def' operand is written to
146
146
// / by the MachineInstr before all input registers are read. This is used to
147
147
// / model the GCC inline asm '&' constraint modifier.
148
- bool IsEarlyClobber : 1 ;
148
+ unsigned IsEarlyClobber : 1 ;
149
149
150
150
// / IsDebug - True if this MO_Register 'use' operand is in a debug pseudo,
151
151
// / not a real instruction. Such uses should be ignored during codegen.
152
- bool IsDebug : 1 ;
152
+ unsigned IsDebug : 1 ;
153
153
154
154
// / SmallContents - This really should be part of the Contents union, but
155
155
// / lives out here so we can get a better packed struct.
@@ -198,7 +198,19 @@ class MachineOperand {
198
198
} Contents;
199
199
200
200
explicit MachineOperand (MachineOperandType K)
201
- : OpKind(K), SubReg_TargetFlags(0 ), ParentMI(nullptr ) {}
201
+ : OpKind(K), SubReg_TargetFlags(0 ), ParentMI(nullptr ) {
202
+ // Assert that the layout is what we expect. It's easy to grow this object.
203
+ static_assert (alignof (MachineOperand) <= alignof (int64_t ),
204
+ " MachineOperand shouldn't be more than 8 byte aligned" );
205
+ static_assert (sizeof (Contents) <= 2 * sizeof (void *),
206
+ " Contents should be at most two pointers" );
207
+ static_assert (sizeof (MachineOperand) <=
208
+ alignTo<alignof (int64_t )>(2 * sizeof (unsigned ) +
209
+ 3 * sizeof (void *)),
210
+ " MachineOperand too big. Should be Kind, SmallContents, "
211
+ " ParentMI, and Contents" );
212
+ }
213
+
202
214
public:
203
215
// / getType - Returns the MachineOperandType for this operand.
204
216
// /
0 commit comments