Minor cleanup to all the switches after MatchInstructionImpl in all the AsmParsers.

Make sure they all have llvm_unreachable on the default path out of the switch. Remove unnecessary "default: break". Remove a 'return' after unreachable. Fix some indentation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225114 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Craig Topper 2015-01-03 08:16:34 +00:00
parent 2717b066cc
commit 00d70e98f0
8 changed files with 19 additions and 28 deletions

View File

@ -3927,7 +3927,6 @@ bool AArch64AsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
} }
llvm_unreachable("Implement any new match types added!"); llvm_unreachable("Implement any new match types added!");
return true;
} }
/// ParseDirective parses the arm specific directives /// ParseDirective parses the arm specific directives

View File

@ -8575,7 +8575,6 @@ bool ARMAsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
MatchResult = MatchInstructionImpl(Operands, Inst, ErrorInfo, MatchResult = MatchInstructionImpl(Operands, Inst, ErrorInfo,
MatchingInlineAsm); MatchingInlineAsm);
switch (MatchResult) { switch (MatchResult) {
default: break;
case Match_Success: case Match_Success:
// Context sensitive operand constraints aren't handled by the matcher, // Context sensitive operand constraints aren't handled by the matcher,
// so check them here. // so check them here.

View File

@ -1852,8 +1852,6 @@ bool MipsAsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
MatchInstructionImpl(Operands, Inst, ErrorInfo, MatchingInlineAsm); MatchInstructionImpl(Operands, Inst, ErrorInfo, MatchingInlineAsm);
switch (MatchResult) { switch (MatchResult) {
default:
break;
case Match_Success: { case Match_Success: {
if (processInstruction(Inst, IDLoc, Instructions)) if (processInstruction(Inst, IDLoc, Instructions))
return true; return true;
@ -1882,7 +1880,8 @@ bool MipsAsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
case Match_RequiresDifferentSrcAndDst: case Match_RequiresDifferentSrcAndDst:
return Error(IDLoc, "source and destination must be different"); return Error(IDLoc, "source and destination must be different");
} }
return true;
llvm_unreachable("Implement any new match types added!");
} }
void MipsAsmParser::warnIfAssemblerTemporary(int RegIndex, SMLoc Loc) { void MipsAsmParser::warnIfAssemblerTemporary(int RegIndex, SMLoc Loc) {

View File

@ -1053,7 +1053,6 @@ bool PPCAsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
MCInst Inst; MCInst Inst;
switch (MatchInstructionImpl(Operands, Inst, ErrorInfo, MatchingInlineAsm)) { switch (MatchInstructionImpl(Operands, Inst, ErrorInfo, MatchingInlineAsm)) {
default: break;
case Match_Success: case Match_Success:
// Post-process instructions (typically extended mnemonics) // Post-process instructions (typically extended mnemonics)
ProcessInstruction(Inst, Operands); ProcessInstruction(Inst, Operands);

View File

@ -163,7 +163,6 @@ bool AMDGPUAsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
MCInst Inst; MCInst Inst;
switch (MatchInstructionImpl(Operands, Inst, ErrorInfo, MatchingInlineAsm)) { switch (MatchInstructionImpl(Operands, Inst, ErrorInfo, MatchingInlineAsm)) {
default: break;
case Match_Success: case Match_Success:
Inst.setLoc(IDLoc); Inst.setLoc(IDLoc);
Out.EmitInstruction(Inst, STI); Out.EmitInstruction(Inst, STI);

View File

@ -393,9 +393,6 @@ bool SparcAsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
unsigned MatchResult = MatchInstructionImpl(Operands, Inst, ErrorInfo, unsigned MatchResult = MatchInstructionImpl(Operands, Inst, ErrorInfo,
MatchingInlineAsm); MatchingInlineAsm);
switch (MatchResult) { switch (MatchResult) {
default:
break;
case Match_Success: { case Match_Success: {
Inst.setLoc(IDLoc); Inst.setLoc(IDLoc);
Out.EmitInstruction(Inst, STI); Out.EmitInstruction(Inst, STI);
@ -422,7 +419,7 @@ bool SparcAsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
case Match_MnemonicFail: case Match_MnemonicFail:
return Error(IDLoc, "invalid instruction mnemonic"); return Error(IDLoc, "invalid instruction mnemonic");
} }
return true; llvm_unreachable("Implement any new match types added!");
} }
bool SparcAsmParser:: bool SparcAsmParser::

View File

@ -685,7 +685,6 @@ bool SystemZAsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
MatchResult = MatchInstructionImpl(Operands, Inst, ErrorInfo, MatchResult = MatchInstructionImpl(Operands, Inst, ErrorInfo,
MatchingInlineAsm); MatchingInlineAsm);
switch (MatchResult) { switch (MatchResult) {
default: break;
case Match_Success: case Match_Success:
Inst.setLoc(IDLoc); Inst.setLoc(IDLoc);
Out.EmitInstruction(Inst, STI); Out.EmitInstruction(Inst, STI);

View File

@ -2432,7 +2432,7 @@ bool X86AsmParser::MatchAndEmitATTInstruction(SMLoc IDLoc, unsigned &Opcode,
switch (MatchInstructionImpl(Operands, Inst, switch (MatchInstructionImpl(Operands, Inst,
ErrorInfo, MatchingInlineAsm, ErrorInfo, MatchingInlineAsm,
isParsingIntelSyntax())) { isParsingIntelSyntax())) {
default: break; default: llvm_unreachable("Unexpected match result!");
case Match_Success: case Match_Success:
// Some instructions need post-processing to, for example, tweak which // Some instructions need post-processing to, for example, tweak which
// encoding is selected. Loop on it while changes happen so the // encoding is selected. Loop on it while changes happen so the