@@ -68,25 +68,38 @@ static VECC::CondCode GetOppositeBranchCondition(VECC::CondCode CC) {
68
68
llvm_unreachable (" Invalid cond code" );
69
69
}
70
70
71
- // Treat br.l [BCR AT] as unconditional branch
71
+ // Treat br.l [BRCF AT] as unconditional branch
72
72
static bool isUncondBranchOpcode (int Opc) {
73
- return Opc == VE::BCRLa || Opc == VE::BCRWa ||
74
- Opc == VE::BCRDa || Opc == VE::BCRSa;
73
+ return Opc == VE::BRCFLa || Opc == VE::BRCFWa ||
74
+ Opc == VE::BRCFLa_nt || Opc == VE::BRCFWa_nt ||
75
+ Opc == VE::BRCFLa_t || Opc == VE::BRCFWa_t ||
76
+ Opc == VE::BRCFDa || Opc == VE::BRCFSa ||
77
+ Opc == VE::BRCFDa_nt || Opc == VE::BRCFSa_nt ||
78
+ Opc == VE::BRCFDa_t || Opc == VE::BRCFSa_t;
75
79
}
76
80
77
81
static bool isCondBranchOpcode (int Opc) {
78
- return Opc == VE::BCRLrr || Opc == VE::BCRLir ||
79
- Opc == VE::BCRLrm0 || Opc == VE::BCRLrm1 ||
80
- Opc == VE::BCRLim0 || Opc == VE::BCRLim1 ||
81
- Opc == VE::BCRWrr || Opc == VE::BCRWir ||
82
- Opc == VE::BCRWrm0 || Opc == VE::BCRWrm1 ||
83
- Opc == VE::BCRWim0 || Opc == VE::BCRWim1 ||
84
- Opc == VE::BCRDrr || Opc == VE::BCRDir ||
85
- Opc == VE::BCRDrm0 || Opc == VE::BCRDrm1 ||
86
- Opc == VE::BCRDim0 || Opc == VE::BCRDim1 ||
87
- Opc == VE::BCRSrr || Opc == VE::BCRSir ||
88
- Opc == VE::BCRSrm0 || Opc == VE::BCRSrm1 ||
89
- Opc == VE::BCRSim0 || Opc == VE::BCRSim1;
82
+ return Opc == VE::BRCFLrr || Opc == VE::BRCFLir ||
83
+ Opc == VE::BRCFLrr_nt || Opc == VE::BRCFLir_nt ||
84
+ Opc == VE::BRCFLrr_t || Opc == VE::BRCFLir_t ||
85
+ Opc == VE::BRCFWrr || Opc == VE::BRCFWir ||
86
+ Opc == VE::BRCFWrr_nt || Opc == VE::BRCFWir_nt ||
87
+ Opc == VE::BRCFWrr_t || Opc == VE::BRCFWir_t ||
88
+ Opc == VE::BRCFDrr || Opc == VE::BRCFDir ||
89
+ Opc == VE::BRCFDrr_nt || Opc == VE::BRCFDir_nt ||
90
+ Opc == VE::BRCFDrr_t || Opc == VE::BRCFDir_t ||
91
+ Opc == VE::BRCFSrr || Opc == VE::BRCFSir ||
92
+ Opc == VE::BRCFSrr_nt || Opc == VE::BRCFSir_nt ||
93
+ Opc == VE::BRCFSrr_t || Opc == VE::BRCFSir_t;
94
+ }
95
+
96
+ static bool isIndirectBranchOpcode (int Opc) {
97
+ return Opc == VE::BCFLari || Opc == VE::BCFLari ||
98
+ Opc == VE::BCFLari_nt || Opc == VE::BCFLari_nt ||
99
+ Opc == VE::BCFLari_t || Opc == VE::BCFLari_t ||
100
+ Opc == VE::BCFLari || Opc == VE::BCFLari ||
101
+ Opc == VE::BCFLari_nt || Opc == VE::BCFLari_nt ||
102
+ Opc == VE::BCFLari_t || Opc == VE::BCFLari_t;
90
103
}
91
104
92
105
static void parseCondBranch (MachineInstr *LastInst, MachineBasicBlock *&Target,
@@ -165,14 +178,14 @@ bool VEInstrInfo::analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
165
178
return false ;
166
179
}
167
180
168
- // TODO ...likewise if it ends with an indirect branch followed by an unconditional
181
+ // ...likewise if it ends with an indirect branch followed by an unconditional
169
182
// branch.
170
- // if (isIndirectBranchOpcode(SecondLastOpc) && isUncondBranchOpcode(LastOpc)) {
171
- // I = LastInst;
172
- // if (AllowModify)
173
- // I->eraseFromParent();
174
- // return true;
175
- // }
183
+ if (isIndirectBranchOpcode (SecondLastOpc) && isUncondBranchOpcode (LastOpc)) {
184
+ I = LastInst;
185
+ if (AllowModify)
186
+ I->eraseFromParent ();
187
+ return true ;
188
+ }
176
189
177
190
// Otherwise, can't handle this.
178
191
return true ;
@@ -190,13 +203,13 @@ unsigned VEInstrInfo::insertBranch(MachineBasicBlock &MBB,
190
203
if (Cond.empty ()) {
191
204
// Uncondition branch
192
205
assert (!FBB && " Unconditional branch with multiple successors!" );
193
- BuildMI (&MBB, DL, get (VE::BCRLa ))
206
+ BuildMI (&MBB, DL, get (VE::BRCFLa_t ))
194
207
.addMBB (TBB);
195
208
return 1 ;
196
209
}
197
210
198
211
// Conditional branch
199
- // (BCRir CC sy sz addr)
212
+ // (BRCFir CC sy sz addr)
200
213
assert (Cond[0 ].isImm () && Cond[2 ].isReg () && " not implemented" );
201
214
202
215
unsigned opc[2 ];
@@ -206,19 +219,19 @@ unsigned VEInstrInfo::insertBranch(MachineBasicBlock &MBB,
206
219
unsigned Reg = Cond[2 ].getReg ();
207
220
if (IsIntegerCC (Cond[0 ].getImm ())) {
208
221
if (TRI->getRegSizeInBits (Reg, MRI) == 32 ) {
209
- opc[0 ] = VE::BCRWir ;
210
- opc[1 ] = VE::BCRWrr ;
222
+ opc[0 ] = VE::BRCFWir ;
223
+ opc[1 ] = VE::BRCFWrr ;
211
224
} else {
212
- opc[0 ] = VE::BCRLir ;
213
- opc[1 ] = VE::BCRLrr ;
225
+ opc[0 ] = VE::BRCFLir ;
226
+ opc[1 ] = VE::BRCFLrr ;
214
227
}
215
228
} else {
216
229
if (TRI->getRegSizeInBits (Reg, MRI) == 32 ) {
217
- opc[0 ] = VE::BCRSir ;
218
- opc[1 ] = VE::BCRSrr ;
230
+ opc[0 ] = VE::BRCFSir ;
231
+ opc[1 ] = VE::BRCFSrr ;
219
232
} else {
220
- opc[0 ] = VE::BCRDir ;
221
- opc[1 ] = VE::BCRDrr ;
233
+ opc[0 ] = VE::BRCFDir ;
234
+ opc[1 ] = VE::BRCFDrr ;
222
235
}
223
236
}
224
237
if (Cond[1 ].isImm ()) {
@@ -238,7 +251,7 @@ unsigned VEInstrInfo::insertBranch(MachineBasicBlock &MBB,
238
251
if (!FBB)
239
252
return 1 ;
240
253
241
- BuildMI (&MBB, DL, get (VE::BCRLa ))
254
+ BuildMI (&MBB, DL, get (VE::BRCFLa_t ))
242
255
.addMBB (FBB);
243
256
return 2 ;
244
257
}
@@ -488,7 +501,7 @@ bool VEInstrInfo::expandExtendStackPseudo(MachineInstr &MI) const {
488
501
// Next, add the true and fallthrough blocks as its successors.
489
502
BB->addSuccessor (syscallMBB);
490
503
BB->addSuccessor (sinkMBB);
491
- BuildMI (BB, dl, TII.get (VE::BCRLrr ))
504
+ BuildMI (BB, dl, TII.get (VE::BRCFLrr_t ))
492
505
.addImm (VECC::CC_IGE)
493
506
.addReg (VE::SX11) // %sp
494
507
.addReg (VE::SX8) // %sl
0 commit comments