27 #ifndef LLVM_BUILD_GLOBAL_ISEL
28 #error "You shouldn't build this"
36 using namespace TargetOpcode;
48 for (
unsigned Op : {G_LOAD, G_STORE}) {
49 for (
auto Ty : {s1, s8, s16, s32, p0})
54 for (
unsigned Op : {G_ADD, G_SUB, G_MUL, G_AND, G_OR, G_XOR}) {
55 for (
auto Ty : {s1, s8, s16})
60 for (
unsigned Op : {G_SDIV, G_UDIV}) {
61 for (
auto Ty : {s8, s16})
69 for (
unsigned Op : {G_SREM, G_UREM}) {
70 for (
auto Ty : {s8, s16})
80 for (
unsigned Op : {G_SEXT, G_ZEXT}) {
82 for (
auto Ty : {s1, s8, s16})
96 for (
auto Ty : {s1, s8, s16})
100 for (
auto Ty : {s8, s16})
102 for (
auto Ty : {s32, p0})
116 for (
auto Ty : {s32, s64})
124 setFCmpLibcallsAEABI();
126 setFCmpLibcallsGNU();
129 for (
unsigned Op : {G_FREM, G_FPOW})
130 for (
auto Ty : {s32, s64})
136 void ARMLegalizerInfo::setFCmpLibcallsAEABI() {
192 void ARMLegalizerInfo::setFCmpLibcallsGNU() {
234 unsigned Size)
const {
246 using namespace TargetOpcode;
288 "Mismatched operands for G_FCMP");
294 auto Libcalls = getFCmpLibcalls(Predicate, OpSize);
296 if (Libcalls.empty()) {
299 "Predicate needs libcalls, but none specified");
307 assert((OpSize == 32 || OpSize == 64) &&
"Unsupported operand size");
312 for (
auto Libcall : Libcalls) {
322 auto ProcessedResult =
334 MIRBuilder.
buildTrunc(ProcessedResult, LibcallResult);
340 MIRBuilder.
buildICmp(ResultPred, ProcessedResult, LibcallResult,
Zero);
353 MI.eraseFromParent();
void push_back(const T &Elt)
static Type * getDoubleTy(LLVMContext &C)
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function. ...
LLT getType(unsigned VReg) const
Get the low-level type of VReg or LLT{} if VReg is not a generic (target independent) virtual registe...
static bool AEABI(const ARMSubtarget &ST)
0 1 0 0 True if ordered and less than
Function Alias Analysis Results
1 1 1 0 True if unordered or not equal
MachineInstrBuilder buildTrunc(unsigned Res, unsigned Op)
Build and insert Res<def> = G_TRUNC Op.
const Function * getFunction() const
getFunction - Return the LLVM function that this machine code represents
unsigned createGenericVirtualRegister(LLT Ty)
Create and return a new generic virtual register with low-level type Ty.
1 0 0 1 True if unordered or equal
bool isTargetAEABI() const
1 0 0 0 True if unordered: isnan(X) | isnan(Y)
bool useSoftFloat() const
static Type * getFloatTy(LLVMContext &C)
Class to represent struct types.
void eraseFromParent()
Unlink 'this' from the containing basic block and delete it.
0 1 0 1 True if ordered and less than or equal
LegalizerHelper::LegalizeResult createLibcall(MachineIRBuilder &MIRBuilder, RTLIB::Libcall Libcall, const CallLowering::ArgInfo &Result, ArrayRef< CallLowering::ArgInfo > Args)
Helper function that creates the given libcall.
void computeTables()
Compute any ancillary tables needed to quickly decide how an operation should be handled.
MachineFunction & getMF()
Getter for the function we currently build.
bool legalizeCustom(MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &MIRBuilder) const override
static LLT scalar(unsigned SizeInBits)
Get a low-level scalar or aggregate "bag of bits".
const DataLayout & getDataLayout() const
Return the DataLayout attached to the Module associated to this MF.
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
The target wants to do something special with this combination of operand and type.
unsigned const MachineRegisterInfo * MRI
The instances of the Type class are immutable: once they are created, they are never changed...
static unsigned getSizeInBits(unsigned Reg, const MachineRegisterInfo &MRI, const TargetRegisterInfo &TRI)
Get the size in bits of Reg.
This file declares the targeting of the Machinelegalizer class for ARM.
const MachineOperand & getOperand(unsigned i) const
Helper class to build MachineInstr.
bool isIntPredicate() const
MachineInstrBuilder buildICmp(CmpInst::Predicate Pred, unsigned Res, unsigned Op0, unsigned Op1)
Build and insert a Res = G_ICMP Pred, Op0, Op1.
void setInstr(MachineInstr &MI)
Set the insertion point to before MI.
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
void resize(typename StorageT::size_type s)
ARMLegalizerInfo(const ARMSubtarget &ST)
0 1 1 1 True if ordered (no nans)
MachineInstrBuilder buildOr(unsigned Res, unsigned Op0, unsigned Op1)
Build and insert Res<def> = G_OR Op0, Op1.
1 1 1 1 Always true (always folded)
1 1 0 1 True if unordered, less than, or equal
LLT getLLTForType(Type &Ty, const DataLayout &DL)
Construct a low-level type based on an LLVM type.
0 0 1 0 True if ordered and greater than
The operation should be implemented as a call to some kind of runtime support library.
static StructType * get(LLVMContext &Context, ArrayRef< Type * > Elements, bool isPacked=false)
This static method is the primary way to create a literal StructType.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
1 1 0 0 True if unordered or less than
The operation should be implemented in terms of a wider scalar base-type.
Predicate
Predicate - These are "(BI << 5) | BO" for various predicates.
unsigned getPredicate() const
The operation itself must be expressed in terms of simpler actions on this target.
The operation is expected to be selectable directly by the target, and no transformation is necessary...
bool isTargetGNUAEABI() const
bool isFPPredicate() const
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
llvm_unreachable("Unknown RegBank!")
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
Representation of each machine instruction.
Instruction has been legalized and the MachineFunction changed.
static IntegerType * getInt32Ty(LLVMContext &C)
MachineInstrBuilder buildConstant(unsigned Res, const ConstantInt &Val)
Build and insert Res = G_CONSTANT Val.
0 1 1 0 True if ordered and operands are unequal
1 0 1 0 True if unordered or greater than
MachineInstrBuilder buildUnmerge(ArrayRef< unsigned > Res, unsigned Op)
Build and insert Res0<def>, ...
unsigned getReg() const
getReg - Returns the register number.
bool isTargetMuslAEABI() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
0 0 0 1 True if ordered and equal
static LLT pointer(uint16_t AddressSpace, unsigned SizeInBits)
Get a low-level pointer in the given address space (defaulting to 0).
1 0 1 1 True if unordered, greater than, or equal
bool hasDivideInARMMode() const
unsigned getSizeInBits() const
Returns the total size of the type. Must only be called on sized types.
This file describes how to lower LLVM calls to machine code calls.
0 0 1 1 True if ordered and greater than or equal
void setAction(const InstrAspect &Aspect, LegalizeAction Action)
More friendly way to set an action for common types that have an LLT representation.
0 0 0 0 Always false (always folded)