LLVM 23.0.0git
FastISel.h
Go to the documentation of this file.
1//===- FastISel.h - Definition of the FastISel class ------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8///
9/// \file
10/// This file defines the FastISel class.
11///
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_CODEGEN_FASTISEL_H
15#define LLVM_CODEGEN_FASTISEL_H
16
17#include "llvm/ADT/DenseMap.h"
19#include "llvm/ADT/StringRef.h"
24#include "llvm/IR/Attributes.h"
25#include "llvm/IR/CallingConv.h"
26#include "llvm/IR/DebugLoc.h"
28#include "llvm/IR/InstrTypes.h"
29#include <cstdint>
30#include <utility>
31
32namespace llvm {
33
34class AllocaInst;
35class Instruction;
36class IntrinsicInst;
37class BasicBlock;
38class CallInst;
39class Constant;
40class ConstantFP;
41class DataLayout;
43class LoadInst;
46class MachineFunction;
47class MachineInstr;
49class MachineOperand;
51class MCContext;
52class MCInstrDesc;
53class MCSymbol;
54class TargetInstrInfo;
56class TargetMachine;
57class MCRegisterClass;
60class Type;
61class User;
62class Value;
63
64/// This is a fast-path instruction selection class that generates poor
65/// code and doesn't support illegal types or non-trivial lowering, but runs
66/// quickly.
68public:
72 Type *RetTy = nullptr;
73 bool RetSExt : 1;
74 bool RetZExt : 1;
75 bool IsVarArg : 1;
76 bool IsInReg : 1;
77 bool DoesNotReturn : 1;
79 bool IsPatchPoint : 1;
80
81 // IsTailCall Should be modified by implementations of FastLowerCall
82 // that perform tail call conversions.
83 bool IsTailCall = false;
84
85 unsigned NumFixedArgs = -1;
87 const Value *Callee = nullptr;
88 MCSymbol *Symbol = nullptr;
90 const CallBase *CB = nullptr;
91 MachineInstr *Call = nullptr;
93 unsigned NumResultRegs = 0;
94
100
104
106 const Value *Target, ArgListTy &&ArgsList,
107 const CallBase &Call) {
108 RetTy = ResultTy;
109 Callee = Target;
110
111 IsInReg = Call.hasRetAttr(Attribute::InReg);
112 DoesNotReturn = Call.doesNotReturn();
113 IsVarArg = FuncTy->isVarArg();
114 IsReturnValueUsed = !Call.use_empty();
115 RetSExt = Call.hasRetAttr(Attribute::SExt);
116 RetZExt = Call.hasRetAttr(Attribute::ZExt);
117
118 CallConv = Call.getCallingConv();
119 Args = std::move(ArgsList);
120 NumFixedArgs = FuncTy->getNumParams();
121
122 CB = &Call;
123
124 return *this;
125 }
126
128 MCSymbol *Target, ArgListTy &&ArgsList,
129 const CallBase &Call,
130 unsigned FixedArgs = ~0U) {
131 RetTy = ResultTy;
132 Callee = Call.getCalledOperand();
133 Symbol = Target;
134
135 IsInReg = Call.hasRetAttr(Attribute::InReg);
136 DoesNotReturn = Call.doesNotReturn();
137 IsVarArg = FuncTy->isVarArg();
138 IsReturnValueUsed = !Call.use_empty();
139 RetSExt = Call.hasRetAttr(Attribute::SExt);
140 RetZExt = Call.hasRetAttr(Attribute::ZExt);
141
142 CallConv = Call.getCallingConv();
143 Args = std::move(ArgsList);
144 NumFixedArgs = (FixedArgs == ~0U) ? FuncTy->getNumParams() : FixedArgs;
145
146 CB = &Call;
147
148 return *this;
149 }
150
152 const Value *Target, ArgListTy &&ArgsList,
153 unsigned FixedArgs = ~0U) {
154 RetTy = ResultTy;
155 Callee = Target;
156 CallConv = CC;
157 Args = std::move(ArgsList);
158 NumFixedArgs = (FixedArgs == ~0U) ? Args.size() : FixedArgs;
159 return *this;
160 }
161
162 LLVM_ABI CallLoweringInfo &setCallee(const DataLayout &DL, MCContext &Ctx,
163 CallingConv::ID CC, Type *ResultTy,
164 StringRef Target, ArgListTy &&ArgsList,
165 unsigned FixedArgs = ~0U);
166
168 MCSymbol *Target, ArgListTy &&ArgsList,
169 unsigned FixedArgs = ~0U) {
170 RetTy = ResultTy;
171 Symbol = Target;
172 CallConv = CC;
173 Args = std::move(ArgsList);
174 NumFixedArgs = (FixedArgs == ~0U) ? Args.size() : FixedArgs;
175 return *this;
176 }
177
180 return *this;
181 }
182
185 return *this;
186 }
187
188 ArgListTy &getArgs() { return Args; }
189
190 void clearOuts() {
191 OutVals.clear();
192 OutFlags.clear();
193 OutRegs.clear();
194 }
195
196 void clearIns() {
197 Ins.clear();
198 InRegs.clear();
199 }
200 };
201
202protected:
218
219 /// The position of the last instruction for materializing constants
220 /// for use in the current block. It resets to EmitStartPt when it makes sense
221 /// (for example, it's usually profitable to avoid function calls between the
222 /// definition and the use)
224
225 /// The top most instruction in the current block that is allowed for
226 /// emitting local variables. LastLocalValue resets to EmitStartPt when it
227 /// makes sense (for example, on function calls)
229
230public:
231 virtual ~FastISel();
232
233 /// Return the position of the last instruction emitted for
234 /// materializing constants for use in the current block.
236
237 /// Update the position of the last instruction emitted for
238 /// materializing constants for use in the current block.
243
244 /// Set the current block to which generated machine instructions will
245 /// be appended.
246 void startNewBlock();
247
248 /// Flush the local value map.
249 void finishBasicBlock();
250
251 /// Return current debug location information.
252 DebugLoc getCurDebugLoc() const { return MIMD.getDL(); }
253
254 /// Do "fast" instruction selection for function arguments and append
255 /// the machine instructions to the current block. Returns true when
256 /// successful.
257 bool lowerArguments();
258
259 /// Do "fast" instruction selection for the given LLVM IR instruction
260 /// and append the generated machine instructions to the current block.
261 /// Returns true if selection was successful.
262 bool selectInstruction(const Instruction *I);
263
264 /// Do "fast" instruction selection for the given LLVM IR operator
265 /// (Instruction or ConstantExpr), and append generated machine instructions
266 /// to the current block. Return true if selection was successful.
267 bool selectOperator(const User *I, unsigned Opcode);
268
269 /// Create a virtual register and arrange for it to be assigned the
270 /// value for the given LLVM value.
271 Register getRegForValue(const Value *V);
272
273 /// Look up the value to see if its value is already cached in a
274 /// register. It may be defined by instructions across blocks or defined
275 /// locally.
276 Register lookUpRegForValue(const Value *V);
277
278 /// This is a wrapper around getRegForValue that also takes care of
279 /// truncating or sign-extending the given getelementptr index value.
280 Register getRegForGEPIndex(MVT PtrVT, const Value *Idx);
281
282 /// We're checking to see if we can fold \p LI into \p FoldInst. Note
283 /// that we could have a sequence where multiple LLVM IR instructions are
284 /// folded into the same machineinstr. For example we could have:
285 ///
286 /// A: x = load i32 *P
287 /// B: y = icmp A, 42
288 /// C: br y, ...
289 ///
290 /// In this scenario, \p LI is "A", and \p FoldInst is "C". We know about "B"
291 /// (and any other folded instructions) because it is between A and C.
292 ///
293 /// If we succeed folding, return true.
294 bool tryToFoldLoad(const LoadInst *LI, const Instruction *FoldInst);
295
296 /// The specified machine instr operand is a vreg, and that vreg is
297 /// being provided by the specified load instruction. If possible, try to
298 /// fold the load as an operand to the instruction, returning true if
299 /// possible.
300 ///
301 /// This method should be implemented by targets.
302 virtual bool tryToFoldLoadIntoMI(MachineInstr * /*MI*/, unsigned /*OpNo*/,
303 const LoadInst * /*LI*/) {
304 return false;
305 }
306
307 /// Reset InsertPt to prepare for inserting instructions into the
308 /// current block.
309 void recomputeInsertPt();
310
311 /// Remove all dead instructions between the I and E.
312 void removeDeadCode(MachineBasicBlock::iterator I,
314
316
317 /// Prepare InsertPt to begin inserting instructions into the local
318 /// value area and return the old insert position.
320
321 /// Reset InsertPt to the given old insert position.
323
324 /// Target-independent lowering of non-instruction debug info associated with
325 /// this instruction.
326 void handleDbgInfo(const Instruction *II);
327
328protected:
332 bool SkipTargetIndependentISel = false);
333
334 /// This method is called by target-independent code when the normal
335 /// FastISel process fails to select an instruction. This gives targets a
336 /// chance to emit code for anything that doesn't fit into FastISel's
337 /// framework. It returns true if it was successful.
338 virtual bool fastSelectInstruction(const Instruction *I) = 0;
339
340 /// This method is called by target-independent code to do target-
341 /// specific argument lowering. It returns true if it was successful.
342 virtual bool fastLowerArguments();
343
344 /// This method is called by target-independent code to do target-
345 /// specific call lowering. It returns true if it was successful.
346 virtual bool fastLowerCall(CallLoweringInfo &CLI);
347
348 /// This method is called by target-independent code to do target-
349 /// specific intrinsic lowering. It returns true if it was successful.
350 virtual bool fastLowerIntrinsicCall(const IntrinsicInst *II);
351
352 /// This method is called by target-independent code to request that an
353 /// instruction with the given type and opcode be emitted.
354 virtual Register fastEmit_(MVT VT, MVT RetVT, unsigned Opcode);
355
356 /// This method is called by target-independent code to request that an
357 /// instruction with the given type, opcode, and register operand be emitted.
358 virtual Register fastEmit_r(MVT VT, MVT RetVT, unsigned Opcode, Register Op0);
359
360 /// This method is called by target-independent code to request that an
361 /// instruction with the given type, opcode, and register operands be emitted.
362 virtual Register fastEmit_rr(MVT VT, MVT RetVT, unsigned Opcode, Register Op0,
363 Register Op1);
364
365 /// This method is called by target-independent code to request that an
366 /// instruction with the given type, opcode, and register and immediate
367 /// operands be emitted.
368 virtual Register fastEmit_ri(MVT VT, MVT RetVT, unsigned Opcode, Register Op0,
369 uint64_t Imm);
370
371 /// This method is a wrapper of fastEmit_ri.
372 ///
373 /// It first tries to emit an instruction with an immediate operand using
374 /// fastEmit_ri. If that fails, it materializes the immediate into a register
375 /// and try fastEmit_rr instead.
376 Register fastEmit_ri_(MVT VT, unsigned Opcode, Register Op0, uint64_t Imm,
377 MVT ImmType);
378
379 /// This method is called by target-independent code to request that an
380 /// instruction with the given type, opcode, and immediate operand be emitted.
381 virtual Register fastEmit_i(MVT VT, MVT RetVT, unsigned Opcode, uint64_t Imm);
382
383 /// This method is called by target-independent code to request that an
384 /// instruction with the given type, opcode, and floating-point immediate
385 /// operand be emitted.
386 virtual Register fastEmit_f(MVT VT, MVT RetVT, unsigned Opcode,
387 const ConstantFP *FPImm);
388
389 /// Emit a MachineInstr with no operands and a result register in the
390 /// given register class.
391 Register fastEmitInst_(unsigned MachineInstOpcode,
392 const TargetRegisterClass *RC);
393
394 /// Emit a MachineInstr with one register operand and a result register
395 /// in the given register class.
396 Register fastEmitInst_r(unsigned MachineInstOpcode,
397 const TargetRegisterClass *RC, Register Op0);
398
399 /// Emit a MachineInstr with two register operands and a result
400 /// register in the given register class.
401 Register fastEmitInst_rr(unsigned MachineInstOpcode,
402 const TargetRegisterClass *RC, Register Op0,
403 Register Op1);
404
405 /// Emit a MachineInstr with three register operands and a result
406 /// register in the given register class.
407 Register fastEmitInst_rrr(unsigned MachineInstOpcode,
408 const TargetRegisterClass *RC, Register Op0,
409 Register Op1, Register Op2);
410
411 /// Emit a MachineInstr with a register operand, an immediate, and a
412 /// result register in the given register class.
413 Register fastEmitInst_ri(unsigned MachineInstOpcode,
414 const TargetRegisterClass *RC, Register Op0,
415 uint64_t Imm);
416
417 /// Emit a MachineInstr with one register operand and two immediate
418 /// operands.
419 Register fastEmitInst_rii(unsigned MachineInstOpcode,
420 const TargetRegisterClass *RC, Register Op0,
421 uint64_t Imm1, uint64_t Imm2);
422
423 /// Emit a MachineInstr with a floating point immediate, and a result
424 /// register in the given register class.
425 Register fastEmitInst_f(unsigned MachineInstOpcode,
426 const TargetRegisterClass *RC,
427 const ConstantFP *FPImm);
428
429 /// Emit a MachineInstr with two register operands, an immediate, and a
430 /// result register in the given register class.
431 Register fastEmitInst_rri(unsigned MachineInstOpcode,
432 const TargetRegisterClass *RC, Register Op0,
433 Register Op1, uint64_t Imm);
434
435 /// Emit a MachineInstr with a single immediate operand, and a result
436 /// register in the given register class.
437 Register fastEmitInst_i(unsigned MachineInstOpcode,
438 const TargetRegisterClass *RC, uint64_t Imm);
439
440 /// Emit a MachineInstr for an extract_subreg from a specified index of
441 /// a superregister to a specified type.
443
444 /// Emit MachineInstrs to compute the value of Op with all but the
445 /// least significant bit set to zero.
447
448 /// Emit an unconditional branch to the given block, unless it is the
449 /// immediate (fall-through) successor, and update the CFG.
450 void fastEmitBranch(MachineBasicBlock *MSucc, const DebugLoc &DbgLoc);
451
452 /// Emit an unconditional branch to \p FalseMBB, obtains the branch weight
453 /// and adds TrueMBB and FalseMBB to the successor list.
454 void finishCondBranch(const BasicBlock *BranchBB, MachineBasicBlock *TrueMBB,
455 MachineBasicBlock *FalseMBB);
456
457 /// Update the value map to include the new mapping for this
458 /// instruction, or insert an extra copy to get the result in a previous
459 /// determined register.
460 ///
461 /// NOTE: This is only necessary because we might select a block that uses a
462 /// value before we select the block that defines the value. It might be
463 /// possible to fix this by selecting blocks in reverse postorder.
464 void updateValueMap(const Value *I, Register Reg, unsigned NumRegs = 1);
465
467
468 /// Try to constrain Op so that it is usable by argument OpNum of the
469 /// provided MCInstrDesc. If this fails, create a new virtual register in the
470 /// correct class and COPY the value there.
472 unsigned OpNum);
473
474 /// Emit a constant in a register using target-specific logic, such as
475 /// constant pool loads.
477 return Register();
478 }
479
480 /// Emit an alloca address in a register using target-specific logic.
482 return Register();
483 }
484
485 /// Emit the floating-point constant +0.0 in a register using target-
486 /// specific logic.
488 return Register();
489 }
490
491 /// Check if \c Add is an add that can be safely folded into \c GEP.
492 ///
493 /// \c Add can be folded into \c GEP if:
494 /// - \c Add is an add,
495 /// - \c Add's size matches \c GEP's,
496 /// - \c Add is in the same basic block as \c GEP, and
497 /// - \c Add has a constant operand.
498 bool canFoldAddIntoGEP(const User *GEP, const Value *Add);
499
500 /// Create a machine mem operand from the given instruction.
501 MachineMemOperand *createMachineMemOperandFor(const Instruction *I) const;
502
503 CmpInst::Predicate optimizeCmpPredicate(const CmpInst *CI) const;
504
505 bool lowerCallTo(const CallInst *CI, MCSymbol *Symbol, unsigned NumArgs);
506 bool lowerCallTo(const CallInst *CI, const char *SymName,
507 unsigned NumArgs);
508 bool lowerCallTo(CallLoweringInfo &CLI);
509
510 bool lowerCall(const CallInst *I);
511 /// Select and emit code for a binary operator instruction, which has
512 /// an opcode which directly corresponds to the given ISD opcode.
513 bool selectBinaryOp(const User *I, unsigned ISDOpcode);
514 bool selectFNeg(const User *I, const Value *In);
515 bool selectGetElementPtr(const User *I);
516 bool selectStackmap(const CallInst *I);
517 bool selectPatchpoint(const CallInst *I);
518 bool selectCall(const User *I);
519 bool selectIntrinsicCall(const IntrinsicInst *II);
520 bool selectBitCast(const User *I);
521 bool selectFreeze(const User *I);
522 bool selectCast(const User *I, unsigned Opcode);
523 bool selectExtractValue(const User *U);
524 bool selectXRayCustomEvent(const CallInst *II);
525 bool selectXRayTypedEvent(const CallInst *II);
526
528 // TODO: Implement PGSO.
529 return MF->getFunction().hasOptSize();
530 }
531
532 /// Target-independent lowering of debug information. Returns false if the
533 /// debug information couldn't be lowered and was instead discarded.
534 virtual bool lowerDbgValue(const Value *V, DIExpression *Expr,
535 DILocalVariable *Var, const DebugLoc &DL);
536
537 /// Target-independent lowering of debug information. Returns false if the
538 /// debug information couldn't be lowered and was instead discarded.
539 virtual bool lowerDbgDeclare(const Value *V, DIExpression *Expr,
540 DILocalVariable *Var, const DebugLoc &DL);
541
542private:
543 /// Handle PHI nodes in successor blocks.
544 ///
545 /// Emit code to ensure constants are copied into registers when needed.
546 /// Remember the virtual registers that need to be added to the Machine PHI
547 /// nodes as input. We cannot just directly add them, because expansion might
548 /// result in multiple MBB's for one BB. As such, the start of the BB might
549 /// correspond to a different MBB than the end.
550 bool handlePHINodesInSuccessorBlocks(const BasicBlock *LLVMBB);
551
552 /// Helper for materializeRegForValue to materialize a constant in a
553 /// target-independent way.
554 Register materializeConstant(const Value *V, MVT VT);
555
556 /// Helper for getRegForVale. This function is called when the value
557 /// isn't already available in a register and must be materialized with new
558 /// instructions.
559 Register materializeRegForValue(const Value *V, MVT VT);
560
561 /// Clears LocalValueMap and moves the area for the new local variables
562 /// to the beginning of the block. It helps to avoid spilling cached variables
563 /// across heavy instructions like calls.
564 void flushLocalValueMap();
565
566 /// Removes dead local value instructions after SavedLastLocalvalue.
567 void removeDeadLocalValueCode(MachineInstr *SavedLastLocalValue);
568
569 /// Insertion point before trying to select the current instruction.
570 MachineBasicBlock::iterator SavedInsertPt;
571
572 /// Add a stackmap or patchpoint intrinsic call's live variable
573 /// operands to a stackmap or patchpoint machine instruction.
575 const CallInst *CI, unsigned StartIdx);
576 bool lowerCallOperands(const CallInst *CI, unsigned ArgIdx, unsigned NumArgs,
577 const Value *Callee, bool ForceRetVoidTy,
578 CallLoweringInfo &CLI);
579};
580
581} // end namespace llvm
582
583#endif // LLVM_CODEGEN_FASTISEL_H
static unsigned selectBinaryOp(unsigned GenericOpc, unsigned RegBankID, unsigned OpSize)
Select the AArch64 opcode for the basic binary operation GenericOpc (such as G_OR or G_SDIV),...
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
This file contains the simple types necessary to represent the attributes associated with functions a...
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
#define LLVM_ABI
Definition Compiler.h:215
This file defines the DenseMap class.
Hexagon Common GEP
const AbstractManglingParser< Derived, Alloc >::OperatorInfo AbstractManglingParser< Derived, Alloc >::Ops[]
#define I(x, y, z)
Definition MD5.cpp:57
Register Reg
Promote Memory to Register
Definition Mem2Reg.cpp:110
uint64_t IntrinsicInst * II
static void addStackMapLiveVars(const CallBase &Call, unsigned StartIdx, const SDLoc &DL, SmallVectorImpl< SDValue > &Ops, SelectionDAGBuilder &Builder)
Add a stack map intrinsic call's live variable operands to a stackmap or patchpoint target node's ope...
This file defines the SmallVector class.
This file describes how to lower LLVM code to machine code.
an instruction to allocate memory on the stack
LLVM Basic Block Representation.
Definition BasicBlock.h:62
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
This class represents a function call, abstracting a target machine's calling convention.
This class is the base class for the comparison instructions.
Definition InstrTypes.h:728
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
Definition InstrTypes.h:740
ConstantFP - Floating Point Values [float, double].
Definition Constants.h:420
This is an important base class in LLVM.
Definition Constant.h:43
DWARF expression.
A parsed version of the target data layout string in and methods for querying it.
Definition DataLayout.h:64
A debug info location.
Definition DebugLoc.h:126
MachineRegisterInfo & MRI
Definition FastISel.h:206
const TargetLibraryInfo * LibInfo
Definition FastISel.h:215
const DataLayout & DL
Definition FastISel.h:211
void setLastLocalValue(MachineInstr *I)
Update the position of the last instruction emitted for materializing constants for use in the curren...
Definition FastISel.h:239
Register fastEmitInst_ri(unsigned MachineInstOpcode, const TargetRegisterClass *RC, Register Op0, uint64_t Imm)
Emit a MachineInstr with a register operand, an immediate, and a result register in the given registe...
DenseMap< const Value *, Register > LocalValueMap
Definition FastISel.h:203
void fastEmitBranch(MachineBasicBlock *MSucc, const DebugLoc &DbgLoc)
Emit an unconditional branch to the given block, unless it is the immediate (fall-through) successor,...
FastISel(FunctionLoweringInfo &FuncInfo, const TargetLibraryInfo *LibInfo, const LibcallLoweringInfo *LibcallLowering, bool SkipTargetIndependentISel=false)
MachineInstr * EmitStartPt
The top most instruction in the current block that is allowed for emitting local variables.
Definition FastISel.h:228
virtual Register fastEmit_r(MVT VT, MVT RetVT, unsigned Opcode, Register Op0)
This method is called by target-independent code to request that an instruction with the given type,...
Register fastEmitInst_(unsigned MachineInstOpcode, const TargetRegisterClass *RC)
Emit a MachineInstr with no operands and a result register in the given register class.
Register fastEmitInst_rr(unsigned MachineInstOpcode, const TargetRegisterClass *RC, Register Op0, Register Op1)
Emit a MachineInstr with two register operands and a result register in the given register class.
virtual Register fastEmit_rr(MVT VT, MVT RetVT, unsigned Opcode, Register Op0, Register Op1)
This method is called by target-independent code to request that an instruction with the given type,...
const LibcallLoweringInfo * LibcallLowering
Definition FastISel.h:216
virtual bool fastLowerIntrinsicCall(const IntrinsicInst *II)
This method is called by target-independent code to do target- specific intrinsic lowering.
MachineInstr * getLastLocalValue()
Return the position of the last instruction emitted for materializing constants for use in the curren...
Definition FastISel.h:235
void leaveLocalValueArea(SavePoint Old)
Reset InsertPt to the given old insert position.
Definition FastISel.cpp:436
virtual Register fastMaterializeConstant(const Constant *C)
Emit a constant in a register using target-specific logic, such as constant pool loads.
Definition FastISel.h:476
Register fastEmitInst_rrr(unsigned MachineInstOpcode, const TargetRegisterClass *RC, Register Op0, Register Op1, Register Op2)
Emit a MachineInstr with three register operands and a result register in the given register class.
virtual Register fastEmit_i(MVT VT, MVT RetVT, unsigned Opcode, uint64_t Imm)
This method is called by target-independent code to request that an instruction with the given type,...
virtual Register fastEmit_f(MVT VT, MVT RetVT, unsigned Opcode, const ConstantFP *FPImm)
This method is called by target-independent code to request that an instruction with the given type,...
void handleDbgInfo(const Instruction *II)
Target-independent lowering of non-instruction debug info associated with this instruction.
virtual Register fastMaterializeFloatZero(const ConstantFP *CF)
Emit the floating-point constant +0.0 in a register using target- specific logic.
Definition FastISel.h:487
virtual bool tryToFoldLoadIntoMI(MachineInstr *, unsigned, const LoadInst *)
The specified machine instr operand is a vreg, and that vreg is being provided by the specified load ...
Definition FastISel.h:302
Register fastEmitInst_i(unsigned MachineInstOpcode, const TargetRegisterClass *RC, uint64_t Imm)
Emit a MachineInstr with a single immediate operand, and a result register in the given register clas...
Register fastEmitInst_rii(unsigned MachineInstOpcode, const TargetRegisterClass *RC, Register Op0, uint64_t Imm1, uint64_t Imm2)
Emit a MachineInstr with one register operand and two immediate operands.
MachineFrameInfo & MFI
Definition FastISel.h:207
MachineFunction * MF
Definition FastISel.h:205
TargetLoweringBase::ArgListTy ArgListTy
Definition FastISel.h:70
virtual bool fastLowerCall(CallLoweringInfo &CLI)
This method is called by target-independent code to do target- specific call lowering.
virtual Register fastMaterializeAlloca(const AllocaInst *C)
Emit an alloca address in a register using target-specific logic.
Definition FastISel.h:481
Register fastEmitZExtFromI1(MVT VT, Register Op0)
Emit MachineInstrs to compute the value of Op with all but the least significant bit set to zero.
DebugLoc getCurDebugLoc() const
Return current debug location information.
Definition FastISel.h:252
Register createResultReg(const TargetRegisterClass *RC)
virtual bool fastLowerArguments()
This method is called by target-independent code to do target- specific argument lowering.
const TargetInstrInfo & TII
Definition FastISel.h:212
virtual Register fastEmit_(MVT VT, MVT RetVT, unsigned Opcode)
This method is called by target-independent code to request that an instruction with the given type a...
Register fastEmitInst_r(unsigned MachineInstOpcode, const TargetRegisterClass *RC, Register Op0)
Emit a MachineInstr with one register operand and a result register in the given register class.
Register fastEmitInst_rri(unsigned MachineInstOpcode, const TargetRegisterClass *RC, Register Op0, Register Op1, uint64_t Imm)
Emit a MachineInstr with two register operands, an immediate, and a result register in the given regi...
FunctionLoweringInfo & FuncInfo
Definition FastISel.h:204
MachineConstantPool & MCP
Definition FastISel.h:208
bool SkipTargetIndependentISel
Definition FastISel.h:217
Register fastEmitInst_f(unsigned MachineInstOpcode, const TargetRegisterClass *RC, const ConstantFP *FPImm)
Emit a MachineInstr with a floating point immediate, and a result register in the given register clas...
Register constrainOperandRegClass(const MCInstrDesc &II, Register Op, unsigned OpNum)
Try to constrain Op so that it is usable by argument OpNum of the provided MCInstrDesc.
MachineBasicBlock::iterator SavePoint
Definition FastISel.h:315
Register fastEmitInst_extractsubreg(MVT RetVT, Register Op0, uint32_t Idx)
Emit a MachineInstr for an extract_subreg from a specified index of a superregister to a specified ty...
void updateValueMap(const Value *I, Register Reg, unsigned NumRegs=1)
Update the value map to include the new mapping for this instruction, or insert an extra copy to get ...
Definition FastISel.cpp:363
virtual bool fastSelectInstruction(const Instruction *I)=0
This method is called by target-independent code when the normal FastISel process fails to select an ...
const TargetLowering & TLI
Definition FastISel.h:213
virtual Register fastEmit_ri(MVT VT, MVT RetVT, unsigned Opcode, Register Op0, uint64_t Imm)
This method is called by target-independent code to request that an instruction with the given type,...
bool shouldOptForSize(const MachineFunction *MF) const
Definition FastISel.h:527
const TargetMachine & TM
Definition FastISel.h:210
MIMetadata MIMD
Definition FastISel.h:209
MachineInstr * LastLocalValue
The position of the last instruction for materializing constants for use in the current block.
Definition FastISel.h:223
SavePoint enterLocalValueArea()
Prepare InsertPt to begin inserting instructions into the local value area and return the old insert ...
Definition FastISel.cpp:430
void finishCondBranch(const BasicBlock *BranchBB, MachineBasicBlock *TrueMBB, MachineBasicBlock *FalseMBB)
Emit an unconditional branch to FalseMBB, obtains the branch weight and adds TrueMBB and FalseMBB to ...
virtual ~FastISel()
Register fastEmit_ri_(MVT VT, unsigned Opcode, Register Op0, uint64_t Imm, MVT ImmType)
This method is a wrapper of fastEmit_ri.
const TargetRegisterInfo & TRI
Definition FastISel.h:214
TargetLoweringBase::ArgListEntry ArgListEntry
Definition FastISel.h:69
FunctionLoweringInfo - This contains information that is global to a function that is used when lower...
Class to represent function types.
A wrapper class for inspecting calls to intrinsic functions.
Tracks which library functions to use for a particular subtarget.
An instruction for reading from memory.
Context object for machine code objects.
Definition MCContext.h:83
Describe properties that are true of each instruction in the target description file.
MCRegisterClass - Base class of TargetRegisterClass.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition MCSymbol.h:42
Set of metadata that should be preserved when using BuildMI().
Machine Value Type.
MachineInstrBundleIterator< MachineInstr > iterator
The MachineConstantPool class keeps track of constants referenced by a function which must be spilled...
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
Representation of each machine instruction.
A description of a memory reference used in the backend.
MachineOperand class - Representation of each machine instruction operand.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
Wrapper class representing virtual and physical registers.
Definition Register.h:20
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
TargetInstrInfo - Interface to description of machine instruction set.
Provides information about what library functions are available for the current target.
std::vector< ArgListEntry > ArgListTy
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
Primary interface to the complete machine description for the target machine.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
Target - Wrapper for Target specific information.
The instances of the Type class are immutable: once they are created, they are never changed.
Definition Type.h:46
LLVM Value Representation.
Definition Value.h:75
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition CallingConv.h:24
@ C
The default llvm calling convention, compatible with C.
Definition CallingConv.h:34
This is an optimization pass for GlobalISel generic memory operations.
@ Add
Sum of integers.
DWARFExpression::Operation Op
MCRegisterClass TargetRegisterClass
Definition FastISel.h:58
SmallVector< ISD::ArgFlagsTy, 16 > OutFlags
Definition FastISel.h:96
SmallVector< Value *, 16 > OutVals
Definition FastISel.h:95
CallLoweringInfo & setCallee(CallingConv::ID CC, Type *ResultTy, MCSymbol *Target, ArgListTy &&ArgsList, unsigned FixedArgs=~0U)
Definition FastISel.h:167
SmallVector< Register, 16 > OutRegs
Definition FastISel.h:97
CallLoweringInfo & setCallee(Type *ResultTy, FunctionType *FuncTy, MCSymbol *Target, ArgListTy &&ArgsList, const CallBase &Call, unsigned FixedArgs=~0U)
Definition FastISel.h:127
CallLoweringInfo & setTailCall(bool Value=true)
Definition FastISel.h:178
CallLoweringInfo & setCallee(CallingConv::ID CC, Type *ResultTy, const Value *Target, ArgListTy &&ArgsList, unsigned FixedArgs=~0U)
Definition FastISel.h:151
SmallVector< Register, 4 > InRegs
Definition FastISel.h:99
CallLoweringInfo & setIsPatchPoint(bool Value=true)
Definition FastISel.h:183
CallLoweringInfo & setCallee(Type *ResultTy, FunctionType *FuncTy, const Value *Target, ArgListTy &&ArgsList, const CallBase &Call)
Definition FastISel.h:105
SmallVector< ISD::InputArg, 4 > Ins
Definition FastISel.h:98