1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00
llvm-mirror/lib/Target/X86/X86GenRegisterBankInfo.def
Igor Breger 8b3f28cdb1 [X86][GlobalISel] Add general-purpose Register Bank
Summary:
[X86][GlobalISel] Add general-purpose Register Bank.
Add trivial  handling of G_ADD legalization .
Add Regestry Bank selection for COPY and G_ADD  instructions

Reviewers: rovka, zvi, ab, t.p.northover, qcolombet

Reviewed By: qcolombet

Subscribers: qcolombet, mgorny, dberris, kristof.beyls, llvm-commits

Differential Revision: https://reviews.llvm.org/D29771

llvm-svn: 294723
2017-02-10 07:05:56 +00:00

61 lines
1.8 KiB
C++

//===- X86GenRegisterBankInfo.def ----------------------------*- C++ -*-==//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
/// \file
/// This file defines all the static objects used by X86RegisterBankInfo.
/// \todo This should be generated by TableGen.
//===----------------------------------------------------------------------===//
#ifndef LLVM_BUILD_GLOBAL_ISEL
#error "You shouldn't build this"
#endif
namespace llvm {
RegisterBankInfo::PartialMapping X86GenRegisterBankInfo::PartMappings[]{
/* StartIdx, Length, RegBank */
// GPR value
{0, 8, X86::GPRRegBank}, // :0
{0, 16, X86::GPRRegBank}, // :1
{0, 32, X86::GPRRegBank}, // :2
{0, 64, X86::GPRRegBank}, // :3
};
enum PartialMappingIdx {
PMI_None = -1,
PMI_GPR8,
PMI_GPR16,
PMI_GPR32,
PMI_GPR64,
};
#define INSTR_3OP(INFO) INFO, INFO, INFO,
#define BREAKDOWN(INDEX, NUM) \
{ &X86GenRegisterBankInfo::PartMappings[INDEX], NUM }
// ValueMappings.
RegisterBankInfo::ValueMapping X86GenRegisterBankInfo::ValMappings[]{
/* BreakDown, NumBreakDowns */
// 3-operands instructions (all binary operations should end up with one of
// those mapping).
INSTR_3OP(BREAKDOWN(PMI_GPR8, 1)) // 0: GPR_8
INSTR_3OP(BREAKDOWN(PMI_GPR16, 1)) // 3: GPR_16
INSTR_3OP(BREAKDOWN(PMI_GPR32, 1)) // 6: GPR_32
INSTR_3OP(BREAKDOWN(PMI_GPR64, 1)) // 9: GPR_64
};
#undef INSTR_3OP
#undef BREAKDOWN
enum ValueMappingIdx {
VMI_None = -1,
VMI_3OpsGpr8Idx = 0,
VMI_3OpsGpr16Idx = 3,
VMI_3OpsGpr32Idx = 6,
VMI_3OpsGpr64Idx = 9,
};
} // End llvm namespace.