@@ -46,12 +46,14 @@ STATISTIC(NumRemovedSExtW, "Number of removed sign-extensions");
46
46
STATISTIC (NumTransformedToWInstrs,
47
47
" Number of instructions transformed to W-ops" );
48
48
49
- static cl::opt<bool > DisableSExtWRemoval (" loongarch-disable-sextw-removal" ,
50
- cl::desc (" Disable removal of sext.w" ),
51
- cl::init(false ), cl::Hidden);
52
- static cl::opt<bool > DisableStripWSuffix (" loongarch-disable-strip-w-suffix" ,
53
- cl::desc (" Disable strip W suffix" ),
54
- cl::init(false ), cl::Hidden);
49
+ static cl::opt<bool >
50
+ DisableSExtWRemoval (" loongarch-disable-sextw-removal" ,
51
+ cl::desc (" Disable removal of sign-extend insn" ),
52
+ cl::init(false ), cl::Hidden);
53
+ static cl::opt<bool >
54
+ DisableCvtToDSuffix (" loongarch-disable-cvt-to-d-suffix" ,
55
+ cl::desc (" Disable convert to D suffix" ),
56
+ cl::init(false ), cl::Hidden);
55
57
56
58
namespace {
57
59
@@ -65,10 +67,12 @@ class LoongArchOptWInstrs : public MachineFunctionPass {
65
67
bool removeSExtWInstrs (MachineFunction &MF, const LoongArchInstrInfo &TII,
66
68
const LoongArchSubtarget &ST,
67
69
MachineRegisterInfo &MRI);
68
- bool stripWSuffixes (MachineFunction &MF, const LoongArchInstrInfo &TII,
69
- const LoongArchSubtarget &ST, MachineRegisterInfo &MRI);
70
- bool appendWSuffixes (MachineFunction &MF, const LoongArchInstrInfo &TII,
71
- const LoongArchSubtarget &ST, MachineRegisterInfo &MRI);
70
+ bool convertToDSuffixes (MachineFunction &MF, const LoongArchInstrInfo &TII,
71
+ const LoongArchSubtarget &ST,
72
+ MachineRegisterInfo &MRI);
73
+ bool convertToWSuffixes (MachineFunction &MF, const LoongArchInstrInfo &TII,
74
+ const LoongArchSubtarget &ST,
75
+ MachineRegisterInfo &MRI);
72
76
73
77
void getAnalysisUsage (AnalysisUsage &AU) const override {
74
78
AU.setPreservesCFG ();
@@ -713,10 +717,10 @@ bool LoongArchOptWInstrs::removeSExtWInstrs(MachineFunction &MF,
713
717
return MadeChange;
714
718
}
715
719
716
- bool LoongArchOptWInstrs::stripWSuffixes (MachineFunction &MF,
717
- const LoongArchInstrInfo &TII,
718
- const LoongArchSubtarget &ST,
719
- MachineRegisterInfo &MRI) {
720
+ bool LoongArchOptWInstrs::convertToDSuffixes (MachineFunction &MF,
721
+ const LoongArchInstrInfo &TII,
722
+ const LoongArchSubtarget &ST,
723
+ MachineRegisterInfo &MRI) {
720
724
bool MadeChange = false ;
721
725
for (MachineBasicBlock &MBB : MF) {
722
726
for (MachineInstr &MI : MBB) {
@@ -739,10 +743,10 @@ bool LoongArchOptWInstrs::stripWSuffixes(MachineFunction &MF,
739
743
return MadeChange;
740
744
}
741
745
742
- bool LoongArchOptWInstrs::appendWSuffixes (MachineFunction &MF,
743
- const LoongArchInstrInfo &TII,
744
- const LoongArchSubtarget &ST,
745
- MachineRegisterInfo &MRI) {
746
+ bool LoongArchOptWInstrs::convertToWSuffixes (MachineFunction &MF,
747
+ const LoongArchInstrInfo &TII,
748
+ const LoongArchSubtarget &ST,
749
+ MachineRegisterInfo &MRI) {
746
750
bool MadeChange = false ;
747
751
for (MachineBasicBlock &MBB : MF) {
748
752
for (MachineInstr &MI : MBB) {
@@ -805,11 +809,11 @@ bool LoongArchOptWInstrs::runOnMachineFunction(MachineFunction &MF) {
805
809
bool MadeChange = false ;
806
810
MadeChange |= removeSExtWInstrs (MF, TII, ST, MRI);
807
811
808
- if (!(DisableStripWSuffix || ST.preferWInst ()))
809
- MadeChange |= stripWSuffixes (MF, TII, ST, MRI);
812
+ if (!(DisableCvtToDSuffix || ST.preferWInst ()))
813
+ MadeChange |= convertToDSuffixes (MF, TII, ST, MRI);
810
814
811
815
if (ST.preferWInst ())
812
- MadeChange |= appendWSuffixes (MF, TII, ST, MRI);
816
+ MadeChange |= convertToWSuffixes (MF, TII, ST, MRI);
813
817
814
818
return MadeChange;
815
819
}
0 commit comments