mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-21 16:31:16 +00:00
2e8bd89503
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
79 lines
3.2 KiB
C++
79 lines
3.2 KiB
C++
//===-- PPCPredicates.cpp - PPC Branch Predicate Information --------------===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file implements the PowerPC branch predicates.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "PPCPredicates.h"
|
|
#include "llvm/Support/ErrorHandling.h"
|
|
#include <cassert>
|
|
using namespace llvm;
|
|
|
|
PPC::Predicate PPC::InvertPredicate(PPC::Predicate Opcode) {
|
|
switch (Opcode) {
|
|
case PPC::PRED_EQ: return PPC::PRED_NE;
|
|
case PPC::PRED_NE: return PPC::PRED_EQ;
|
|
case PPC::PRED_LT: return PPC::PRED_GE;
|
|
case PPC::PRED_GE: return PPC::PRED_LT;
|
|
case PPC::PRED_GT: return PPC::PRED_LE;
|
|
case PPC::PRED_LE: return PPC::PRED_GT;
|
|
case PPC::PRED_NU: return PPC::PRED_UN;
|
|
case PPC::PRED_UN: return PPC::PRED_NU;
|
|
case PPC::PRED_EQ_MINUS: return PPC::PRED_NE_PLUS;
|
|
case PPC::PRED_NE_MINUS: return PPC::PRED_EQ_PLUS;
|
|
case PPC::PRED_LT_MINUS: return PPC::PRED_GE_PLUS;
|
|
case PPC::PRED_GE_MINUS: return PPC::PRED_LT_PLUS;
|
|
case PPC::PRED_GT_MINUS: return PPC::PRED_LE_PLUS;
|
|
case PPC::PRED_LE_MINUS: return PPC::PRED_GT_PLUS;
|
|
case PPC::PRED_NU_MINUS: return PPC::PRED_UN_PLUS;
|
|
case PPC::PRED_UN_MINUS: return PPC::PRED_NU_PLUS;
|
|
case PPC::PRED_EQ_PLUS: return PPC::PRED_NE_MINUS;
|
|
case PPC::PRED_NE_PLUS: return PPC::PRED_EQ_MINUS;
|
|
case PPC::PRED_LT_PLUS: return PPC::PRED_GE_MINUS;
|
|
case PPC::PRED_GE_PLUS: return PPC::PRED_LT_MINUS;
|
|
case PPC::PRED_GT_PLUS: return PPC::PRED_LE_MINUS;
|
|
case PPC::PRED_LE_PLUS: return PPC::PRED_GT_MINUS;
|
|
case PPC::PRED_NU_PLUS: return PPC::PRED_UN_MINUS;
|
|
case PPC::PRED_UN_PLUS: return PPC::PRED_NU_MINUS;
|
|
}
|
|
llvm_unreachable("Unknown PPC branch opcode!");
|
|
}
|
|
|
|
PPC::Predicate PPC::getSwappedPredicate(PPC::Predicate Opcode) {
|
|
switch (Opcode) {
|
|
case PPC::PRED_EQ: return PPC::PRED_EQ;
|
|
case PPC::PRED_NE: return PPC::PRED_NE;
|
|
case PPC::PRED_LT: return PPC::PRED_GT;
|
|
case PPC::PRED_GE: return PPC::PRED_LE;
|
|
case PPC::PRED_GT: return PPC::PRED_LT;
|
|
case PPC::PRED_LE: return PPC::PRED_GE;
|
|
case PPC::PRED_NU: return PPC::PRED_NU;
|
|
case PPC::PRED_UN: return PPC::PRED_UN;
|
|
case PPC::PRED_EQ_MINUS: return PPC::PRED_EQ_MINUS;
|
|
case PPC::PRED_NE_MINUS: return PPC::PRED_NE_MINUS;
|
|
case PPC::PRED_LT_MINUS: return PPC::PRED_GT_MINUS;
|
|
case PPC::PRED_GE_MINUS: return PPC::PRED_LE_MINUS;
|
|
case PPC::PRED_GT_MINUS: return PPC::PRED_LT_MINUS;
|
|
case PPC::PRED_LE_MINUS: return PPC::PRED_GE_MINUS;
|
|
case PPC::PRED_NU_MINUS: return PPC::PRED_NU_MINUS;
|
|
case PPC::PRED_UN_MINUS: return PPC::PRED_UN_MINUS;
|
|
case PPC::PRED_EQ_PLUS: return PPC::PRED_EQ_PLUS;
|
|
case PPC::PRED_NE_PLUS: return PPC::PRED_NE_PLUS;
|
|
case PPC::PRED_LT_PLUS: return PPC::PRED_GT_PLUS;
|
|
case PPC::PRED_GE_PLUS: return PPC::PRED_LE_PLUS;
|
|
case PPC::PRED_GT_PLUS: return PPC::PRED_LT_PLUS;
|
|
case PPC::PRED_LE_PLUS: return PPC::PRED_GE_PLUS;
|
|
case PPC::PRED_NU_PLUS: return PPC::PRED_NU_PLUS;
|
|
case PPC::PRED_UN_PLUS: return PPC::PRED_UN_PLUS;
|
|
}
|
|
llvm_unreachable("Unknown PPC branch opcode!");
|
|
}
|
|
|