#ifndef LLVM_LIB_TARGET_M68K_MCTARGETDESC_M68KBASEINFO_H
#define LLVM_LIB_TARGET_M68K_MCTARGETDESC_M68KBASEINFO_H
#include "M68kMCTargetDesc.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/Support/DataTypes.h"
#include "llvm/Support/ErrorHandling.h"
#define GET_INSTRINFO_MI_OPS_INFO
#define GET_INSTRINFO_OPERAND_TYPES_ENUM
#define GET_INSTRINFO_LOGICAL_OPERAND_SIZE_MAP
#include "M68kGenInstrInfo.inc"
namespace llvm {
namespace M68k {
enum { MemDisp = 0, MemBase = 1, MemIndex = 2, MemOuter = 3 };
enum { PCRelDisp = 0, PCRelIndex = 1, PCRelOuter = 2 };
}
namespace M68kBeads {
enum {
Ctrl = 0x0,
Bits1 = 0x1,
Bits2 = 0x2,
Bits3 = 0x3,
Bits4 = 0x4,
DAReg = 0x5,
DA = 0x6,
Reg = 0x7,
DReg = 0x8,
Disp8 = 0x9,
Imm8 = 0xA,
Imm16 = 0xB,
Imm32 = 0xC,
Imm3 = 0xD,
};
enum {
Term = 0x0,
Ignore = 0x1,
};
}
namespace M68kII {
enum TOF {
MO_NO_FLAG,
MO_ABSOLUTE_ADDRESS,
MO_PC_RELATIVE_ADDRESS,
MO_GOT,
MO_GOTOFF,
MO_GOTPCREL,
MO_PLT,
};
inline static bool isGlobalStubReference(unsigned char TargetFlag) {
switch (TargetFlag) {
default:
return false;
case M68kII::MO_GOTPCREL: case M68kII::MO_GOT: return true;
}
}
inline static bool isDirectGlobalReference(unsigned char Flag) {
switch (Flag) {
default:
return false;
case M68kII::MO_NO_FLAG:
case M68kII::MO_ABSOLUTE_ADDRESS:
case M68kII::MO_PC_RELATIVE_ADDRESS:
return true;
}
}
inline static bool isGlobalRelativeToPICBase(unsigned char TargetFlag) {
switch (TargetFlag) {
default:
return false;
case M68kII::MO_GOTOFF: case M68kII::MO_GOT: return true;
}
}
inline static bool isPCRelGlobalReference(unsigned char Flag) {
switch (Flag) {
default:
return false;
case M68kII::MO_GOTPCREL:
case M68kII::MO_PC_RELATIVE_ADDRESS:
return true;
}
}
inline static bool isPCRelBlockReference(unsigned char Flag) {
switch (Flag) {
default:
return false;
case M68kII::MO_PC_RELATIVE_ADDRESS:
return true;
}
}
static inline bool isAddressRegister(unsigned RegNo) {
switch (RegNo) {
case M68k::WA0:
case M68k::WA1:
case M68k::WA2:
case M68k::WA3:
case M68k::WA4:
case M68k::WA5:
case M68k::WA6:
case M68k::WSP:
case M68k::A0:
case M68k::A1:
case M68k::A2:
case M68k::A3:
case M68k::A4:
case M68k::A5:
case M68k::A6:
case M68k::SP:
return true;
default:
return false;
}
}
static inline bool hasMultiMIOperands(unsigned Op, unsigned LogicalOpIdx) {
return M68k::getLogicalOperandSize(Op, LogicalOpIdx) > 1;
}
static inline unsigned getMaskedSpillRegister(unsigned order) {
switch (order) {
default:
return 0;
case 0:
return M68k::D0;
case 1:
return M68k::D1;
case 2:
return M68k::D2;
case 3:
return M68k::D3;
case 4:
return M68k::D4;
case 5:
return M68k::D5;
case 6:
return M68k::D6;
case 7:
return M68k::D7;
case 8:
return M68k::A0;
case 9:
return M68k::A1;
case 10:
return M68k::A2;
case 11:
return M68k::A3;
case 12:
return M68k::A4;
case 13:
return M68k::A5;
case 14:
return M68k::A6;
case 15:
return M68k::SP;
}
}
}
}
#endif