diff options
author | Alkis Evlogimenos <alkis@evlogimenos.com> | 2003-10-08 05:20:08 +0000 |
---|---|---|
committer | Alkis Evlogimenos <alkis@evlogimenos.com> | 2003-10-08 05:20:08 +0000 |
commit | 73ff5120eb8b8c0ccbfed8a17f1024c67a75f319 (patch) | |
tree | ea737ea5c41b893d3584c3c2d2f0ba5e118d929d /utils/TableGen/InstrInfoEmitter.cpp | |
parent | 6b8b22585c8ee1ee9bed9c218c604dfb3d88a851 (diff) | |
download | external_llvm-73ff5120eb8b8c0ccbfed8a17f1024c67a75f319.zip external_llvm-73ff5120eb8b8c0ccbfed8a17f1024c67a75f319.tar.gz external_llvm-73ff5120eb8b8c0ccbfed8a17f1024c67a75f319.tar.bz2 |
Change MRegisterDesc::AliasSet, TargetInstrDescriptor::ImplicitDefs
and TargetInstrDescriptor::ImplicitUses to always point to a null
terminated array and never be null. So there is no need to check for
pointer validity when iterating over those sets. Code that looked
like:
if (const unsigned* AS = TID.ImplicitDefs) {
for (int i = 0; AS[i]; ++i) {
// use AS[i]
}
}
was changed to:
for (const unsigned* AS = TID.ImplicitDefs; *AS; ++AS) {
// use *AS
}
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8960 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/InstrInfoEmitter.cpp')
-rw-r--r-- | utils/TableGen/InstrInfoEmitter.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/utils/TableGen/InstrInfoEmitter.cpp b/utils/TableGen/InstrInfoEmitter.cpp index c794cd0..7b64f92 100644 --- a/utils/TableGen/InstrInfoEmitter.cpp +++ b/utils/TableGen/InstrInfoEmitter.cpp @@ -65,6 +65,10 @@ void InstrInfoEmitter::run(std::ostream &OS) { std::vector<Record*> Instructions = Records.getAllDerivedDefinitions("Instruction"); + // Emit empty implicit uses and defs lists + OS << "static const unsigned EmptyImpUses[] = { 0 };\n" + << "static const unsigned EmptyImpDefs[] = { 0 };\n"; + // Emit all of the instruction's implicit uses and defs... for (unsigned i = 0, e = Instructions.size(); i != e; ++i) { Record *Inst = Instructions[i]; @@ -113,13 +117,13 @@ void InstrInfoEmitter::emitRecord(Record *R, unsigned Num, Record *InstrInfo, // Emit the implicit uses and defs lists... LI = R->getValueAsListInit("Uses"); if (!LI->getSize()) - OS << "0, "; + OS << "EmptyImpUses, "; else OS << R->getName() << "ImpUses, "; LI = R->getValueAsListInit("Defs"); if (!LI->getSize()) - OS << "0 "; + OS << "EmptyImpDefs "; else OS << R->getName() << "ImpDefs "; |