1284184Sdim 2284184Sdim//=== HexagonMCCompound.cpp - Hexagon Compound checker -------===// 3284184Sdim// 4284184Sdim// The LLVM Compiler Infrastructure 5284184Sdim// 6284184Sdim// This file is distributed under the University of Illinois Open Source 7284184Sdim// License. See LICENSE.TXT for details. 8284184Sdim// 9284184Sdim//===----------------------------------------------------------------------===// 10284184Sdim// 11284184Sdim// This file is looks at a packet and tries to form compound insns 12284184Sdim// 13284184Sdim//===----------------------------------------------------------------------===// 14284184Sdim#include "Hexagon.h" 15284184Sdim#include "MCTargetDesc/HexagonBaseInfo.h" 16284184Sdim#include "MCTargetDesc/HexagonMCShuffler.h" 17284184Sdim#include "llvm/ADT/StringExtras.h" 18284184Sdim#include "llvm/MC/MCAssembler.h" 19284184Sdim#include "llvm/MC/MCContext.h" 20284184Sdim#include "llvm/MC/MCInst.h" 21284184Sdim#include "llvm/MC/MCSectionELF.h" 22284184Sdim#include "llvm/MC/MCStreamer.h" 23284184Sdim#include "llvm/MC/MCSymbol.h" 24284184Sdim#include "llvm/Support/Debug.h" 25284184Sdim#include "llvm/Support/raw_ostream.h" 26284184Sdim 27284184Sdimusing namespace llvm; 28284184Sdimusing namespace Hexagon; 29284184Sdim 30284184Sdim#define DEBUG_TYPE "hexagon-mccompound" 31284184Sdim 32284184Sdimenum OpcodeIndex { 33284184Sdim fp0_jump_nt = 0, 34284184Sdim fp0_jump_t, 35284184Sdim fp1_jump_nt, 36284184Sdim fp1_jump_t, 37284184Sdim tp0_jump_nt, 38284184Sdim tp0_jump_t, 39284184Sdim tp1_jump_nt, 40284184Sdim tp1_jump_t 41284184Sdim}; 42284184Sdim 43284734Sdimstatic const unsigned tstBitOpcode[8] = { 44284734Sdim J4_tstbit0_fp0_jump_nt, J4_tstbit0_fp0_jump_t, J4_tstbit0_fp1_jump_nt, 45284734Sdim J4_tstbit0_fp1_jump_t, J4_tstbit0_tp0_jump_nt, J4_tstbit0_tp0_jump_t, 46284734Sdim J4_tstbit0_tp1_jump_nt, J4_tstbit0_tp1_jump_t}; 47284734Sdimstatic const unsigned cmpeqBitOpcode[8] = { 48284734Sdim J4_cmpeq_fp0_jump_nt, J4_cmpeq_fp0_jump_t, J4_cmpeq_fp1_jump_nt, 49284734Sdim J4_cmpeq_fp1_jump_t, J4_cmpeq_tp0_jump_nt, J4_cmpeq_tp0_jump_t, 50284734Sdim J4_cmpeq_tp1_jump_nt, J4_cmpeq_tp1_jump_t}; 51284734Sdimstatic const unsigned cmpgtBitOpcode[8] = { 52284734Sdim J4_cmpgt_fp0_jump_nt, J4_cmpgt_fp0_jump_t, J4_cmpgt_fp1_jump_nt, 53284734Sdim J4_cmpgt_fp1_jump_t, J4_cmpgt_tp0_jump_nt, J4_cmpgt_tp0_jump_t, 54284734Sdim J4_cmpgt_tp1_jump_nt, J4_cmpgt_tp1_jump_t}; 55284734Sdimstatic const unsigned cmpgtuBitOpcode[8] = { 56284734Sdim J4_cmpgtu_fp0_jump_nt, J4_cmpgtu_fp0_jump_t, J4_cmpgtu_fp1_jump_nt, 57284734Sdim J4_cmpgtu_fp1_jump_t, J4_cmpgtu_tp0_jump_nt, J4_cmpgtu_tp0_jump_t, 58284734Sdim J4_cmpgtu_tp1_jump_nt, J4_cmpgtu_tp1_jump_t}; 59284734Sdimstatic const unsigned cmpeqiBitOpcode[8] = { 60284734Sdim J4_cmpeqi_fp0_jump_nt, J4_cmpeqi_fp0_jump_t, J4_cmpeqi_fp1_jump_nt, 61284734Sdim J4_cmpeqi_fp1_jump_t, J4_cmpeqi_tp0_jump_nt, J4_cmpeqi_tp0_jump_t, 62284734Sdim J4_cmpeqi_tp1_jump_nt, J4_cmpeqi_tp1_jump_t}; 63284734Sdimstatic const unsigned cmpgtiBitOpcode[8] = { 64284734Sdim J4_cmpgti_fp0_jump_nt, J4_cmpgti_fp0_jump_t, J4_cmpgti_fp1_jump_nt, 65284734Sdim J4_cmpgti_fp1_jump_t, J4_cmpgti_tp0_jump_nt, J4_cmpgti_tp0_jump_t, 66284734Sdim J4_cmpgti_tp1_jump_nt, J4_cmpgti_tp1_jump_t}; 67284734Sdimstatic const unsigned cmpgtuiBitOpcode[8] = { 68284734Sdim J4_cmpgtui_fp0_jump_nt, J4_cmpgtui_fp0_jump_t, J4_cmpgtui_fp1_jump_nt, 69284734Sdim J4_cmpgtui_fp1_jump_t, J4_cmpgtui_tp0_jump_nt, J4_cmpgtui_tp0_jump_t, 70284734Sdim J4_cmpgtui_tp1_jump_nt, J4_cmpgtui_tp1_jump_t}; 71284734Sdimstatic const unsigned cmpeqn1BitOpcode[8] = { 72284734Sdim J4_cmpeqn1_fp0_jump_nt, J4_cmpeqn1_fp0_jump_t, J4_cmpeqn1_fp1_jump_nt, 73284734Sdim J4_cmpeqn1_fp1_jump_t, J4_cmpeqn1_tp0_jump_nt, J4_cmpeqn1_tp0_jump_t, 74284734Sdim J4_cmpeqn1_tp1_jump_nt, J4_cmpeqn1_tp1_jump_t}; 75284734Sdimstatic const unsigned cmpgtn1BitOpcode[8] = { 76284184Sdim J4_cmpgtn1_fp0_jump_nt, J4_cmpgtn1_fp0_jump_t, J4_cmpgtn1_fp1_jump_nt, 77284184Sdim J4_cmpgtn1_fp1_jump_t, J4_cmpgtn1_tp0_jump_nt, J4_cmpgtn1_tp0_jump_t, 78284184Sdim J4_cmpgtn1_tp1_jump_nt, J4_cmpgtn1_tp1_jump_t, 79284184Sdim}; 80284184Sdim 81284184Sdim// enum HexagonII::CompoundGroup 82284184Sdimnamespace { 83284184Sdimunsigned getCompoundCandidateGroup(MCInst const &MI, bool IsExtended) { 84284184Sdim unsigned DstReg, SrcReg, Src1Reg, Src2Reg; 85284184Sdim 86284184Sdim switch (MI.getOpcode()) { 87284184Sdim default: 88284184Sdim return HexagonII::HCG_None; 89284184Sdim // 90284184Sdim // Compound pairs. 91284184Sdim // "p0=cmp.eq(Rs16,Rt16); if (p0.new) jump:nt #r9:2" 92284184Sdim // "Rd16=#U6 ; jump #r9:2" 93284184Sdim // "Rd16=Rs16 ; jump #r9:2" 94284184Sdim // 95284184Sdim case Hexagon::C2_cmpeq: 96284184Sdim case Hexagon::C2_cmpgt: 97284184Sdim case Hexagon::C2_cmpgtu: 98284184Sdim if (IsExtended) 99284184Sdim return false; 100284184Sdim DstReg = MI.getOperand(0).getReg(); 101284184Sdim Src1Reg = MI.getOperand(1).getReg(); 102284184Sdim Src2Reg = MI.getOperand(2).getReg(); 103284184Sdim if ((Hexagon::P0 == DstReg || Hexagon::P1 == DstReg) && 104284184Sdim HexagonMCInstrInfo::isIntRegForSubInst(Src1Reg) && 105284184Sdim HexagonMCInstrInfo::isIntRegForSubInst(Src2Reg)) 106284184Sdim return HexagonII::HCG_A; 107284184Sdim break; 108284184Sdim case Hexagon::C2_cmpeqi: 109284184Sdim case Hexagon::C2_cmpgti: 110284184Sdim case Hexagon::C2_cmpgtui: 111284184Sdim if (IsExtended) 112284184Sdim return false; 113284184Sdim // P0 = cmp.eq(Rs,#u2) 114284184Sdim DstReg = MI.getOperand(0).getReg(); 115284184Sdim SrcReg = MI.getOperand(1).getReg(); 116284184Sdim if ((Hexagon::P0 == DstReg || Hexagon::P1 == DstReg) && 117284184Sdim HexagonMCInstrInfo::isIntRegForSubInst(SrcReg) && 118296417Sdim (HexagonMCInstrInfo::inRange<5>(MI, 2) || 119296417Sdim HexagonMCInstrInfo::minConstant(MI, 2) == -1)) 120284184Sdim return HexagonII::HCG_A; 121284184Sdim break; 122284184Sdim case Hexagon::A2_tfr: 123284184Sdim if (IsExtended) 124284184Sdim return false; 125284184Sdim // Rd = Rs 126284184Sdim DstReg = MI.getOperand(0).getReg(); 127284184Sdim SrcReg = MI.getOperand(1).getReg(); 128284184Sdim if (HexagonMCInstrInfo::isIntRegForSubInst(DstReg) && 129284184Sdim HexagonMCInstrInfo::isIntRegForSubInst(SrcReg)) 130284184Sdim return HexagonII::HCG_A; 131284184Sdim break; 132284184Sdim case Hexagon::A2_tfrsi: 133284184Sdim if (IsExtended) 134284184Sdim return false; 135284184Sdim // Rd = #u6 136284184Sdim DstReg = MI.getOperand(0).getReg(); 137296417Sdim if (HexagonMCInstrInfo::minConstant(MI, 1) <= 63 && 138296417Sdim HexagonMCInstrInfo::minConstant(MI, 1) >= 0 && 139284184Sdim HexagonMCInstrInfo::isIntRegForSubInst(DstReg)) 140284184Sdim return HexagonII::HCG_A; 141284184Sdim break; 142284184Sdim case Hexagon::S2_tstbit_i: 143284184Sdim if (IsExtended) 144284184Sdim return false; 145284184Sdim DstReg = MI.getOperand(0).getReg(); 146284184Sdim Src1Reg = MI.getOperand(1).getReg(); 147284184Sdim if ((Hexagon::P0 == DstReg || Hexagon::P1 == DstReg) && 148284184Sdim HexagonMCInstrInfo::isIntRegForSubInst(Src1Reg) && 149296417Sdim HexagonMCInstrInfo::minConstant(MI, 2) == 0) 150284184Sdim return HexagonII::HCG_A; 151284184Sdim break; 152284184Sdim // The fact that .new form is used pretty much guarantees 153284184Sdim // that predicate register will match. Nevertheless, 154284184Sdim // there could be some false positives without additional 155284184Sdim // checking. 156284184Sdim case Hexagon::J2_jumptnew: 157284184Sdim case Hexagon::J2_jumpfnew: 158284184Sdim case Hexagon::J2_jumptnewpt: 159284184Sdim case Hexagon::J2_jumpfnewpt: 160284184Sdim Src1Reg = MI.getOperand(0).getReg(); 161284184Sdim if (Hexagon::P0 == Src1Reg || Hexagon::P1 == Src1Reg) 162284184Sdim return HexagonII::HCG_B; 163284184Sdim break; 164284184Sdim // Transfer and jump: 165284184Sdim // Rd=#U6 ; jump #r9:2 166284184Sdim // Rd=Rs ; jump #r9:2 167284184Sdim // Do not test for jump range here. 168284184Sdim case Hexagon::J2_jump: 169284184Sdim case Hexagon::RESTORE_DEALLOC_RET_JMP_V4: 170284184Sdim return HexagonII::HCG_C; 171284184Sdim break; 172284184Sdim } 173284184Sdim 174284184Sdim return HexagonII::HCG_None; 175284184Sdim} 176285181Sdim} 177284184Sdim 178284184Sdim/// getCompoundOp - Return the index from 0-7 into the above opcode lists. 179284184Sdimnamespace { 180284184Sdimunsigned getCompoundOp(MCInst const &HMCI) { 181284184Sdim const MCOperand &Predicate = HMCI.getOperand(0); 182284184Sdim unsigned PredReg = Predicate.getReg(); 183284184Sdim 184284184Sdim assert((PredReg == Hexagon::P0) || (PredReg == Hexagon::P1) || 185284184Sdim (PredReg == Hexagon::P2) || (PredReg == Hexagon::P3)); 186284184Sdim 187284184Sdim switch (HMCI.getOpcode()) { 188284184Sdim default: 189284184Sdim llvm_unreachable("Expected match not found.\n"); 190284184Sdim break; 191284184Sdim case Hexagon::J2_jumpfnew: 192284184Sdim return (PredReg == Hexagon::P0) ? fp0_jump_nt : fp1_jump_nt; 193284184Sdim case Hexagon::J2_jumpfnewpt: 194284184Sdim return (PredReg == Hexagon::P0) ? fp0_jump_t : fp1_jump_t; 195284184Sdim case Hexagon::J2_jumptnew: 196284184Sdim return (PredReg == Hexagon::P0) ? tp0_jump_nt : tp1_jump_nt; 197284184Sdim case Hexagon::J2_jumptnewpt: 198284184Sdim return (PredReg == Hexagon::P0) ? tp0_jump_t : tp1_jump_t; 199284184Sdim } 200284184Sdim} 201285181Sdim} 202284184Sdim 203284184Sdimnamespace { 204284184SdimMCInst *getCompoundInsn(MCContext &Context, MCInst const &L, MCInst const &R) { 205284184Sdim MCInst *CompoundInsn = 0; 206284184Sdim unsigned compoundOpcode; 207284184Sdim MCOperand Rs, Rt; 208296417Sdim int64_t Value; 209296417Sdim bool Success; 210284184Sdim 211284184Sdim switch (L.getOpcode()) { 212284184Sdim default: 213284184Sdim DEBUG(dbgs() << "Possible compound ignored\n"); 214284184Sdim return CompoundInsn; 215284184Sdim 216284184Sdim case Hexagon::A2_tfrsi: 217284184Sdim Rt = L.getOperand(0); 218284184Sdim compoundOpcode = J4_jumpseti; 219284184Sdim CompoundInsn = new (Context) MCInst; 220284184Sdim CompoundInsn->setOpcode(compoundOpcode); 221284184Sdim 222284184Sdim CompoundInsn->addOperand(Rt); 223284184Sdim CompoundInsn->addOperand(L.getOperand(1)); // Immediate 224284184Sdim CompoundInsn->addOperand(R.getOperand(0)); // Jump target 225284184Sdim break; 226284184Sdim 227284184Sdim case Hexagon::A2_tfr: 228284184Sdim Rt = L.getOperand(0); 229284184Sdim Rs = L.getOperand(1); 230284184Sdim 231284184Sdim compoundOpcode = J4_jumpsetr; 232284184Sdim CompoundInsn = new (Context) MCInst; 233284184Sdim CompoundInsn->setOpcode(compoundOpcode); 234284184Sdim CompoundInsn->addOperand(Rt); 235284184Sdim CompoundInsn->addOperand(Rs); 236284184Sdim CompoundInsn->addOperand(R.getOperand(0)); // Jump target. 237284184Sdim 238284184Sdim break; 239284184Sdim 240284184Sdim case Hexagon::C2_cmpeq: 241284184Sdim DEBUG(dbgs() << "CX: C2_cmpeq\n"); 242284184Sdim Rs = L.getOperand(1); 243284184Sdim Rt = L.getOperand(2); 244284184Sdim 245284184Sdim compoundOpcode = cmpeqBitOpcode[getCompoundOp(R)]; 246284184Sdim CompoundInsn = new (Context) MCInst; 247284184Sdim CompoundInsn->setOpcode(compoundOpcode); 248284184Sdim CompoundInsn->addOperand(Rs); 249284184Sdim CompoundInsn->addOperand(Rt); 250284184Sdim CompoundInsn->addOperand(R.getOperand(1)); 251284184Sdim break; 252284184Sdim 253284184Sdim case Hexagon::C2_cmpgt: 254284184Sdim DEBUG(dbgs() << "CX: C2_cmpgt\n"); 255284184Sdim Rs = L.getOperand(1); 256284184Sdim Rt = L.getOperand(2); 257284184Sdim 258284184Sdim compoundOpcode = cmpgtBitOpcode[getCompoundOp(R)]; 259284184Sdim CompoundInsn = new (Context) MCInst; 260284184Sdim CompoundInsn->setOpcode(compoundOpcode); 261284184Sdim CompoundInsn->addOperand(Rs); 262284184Sdim CompoundInsn->addOperand(Rt); 263284184Sdim CompoundInsn->addOperand(R.getOperand(1)); 264284184Sdim break; 265284184Sdim 266284184Sdim case Hexagon::C2_cmpgtu: 267284184Sdim DEBUG(dbgs() << "CX: C2_cmpgtu\n"); 268284184Sdim Rs = L.getOperand(1); 269284184Sdim Rt = L.getOperand(2); 270284184Sdim 271284184Sdim compoundOpcode = cmpgtuBitOpcode[getCompoundOp(R)]; 272284184Sdim CompoundInsn = new (Context) MCInst; 273284184Sdim CompoundInsn->setOpcode(compoundOpcode); 274284184Sdim CompoundInsn->addOperand(Rs); 275284184Sdim CompoundInsn->addOperand(Rt); 276284184Sdim CompoundInsn->addOperand(R.getOperand(1)); 277284184Sdim break; 278284184Sdim 279284184Sdim case Hexagon::C2_cmpeqi: 280284184Sdim DEBUG(dbgs() << "CX: C2_cmpeqi\n"); 281296417Sdim Success = L.getOperand(2).getExpr()->evaluateAsAbsolute(Value); 282296417Sdim (void)Success; 283296417Sdim assert(Success); 284296417Sdim if (Value == -1) 285284184Sdim compoundOpcode = cmpeqn1BitOpcode[getCompoundOp(R)]; 286284184Sdim else 287284184Sdim compoundOpcode = cmpeqiBitOpcode[getCompoundOp(R)]; 288284184Sdim 289284184Sdim Rs = L.getOperand(1); 290284184Sdim CompoundInsn = new (Context) MCInst; 291284184Sdim CompoundInsn->setOpcode(compoundOpcode); 292284184Sdim CompoundInsn->addOperand(Rs); 293296417Sdim if (Value != -1) 294284184Sdim CompoundInsn->addOperand(L.getOperand(2)); 295284184Sdim CompoundInsn->addOperand(R.getOperand(1)); 296284184Sdim break; 297284184Sdim 298284184Sdim case Hexagon::C2_cmpgti: 299284184Sdim DEBUG(dbgs() << "CX: C2_cmpgti\n"); 300296417Sdim Success = L.getOperand(2).getExpr()->evaluateAsAbsolute(Value); 301296417Sdim (void)Success; 302296417Sdim assert(Success); 303296417Sdim if (Value == -1) 304284184Sdim compoundOpcode = cmpgtn1BitOpcode[getCompoundOp(R)]; 305284184Sdim else 306284184Sdim compoundOpcode = cmpgtiBitOpcode[getCompoundOp(R)]; 307284184Sdim 308284184Sdim Rs = L.getOperand(1); 309284184Sdim CompoundInsn = new (Context) MCInst; 310284184Sdim CompoundInsn->setOpcode(compoundOpcode); 311284184Sdim CompoundInsn->addOperand(Rs); 312296417Sdim if (Value != -1) 313284184Sdim CompoundInsn->addOperand(L.getOperand(2)); 314284184Sdim CompoundInsn->addOperand(R.getOperand(1)); 315284184Sdim break; 316284184Sdim 317284184Sdim case Hexagon::C2_cmpgtui: 318284184Sdim DEBUG(dbgs() << "CX: C2_cmpgtui\n"); 319284184Sdim Rs = L.getOperand(1); 320284184Sdim compoundOpcode = cmpgtuiBitOpcode[getCompoundOp(R)]; 321284184Sdim CompoundInsn = new (Context) MCInst; 322284184Sdim CompoundInsn->setOpcode(compoundOpcode); 323284184Sdim CompoundInsn->addOperand(Rs); 324284184Sdim CompoundInsn->addOperand(L.getOperand(2)); 325284184Sdim CompoundInsn->addOperand(R.getOperand(1)); 326284184Sdim break; 327284184Sdim 328284184Sdim case Hexagon::S2_tstbit_i: 329284184Sdim DEBUG(dbgs() << "CX: S2_tstbit_i\n"); 330284184Sdim Rs = L.getOperand(1); 331284184Sdim compoundOpcode = tstBitOpcode[getCompoundOp(R)]; 332284184Sdim CompoundInsn = new (Context) MCInst; 333284184Sdim CompoundInsn->setOpcode(compoundOpcode); 334284184Sdim CompoundInsn->addOperand(Rs); 335284184Sdim CompoundInsn->addOperand(R.getOperand(1)); 336284184Sdim break; 337284184Sdim } 338284184Sdim 339284184Sdim return CompoundInsn; 340284184Sdim} 341285181Sdim} 342284184Sdim 343284184Sdim/// Non-Symmetrical. See if these two instructions are fit for compound pair. 344284184Sdimnamespace { 345284184Sdimbool isOrderedCompoundPair(MCInst const &MIa, bool IsExtendedA, 346284184Sdim MCInst const &MIb, bool IsExtendedB) { 347284184Sdim unsigned MIaG = getCompoundCandidateGroup(MIa, IsExtendedA); 348284184Sdim unsigned MIbG = getCompoundCandidateGroup(MIb, IsExtendedB); 349284184Sdim // We have two candidates - check that this is the same register 350284184Sdim // we are talking about. 351284184Sdim unsigned Opca = MIa.getOpcode(); 352284184Sdim if (MIaG == HexagonII::HCG_A && MIbG == HexagonII::HCG_C && 353284184Sdim (Opca == Hexagon::A2_tfr || Opca == Hexagon::A2_tfrsi)) 354284184Sdim return true; 355284184Sdim return ((MIaG == HexagonII::HCG_A && MIbG == HexagonII::HCG_B) && 356284184Sdim (MIa.getOperand(0).getReg() == MIb.getOperand(0).getReg())); 357284184Sdim} 358285181Sdim} 359284184Sdim 360284184Sdimnamespace { 361284184Sdimbool lookForCompound(MCInstrInfo const &MCII, MCContext &Context, MCInst &MCI) { 362284184Sdim assert(HexagonMCInstrInfo::isBundle(MCI)); 363284184Sdim bool JExtended = false; 364284184Sdim for (MCInst::iterator J = 365284184Sdim MCI.begin() + HexagonMCInstrInfo::bundleInstructionsOffset; 366284184Sdim J != MCI.end(); ++J) { 367284184Sdim MCInst const *JumpInst = J->getInst(); 368284184Sdim if (HexagonMCInstrInfo::isImmext(*JumpInst)) { 369284184Sdim JExtended = true; 370284184Sdim continue; 371284184Sdim } 372284184Sdim if (llvm::HexagonMCInstrInfo::getType(MCII, *JumpInst) == 373284184Sdim HexagonII::TypeJ) { 374284184Sdim // Try to pair with another insn (B)undled with jump. 375284184Sdim bool BExtended = false; 376284184Sdim for (MCInst::iterator B = 377284184Sdim MCI.begin() + HexagonMCInstrInfo::bundleInstructionsOffset; 378284184Sdim B != MCI.end(); ++B) { 379284184Sdim MCInst const *Inst = B->getInst(); 380284184Sdim if (JumpInst == Inst) 381284184Sdim continue; 382284184Sdim if (HexagonMCInstrInfo::isImmext(*Inst)) { 383284184Sdim BExtended = true; 384284184Sdim continue; 385284184Sdim } 386284184Sdim DEBUG(dbgs() << "J,B: " << JumpInst->getOpcode() << "," 387284184Sdim << Inst->getOpcode() << "\n"); 388284184Sdim if (isOrderedCompoundPair(*Inst, BExtended, *JumpInst, JExtended)) { 389284184Sdim MCInst *CompoundInsn = getCompoundInsn(Context, *Inst, *JumpInst); 390284184Sdim if (CompoundInsn) { 391284184Sdim DEBUG(dbgs() << "B: " << Inst->getOpcode() << "," 392284184Sdim << JumpInst->getOpcode() << " Compounds to " 393284184Sdim << CompoundInsn->getOpcode() << "\n"); 394284184Sdim J->setInst(CompoundInsn); 395284184Sdim MCI.erase(B); 396284184Sdim return true; 397284184Sdim } 398284184Sdim } 399284184Sdim BExtended = false; 400284184Sdim } 401284184Sdim } 402284184Sdim JExtended = false; 403284184Sdim } 404284184Sdim return false; 405284184Sdim} 406285181Sdim} 407284184Sdim 408284184Sdim/// tryCompound - Given a bundle check for compound insns when one 409284184Sdim/// is found update the contents fo the bundle with the compound insn. 410284184Sdim/// If a compound instruction is found then the bundle will have one 411284184Sdim/// additional slot. 412284184Sdimvoid HexagonMCInstrInfo::tryCompound(MCInstrInfo const &MCII, 413284184Sdim MCContext &Context, MCInst &MCI) { 414296417Sdim assert(HexagonMCInstrInfo::isBundle(MCI) && 415284184Sdim "Non-Bundle where Bundle expected"); 416284184Sdim 417284184Sdim // By definition a compound must have 2 insn. 418284184Sdim if (MCI.size() < 2) 419284184Sdim return; 420284184Sdim 421284184Sdim // Look for compounds until none are found, only update the bundle when 422284184Sdim // a compound is found. 423284184Sdim while (lookForCompound(MCII, Context, MCI)) 424284184Sdim ; 425284184Sdim 426284184Sdim return; 427284184Sdim} 428