[PowerPC] Add predicted forms of branches

This adds support for the predicted forms of branches (+/-).
There are three cases to consider:
- Branches using a PPC::Predicate code
  For these, I've added new PPC::Predicate codes corresponding
  to the BO values for predicted branch forms, and updated insn
  printing to print them correctly.  I've also added new aliases
  for the asm parser matching the new forms.
- bt/bf
  I've added new aliases matching to gBC etc.
- bd(n)z variants
  I've added new instruction patterns for the predicted forms.

In all cases, the new patterns are used for the asm parser only.
(The new infrastructure ought to be sufficient to allow use by
the compiler too at some point.)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184754 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Ulrich Weigand
2013-06-24 16:52:04 +00:00
parent a6a3fd6415
commit 2e8bd89503
7 changed files with 1392 additions and 65 deletions

View File

@@ -747,6 +747,22 @@ bool PPCAsmParser::
ParseInstruction(ParseInstructionInfo &Info, StringRef Name, SMLoc NameLoc,
SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
// The first operand is the token for the instruction name.
// If the next character is a '+' or '-', we need to add it to the
// instruction name, to match what TableGen is doing.
if (getLexer().is(AsmToken::Plus)) {
getLexer().Lex();
char *NewOpcode = new char[Name.size() + 1];
memcpy(NewOpcode, Name.data(), Name.size());
NewOpcode[Name.size()] = '+';
Name = StringRef(NewOpcode, Name.size() + 1);
}
if (getLexer().is(AsmToken::Minus)) {
getLexer().Lex();
char *NewOpcode = new char[Name.size() + 1];
memcpy(NewOpcode, Name.data(), Name.size());
NewOpcode[Name.size()] = '-';
Name = StringRef(NewOpcode, Name.size() + 1);
}
// If the instruction ends in a '.', we need to create a separate
// token for it, to match what TableGen is doing.
size_t Dot = Name.find('.');