2006-02-05 13:50:24 +08:00
|
|
|
//===-- Sparc.h - Top-level interface for Sparc representation --*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-30 04:36:04 +08:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2006-02-05 13:50:24 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file contains the entry points for global functions defined in the LLVM
|
|
|
|
// Sparc back-end.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-08-14 00:26:38 +08:00
|
|
|
#ifndef LLVM_LIB_TARGET_SPARC_SPARC_H
|
|
|
|
#define LLVM_LIB_TARGET_SPARC_SPARC_H
|
2006-02-05 13:50:24 +08:00
|
|
|
|
2011-07-15 04:59:42 +08:00
|
|
|
#include "MCTargetDesc/SparcMCTargetDesc.h"
|
2009-07-12 04:10:48 +08:00
|
|
|
#include "llvm/Support/ErrorHandling.h"
|
2009-04-30 07:29:43 +08:00
|
|
|
#include "llvm/Target/TargetMachine.h"
|
2006-02-05 13:50:24 +08:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
class FunctionPass;
|
2008-10-04 00:55:19 +08:00
|
|
|
class SparcTargetMachine;
|
2009-07-15 04:18:05 +08:00
|
|
|
class formatted_raw_ostream;
|
2013-12-26 09:49:59 +08:00
|
|
|
class AsmPrinter;
|
|
|
|
class MCInst;
|
|
|
|
class MachineInstr;
|
2006-02-05 13:50:24 +08:00
|
|
|
|
2008-10-04 00:55:19 +08:00
|
|
|
FunctionPass *createSparcISelDag(SparcTargetMachine &TM);
|
2006-02-05 13:50:24 +08:00
|
|
|
FunctionPass *createSparcDelaySlotFillerPass(TargetMachine &TM);
|
2009-07-19 07:03:22 +08:00
|
|
|
|
2013-12-26 09:49:59 +08:00
|
|
|
void LowerSparcMachineInstrToMCInst(const MachineInstr *MI,
|
|
|
|
MCInst &OutMI,
|
|
|
|
AsmPrinter &AP);
|
2015-06-23 17:49:53 +08:00
|
|
|
} // end namespace llvm;
|
2006-02-05 13:50:24 +08:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
// Enums corresponding to Sparc condition codes, both icc's and fcc's. These
|
|
|
|
// values must be kept in sync with the ones in the .td file.
|
|
|
|
namespace SPCC {
|
|
|
|
enum CondCodes {
|
2014-03-02 04:08:48 +08:00
|
|
|
ICC_A = 8 , // Always
|
|
|
|
ICC_N = 0 , // Never
|
2006-02-05 13:50:24 +08:00
|
|
|
ICC_NE = 9 , // Not Equal
|
|
|
|
ICC_E = 1 , // Equal
|
|
|
|
ICC_G = 10 , // Greater
|
|
|
|
ICC_LE = 2 , // Less or Equal
|
|
|
|
ICC_GE = 11 , // Greater or Equal
|
|
|
|
ICC_L = 3 , // Less
|
|
|
|
ICC_GU = 12 , // Greater Unsigned
|
|
|
|
ICC_LEU = 4 , // Less or Equal Unsigned
|
|
|
|
ICC_CC = 13 , // Carry Clear/Great or Equal Unsigned
|
|
|
|
ICC_CS = 5 , // Carry Set/Less Unsigned
|
|
|
|
ICC_POS = 14 , // Positive
|
|
|
|
ICC_NEG = 6 , // Negative
|
|
|
|
ICC_VC = 15 , // Overflow Clear
|
|
|
|
ICC_VS = 7 , // Overflow Set
|
2013-06-05 02:33:25 +08:00
|
|
|
|
2014-03-02 04:08:48 +08:00
|
|
|
FCC_A = 8+16, // Always
|
|
|
|
FCC_N = 0+16, // Never
|
2006-02-05 13:50:24 +08:00
|
|
|
FCC_U = 7+16, // Unordered
|
|
|
|
FCC_G = 6+16, // Greater
|
|
|
|
FCC_UG = 5+16, // Unordered or Greater
|
|
|
|
FCC_L = 4+16, // Less
|
|
|
|
FCC_UL = 3+16, // Unordered or Less
|
|
|
|
FCC_LG = 2+16, // Less or Greater
|
|
|
|
FCC_NE = 1+16, // Not Equal
|
|
|
|
FCC_E = 9+16, // Equal
|
|
|
|
FCC_UE = 10+16, // Unordered or Equal
|
|
|
|
FCC_GE = 11+16, // Greater or Equal
|
|
|
|
FCC_UGE = 12+16, // Unordered or Greater or Equal
|
|
|
|
FCC_LE = 13+16, // Less or Equal
|
|
|
|
FCC_ULE = 14+16, // Unordered or Less or Equal
|
2006-05-25 01:04:05 +08:00
|
|
|
FCC_O = 15+16 // Ordered
|
2006-02-05 13:50:24 +08:00
|
|
|
};
|
2015-06-23 17:49:53 +08:00
|
|
|
}
|
2013-06-05 02:33:25 +08:00
|
|
|
|
2006-11-03 09:11:05 +08:00
|
|
|
inline static const char *SPARCCondCodeToString(SPCC::CondCodes CC) {
|
2006-02-05 13:50:24 +08:00
|
|
|
switch (CC) {
|
2014-03-02 04:08:48 +08:00
|
|
|
case SPCC::ICC_A: return "a";
|
|
|
|
case SPCC::ICC_N: return "n";
|
2006-02-05 13:50:24 +08:00
|
|
|
case SPCC::ICC_NE: return "ne";
|
|
|
|
case SPCC::ICC_E: return "e";
|
|
|
|
case SPCC::ICC_G: return "g";
|
|
|
|
case SPCC::ICC_LE: return "le";
|
|
|
|
case SPCC::ICC_GE: return "ge";
|
|
|
|
case SPCC::ICC_L: return "l";
|
|
|
|
case SPCC::ICC_GU: return "gu";
|
|
|
|
case SPCC::ICC_LEU: return "leu";
|
|
|
|
case SPCC::ICC_CC: return "cc";
|
|
|
|
case SPCC::ICC_CS: return "cs";
|
|
|
|
case SPCC::ICC_POS: return "pos";
|
|
|
|
case SPCC::ICC_NEG: return "neg";
|
|
|
|
case SPCC::ICC_VC: return "vc";
|
|
|
|
case SPCC::ICC_VS: return "vs";
|
2014-03-02 04:08:48 +08:00
|
|
|
case SPCC::FCC_A: return "a";
|
|
|
|
case SPCC::FCC_N: return "n";
|
2006-02-05 13:50:24 +08:00
|
|
|
case SPCC::FCC_U: return "u";
|
|
|
|
case SPCC::FCC_G: return "g";
|
|
|
|
case SPCC::FCC_UG: return "ug";
|
|
|
|
case SPCC::FCC_L: return "l";
|
|
|
|
case SPCC::FCC_UL: return "ul";
|
|
|
|
case SPCC::FCC_LG: return "lg";
|
|
|
|
case SPCC::FCC_NE: return "ne";
|
|
|
|
case SPCC::FCC_E: return "e";
|
|
|
|
case SPCC::FCC_UE: return "ue";
|
|
|
|
case SPCC::FCC_GE: return "ge";
|
|
|
|
case SPCC::FCC_UGE: return "uge";
|
|
|
|
case SPCC::FCC_LE: return "le";
|
|
|
|
case SPCC::FCC_ULE: return "ule";
|
|
|
|
case SPCC::FCC_O: return "o";
|
2012-01-11 04:47:20 +08:00
|
|
|
}
|
|
|
|
llvm_unreachable("Invalid cond code");
|
2006-02-05 13:50:24 +08:00
|
|
|
}
|
2013-11-25 04:23:25 +08:00
|
|
|
|
|
|
|
inline static unsigned HI22(int64_t imm) {
|
|
|
|
return (unsigned)((imm >> 10) & ((1 << 22)-1));
|
|
|
|
}
|
|
|
|
|
|
|
|
inline static unsigned LO10(int64_t imm) {
|
|
|
|
return (unsigned)(imm & 0x3FF);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline static unsigned HIX22(int64_t imm) {
|
|
|
|
return HI22(~imm);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline static unsigned LOX10(int64_t imm) {
|
|
|
|
return ~LO10(~imm);
|
|
|
|
}
|
|
|
|
|
2006-02-05 13:50:24 +08:00
|
|
|
} // end namespace llvm
|
|
|
|
#endif
|