File tree Expand file tree Collapse file tree 2 files changed +6
-22
lines changed Expand file tree Collapse file tree 2 files changed +6
-22
lines changed Original file line number Diff line number Diff line change @@ -138,21 +138,9 @@ bool MCAsmBackend::isDarwinCanonicalPersonality(const MCSymbol *Sym) const {
138
138
139
139
const MCSubtargetInfo *MCAsmBackend::getSubtargetInfo (const MCFragment &F) {
140
140
const MCSubtargetInfo *STI = nullptr ;
141
- switch (F.getKind ()) {
142
- case MCFragment::FT_Data: {
143
- auto &DF = cast<MCDataFragment>(F);
144
- STI = DF.getSubtargetInfo ();
145
- assert (!DF.hasInstructions () || STI != nullptr );
146
- break ;
147
- }
148
- case MCFragment::FT_Relaxable: {
149
- auto &RF = cast<MCRelaxableFragment>(F);
150
- STI = RF.getSubtargetInfo ();
151
- assert (!RF.hasInstructions () || STI != nullptr );
152
- break ;
153
- }
154
- default :
155
- break ;
141
+ if (auto *DF = dyn_cast<MCEncodedFragment>(&F)) {
142
+ STI = DF->getSubtargetInfo ();
143
+ assert (!DF->hasInstructions () || STI != nullptr );
156
144
}
157
145
return STI;
158
146
}
Original file line number Diff line number Diff line change @@ -422,14 +422,10 @@ static size_t getSizeForInstFragment(const MCFragment *F) {
422
422
if (!F || !F->hasInstructions ())
423
423
return 0 ;
424
424
// MCEncodedFragmentWithContents being templated makes this tricky.
425
- switch (F->getKind ()) {
426
- default :
425
+ if (auto *DF = dyn_cast<MCEncodedFragment>(F))
426
+ return DF->getContents ().size ();
427
+ else
427
428
llvm_unreachable (" Unknown fragment with instructions!" );
428
- case MCFragment::FT_Data:
429
- return cast<MCDataFragment>(*F).getContents ().size ();
430
- case MCFragment::FT_Relaxable:
431
- return cast<MCRelaxableFragment>(*F).getContents ().size ();
432
- }
433
429
}
434
430
435
431
// / Return true if we can insert NOP or prefixes automatically before the
You can’t perform that action at this time.
0 commit comments