summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Hexagon
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2015-12-05 17:34:07 +0000
committerCraig Topper <craig.topper@gmail.com>2015-12-05 17:34:07 +0000
commit5c32279bee06f1827771b02e9f37376ef8773dba (patch)
tree87a4da6023af47661052065d2827715a1f4f9b57 /llvm/lib/Target/Hexagon
parente03fae4f1c4d5c54dfcea4946a6a95f3cd27ad9d (diff)
downloadbcm5719-llvm-5c32279bee06f1827771b02e9f37376ef8773dba.tar.gz
bcm5719-llvm-5c32279bee06f1827771b02e9f37376ef8773dba.zip
[Hexagon] Don't call getNumImplicitDefs and then iterate over the count. getNumImplicitDefs contains a loop so its better to just loop over the null terminated implicit def list. NFC
llvm-svn: 254852
Diffstat (limited to 'llvm/lib/Target/Hexagon')
-rw-r--r--llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCChecker.cpp49
1 files changed, 25 insertions, 24 deletions
diff --git a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCChecker.cpp b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCChecker.cpp
index fefe7543f39..46b7b41fec3 100644
--- a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCChecker.cpp
+++ b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCChecker.cpp
@@ -85,32 +85,33 @@ void HexagonMCChecker::init(MCInst const& MCI) {
}
// Get implicit register definitions.
- const MCPhysReg *ImpDefs = MCID.getImplicitDefs();
- for (unsigned i = 0; i < MCID.getNumImplicitDefs(); ++i) {
- unsigned R = ImpDefs[i];
+ if (const MCPhysReg *ImpDef = MCID.getImplicitDefs())
+ for (; *ImpDef; ++ImpDef) {
+ unsigned R = *ImpDef;
- if (Hexagon::R31 != R && MCID.isCall())
- // Any register other than the LR and the PC are actually volatile ones
- // as defined by the ABI, not modified implicitly by the call insn.
- continue;
- if (Hexagon::PC == R)
- // Branches are the only insns that can change the PC,
- // otherwise a read-only register.
- continue;
+ if (Hexagon::R31 != R && MCID.isCall())
+ // Any register other than the LR and the PC are actually volatile ones
+ // as defined by the ABI, not modified implicitly by the call insn.
+ continue;
+ if (Hexagon::PC == R)
+ // Branches are the only insns that can change the PC,
+ // otherwise a read-only register.
+ continue;
- if (Hexagon::USR_OVF == R)
- // Many insns change the USR implicitly, but only one or another flag.
- // The instruction table models the USR.OVF flag, which can be implicitly
- // modified more than once, but cannot be modified in the same packet
- // with an instruction that modifies is explicitly. Deal with such situ-
- // ations individually.
- SoftDefs.insert(R);
- else if (isPredicateRegister(R) && HexagonMCInstrInfo::isPredicateLate(MCII, MCI))
- // Include implicit late predicates.
- LatePreds.insert(R);
- else
- Defs[R].insert(PredSense(PredReg, isTrue));
- }
+ if (Hexagon::USR_OVF == R)
+ // Many insns change the USR implicitly, but only one or another flag.
+ // The instruction table models the USR.OVF flag, which can be implicitly
+ // modified more than once, but cannot be modified in the same packet
+ // with an instruction that modifies is explicitly. Deal with such situ-
+ // ations individually.
+ SoftDefs.insert(R);
+ else if (isPredicateRegister(R) &&
+ HexagonMCInstrInfo::isPredicateLate(MCII, MCI))
+ // Include implicit late predicates.
+ LatePreds.insert(R);
+ else
+ Defs[R].insert(PredSense(PredReg, isTrue));
+ }
// Figure out explicit register definitions.
for (unsigned i = 0; i < MCID.getNumDefs(); ++i) {
OpenPOWER on IntegriCloud