PPCDarwinAsmPrinter::EmitStartOfAsmFile(): Add checking range in CPUDirectives[].

llvm-svn: 174298
This commit is contained in:
NAKAMURA Takumi 2013-02-04 00:47:38 +00:00
parent 3d591ae0b9
commit 80159432de
1 changed files with 4 additions and 1 deletions

View File

@ -841,8 +841,11 @@ void PPCDarwinAsmPrinter::EmitStartOfAsmFile(Module &M) {
assert(Directive <= PPC::DIR_64 && "Directive out of range.");
// FIXME: This is a total hack, finish mc'izing the PPC backend.
if (OutStreamer.hasRawTextSupport())
if (OutStreamer.hasRawTextSupport()) {
assert(Directive < sizeof(CPUDirectives) / sizeof(*CPUDirectives) &&
"CPUDirectives[] might not be up-to-date!");
OutStreamer.EmitRawText("\t.machine " + Twine(CPUDirectives[Directive]));
}
// Prime text sections so they are adjacent. This reduces the likelihood a
// large data or debug section causes a branch to exceed 16M limit.