[llvm] r222410 - Use array_lengthof instead of sizeof(array)/sizeof(element) in a tablegen output.
Craig Topper
craig.topper at gmail.com
Wed Nov 19 21:22:33 PST 2014
Author: ctopper
Date: Wed Nov 19 23:22:32 2014
New Revision: 222410
URL: http://llvm.org/viewvc/llvm-project?rev=222410&view=rev
Log:
Use array_lengthof instead of sizeof(array)/sizeof(element) in a tablegen output.
Modified:
llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp
Modified: llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp?rev=222410&r1=222409&r2=222410&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp Wed Nov 19 23:22:32 2014
@@ -379,9 +379,9 @@ RegisterInfoEmitter::EmitRegMappingTable
OS << "extern const unsigned " << Namespace
<< (j == 0 ? "DwarfFlavour" : "EHFlavour") << i << "Dwarf2LSize";
if (!isCtor)
- OS << " = sizeof(" << Namespace
+ OS << " = array_lengthof(" << Namespace
<< (j == 0 ? "DwarfFlavour" : "EHFlavour") << i
- << "Dwarf2L)/sizeof(MCRegisterInfo::DwarfLLVMRegPair);\n\n";
+ << "Dwarf2L);\n\n";
else
OS << ";\n\n";
}
@@ -427,9 +427,8 @@ RegisterInfoEmitter::EmitRegMappingTable
OS << "extern const unsigned " << Namespace
<< (j == 0 ? "DwarfFlavour" : "EHFlavour") << i << "L2DwarfSize";
if (!isCtor)
- OS << " = sizeof(" << Namespace
- << (j == 0 ? "DwarfFlavour" : "EHFlavour") << i
- << "L2Dwarf)/sizeof(MCRegisterInfo::DwarfLLVMRegPair);\n\n";
+ OS << " = array_lengthof(" << Namespace
+ << (j == 0 ? "DwarfFlavour" : "EHFlavour") << i << "L2Dwarf);\n\n";
else
OS << ";\n\n";
}
More information about the llvm-commits
mailing list