@@ -305,8 +305,7 @@ void RISCVAsmPrinter::emitNTLHint(const MachineInstr *MI) {
305
305
}
306
306
307
307
void RISCVAsmPrinter::emitInstruction (const MachineInstr *MI) {
308
- RISCV_MC::verifyInstructionPredicates (MI->getOpcode (),
309
- getSubtargetInfo ().getFeatureBits ());
308
+ RISCV_MC::verifyInstructionPredicates (MI->getOpcode (), STI->getFeatureBits ());
310
309
311
310
emitNTLHint (MI);
312
311
@@ -517,12 +516,9 @@ void RISCVAsmPrinter::emitSled(const MachineInstr *MI, SledKind Kind) {
517
516
// Assuming we're using JAL to jump to .tmpN, then we only need
518
517
// (68 - 4)/2 = 32 NOPs for RV64 and (44 - 4)/2 = 20 for RV32. However, there
519
518
// is a chance that we'll use C.JAL instead, so an additional NOP is needed.
520
- const uint8_t NoopsInSledCount =
521
- MI->getParent ()->getParent ()->getSubtarget <RISCVSubtarget>().is64Bit ()
522
- ? 33
523
- : 21 ;
519
+ const uint8_t NoopsInSledCount = STI->is64Bit () ? 33 : 21 ;
524
520
525
- OutStreamer->emitCodeAlignment (Align (4 ), & getSubtargetInfo () );
521
+ OutStreamer->emitCodeAlignment (Align (4 ), STI );
526
522
auto CurSled = OutContext.createTempSymbol (" xray_sled_" , true );
527
523
OutStreamer->emitLabel (CurSled);
528
524
auto Target = OutContext.createTempSymbol ();
@@ -1070,22 +1066,17 @@ bool RISCVAsmPrinter::lowerOperand(const MachineOperand &MO,
1070
1066
}
1071
1067
1072
1068
static bool lowerRISCVVMachineInstrToMCInst (const MachineInstr *MI,
1073
- MCInst &OutMI) {
1069
+ MCInst &OutMI,
1070
+ const RISCVSubtarget *STI) {
1074
1071
const RISCVVPseudosTable::PseudoInfo *RVV =
1075
1072
RISCVVPseudosTable::getPseudoInfo (MI->getOpcode ());
1076
1073
if (!RVV)
1077
1074
return false ;
1078
1075
1079
1076
OutMI.setOpcode (RVV->BaseInstr );
1080
1077
1081
- const MachineBasicBlock *MBB = MI->getParent ();
1082
- assert (MBB && " MI expected to be in a basic block" );
1083
- const MachineFunction *MF = MBB->getParent ();
1084
- assert (MF && " MBB expected to be in a machine function" );
1085
-
1086
- const RISCVSubtarget &Subtarget = MF->getSubtarget <RISCVSubtarget>();
1087
- const TargetInstrInfo *TII = Subtarget.getInstrInfo ();
1088
- const TargetRegisterInfo *TRI = Subtarget.getRegisterInfo ();
1078
+ const TargetInstrInfo *TII = STI->getInstrInfo ();
1079
+ const TargetRegisterInfo *TRI = STI->getRegisterInfo ();
1089
1080
assert (TRI && " TargetRegisterInfo expected" );
1090
1081
1091
1082
const MCInstrDesc &MCID = MI->getDesc ();
@@ -1182,7 +1173,7 @@ static bool lowerRISCVVMachineInstrToMCInst(const MachineInstr *MI,
1182
1173
}
1183
1174
1184
1175
bool RISCVAsmPrinter::lowerToMCInst (const MachineInstr *MI, MCInst &OutMI) {
1185
- if (lowerRISCVVMachineInstrToMCInst (MI, OutMI))
1176
+ if (lowerRISCVVMachineInstrToMCInst (MI, OutMI, STI ))
1186
1177
return false ;
1187
1178
1188
1179
OutMI.setOpcode (MI->getOpcode ());
0 commit comments