@@ -207,7 +207,7 @@ static unsigned getDwarfRegNum(unsigned Reg, const TargetRegisterInfo *TRI) {
207
207
MachineInstr::const_mop_iterator
208
208
StackMaps::parseOperand (MachineInstr::const_mop_iterator MOI,
209
209
MachineInstr::const_mop_iterator MOE, LocationVec &Locs,
210
- LiveOutVec &LiveOuts) const {
210
+ LiveOutVec &LiveOuts) {
211
211
const TargetRegisterInfo *TRI = AP.MF ->getSubtarget ().getRegisterInfo ();
212
212
if (MOI->isImm ()) {
213
213
switch (MOI->getImm ()) {
@@ -238,7 +238,22 @@ StackMaps::parseOperand(MachineInstr::const_mop_iterator MOI,
238
238
++MOI;
239
239
assert (MOI->isImm () && " Expected constant operand." );
240
240
int64_t Imm = MOI->getImm ();
241
- Locs.emplace_back (Location::Constant, sizeof (int64_t ), 0 , Imm);
241
+ if (isInt<32 >(Imm)) {
242
+ Locs.emplace_back (Location::Constant, sizeof (int64_t ), 0 , Imm);
243
+ } else {
244
+ // ConstPool is intentionally a MapVector of 'uint64_t's (as
245
+ // opposed to 'int64_t's). We should never be in a situation
246
+ // where we have to insert either the tombstone or the empty
247
+ // keys into a map, and for a DenseMap<uint64_t, T> these are
248
+ // (uint64_t)0 and (uint64_t)-1. They can be and are
249
+ // represented using 32 bit integers.
250
+ assert ((uint64_t )Imm != DenseMapInfo<uint64_t >::getEmptyKey () &&
251
+ (uint64_t )Imm != DenseMapInfo<uint64_t >::getTombstoneKey () &&
252
+ " empty and tombstone keys should fit in 32 bits!" );
253
+ auto Result = ConstPool.insert (std::make_pair (Imm, Imm));
254
+ Locs.emplace_back (Location::ConstantIndex, sizeof (int64_t ), 0 ,
255
+ Result.first - ConstPool.begin ());
256
+ }
242
257
break ;
243
258
}
244
259
}
@@ -497,27 +512,6 @@ void StackMaps::recordStackMapOpers(const MCSymbol &MILabel,
497
512
while (MOI != MOE)
498
513
MOI = parseOperand (MOI, MOE, Locations, LiveOuts);
499
514
500
- // Move large constants into the constant pool.
501
- for (auto &Loc : Locations) {
502
- // Constants are encoded as sign-extended integers.
503
- // -1 is directly encoded as .long 0xFFFFFFFF with no constant pool.
504
- if (Loc.Type == Location::Constant && !isInt<32 >(Loc.Offset )) {
505
- Loc.Type = Location::ConstantIndex;
506
- // ConstPool is intentionally a MapVector of 'uint64_t's (as
507
- // opposed to 'int64_t's). We should never be in a situation
508
- // where we have to insert either the tombstone or the empty
509
- // keys into a map, and for a DenseMap<uint64_t, T> these are
510
- // (uint64_t)0 and (uint64_t)-1. They can be and are
511
- // represented using 32 bit integers.
512
- assert ((uint64_t )Loc.Offset != DenseMapInfo<uint64_t >::getEmptyKey () &&
513
- (uint64_t )Loc.Offset !=
514
- DenseMapInfo<uint64_t >::getTombstoneKey () &&
515
- " empty and tombstone keys should fit in 32 bits!" );
516
- auto Result = ConstPool.insert (std::make_pair (Loc.Offset , Loc.Offset ));
517
- Loc.Offset = Result.first - ConstPool.begin ();
518
- }
519
- }
520
-
521
515
// Create an expression to calculate the offset of the callsite from function
522
516
// entry.
523
517
const MCExpr *CSOffsetExpr = MCBinaryExpr::createSub (
0 commit comments