@@ -129,6 +129,11 @@ class SystemZMCCodeEmitter : public MCCodeEmitter {
129
129
};
130
130
131
131
} // end anonymous namespace
132
+ //
133
+ static void addFixup (SmallVectorImpl<MCFixup> &Fixups, uint32_t Offset,
134
+ const MCExpr *Value, uint16_t Kind, bool PCRel = false ) {
135
+ Fixups.push_back (MCFixup::create (Offset, Value, Kind, PCRel));
136
+ }
132
137
133
138
void SystemZMCCodeEmitter::encodeInstruction (const MCInst &MI,
134
139
SmallVectorImpl<char > &CB,
@@ -170,8 +175,7 @@ uint64_t SystemZMCCodeEmitter::getImmOpValue(const MCInst &MI, unsigned OpNum,
170
175
unsigned OpBitSize =
171
176
SystemZ::MCFixupKindInfos[Kind - FirstTargetFixupKind].TargetSize ;
172
177
uint32_t BitOffset = MIBitSize - RawBitOffset - OpBitSize;
173
- Fixups.push_back (
174
- MCFixup::create (BitOffset >> 3 , MO.getExpr (), (MCFixupKind)Kind));
178
+ addFixup (Fixups, BitOffset >> 3 , MO.getExpr (), Kind);
175
179
return 0 ;
176
180
}
177
181
llvm_unreachable (" Unexpected operand type!" );
@@ -206,13 +210,12 @@ SystemZMCCodeEmitter::getPCRelEncoding(const MCInst &MI, unsigned OpNum,
206
210
Expr = MCBinaryExpr::createAdd (Expr, OffsetExpr, Ctx, Loc);
207
211
}
208
212
}
209
- Fixups. push_back ( MCFixup::create ( Offset, Expr, Kind, true ) );
213
+ addFixup (Fixups, Offset, Expr, Kind, true );
210
214
211
215
// Output the fixup for the TLS marker if present.
212
216
if (AllowTLS && OpNum + 1 < MI.getNumOperands ()) {
213
217
const MCOperand &MOTLS = MI.getOperand (OpNum + 1 );
214
- Fixups.push_back (MCFixup::create (0 , MOTLS.getExpr (),
215
- (MCFixupKind)SystemZ::FK_390_TLS_CALL));
218
+ addFixup (Fixups, 0 , MOTLS.getExpr (), SystemZ::FK_390_TLS_CALL);
216
219
}
217
220
return 0 ;
218
221
}
0 commit comments