Skip to content

Commit

Permalink
[Hexagon] Update AnalyzeBranch, etc target hooks
Browse files Browse the repository at this point in the history
Improved the AnalyzeBranch, InsertBranch, and RemoveBranch
functions in order to handle more of our branch instructions.
This requires changes to analyzeCompare and PredicateInstructions.
Specifically, we've added support for new value compare jumps,
improved handling of endloop, added more compare instructions,
and improved support for predicate instructions.

Differential Revision: http://reviews.llvm.org/D9559

llvm-svn: 236876
  • Loading branch information
Brendon Cahoon committed May 8, 2015
1 parent f7b5480 commit df43e68
Show file tree
Hide file tree
Showing 5 changed files with 1,005 additions and 274 deletions.
14 changes: 8 additions & 6 deletions llvm/lib/Target/Hexagon/HexagonHardwareLoops.cpp
Expand Up @@ -369,10 +369,10 @@ bool HexagonHardwareLoops::findInductionRegister(MachineLoop *L,
bool NotAnalyzed = TII->AnalyzeBranch(*Latch, TB, FB, Cond, false);
if (NotAnalyzed)
return false;

unsigned CSz = Cond.size();
assert (CSz == 1 || CSz == 2);
unsigned PredR = Cond[CSz-1].getReg();
unsigned PredR, PredPos, PredRegFlags;
if (!TII->getPredReg(Cond, PredR, PredPos, PredRegFlags))
return false;

MachineInstr *PredI = MRI->getVRegDef(PredR);
if (!PredI->isCompare())
Expand Down Expand Up @@ -491,8 +491,10 @@ CountValue *HexagonHardwareLoops::getLoopTripCount(MachineLoop *L,
// to put imm(0), followed by P in the vector Cond.
// If TB is not the header, it means that the "not-taken" path must lead
// to the header.
bool Negated = (Cond.size() > 1) ^ (TB != Header);
unsigned PredReg = Cond[Cond.size()-1].getReg();
bool Negated = TII->predOpcodeHasNot(Cond) ^ (TB != Header);
unsigned PredReg, PredPos, PredRegFlags;
if (!TII->getPredReg(Cond, PredReg, PredPos, PredRegFlags))
return nullptr;
MachineInstr *CondI = MRI->getVRegDef(PredReg);
unsigned CondOpc = CondI->getOpcode();

Expand Down

0 comments on commit df43e68

Please sign in to comment.