LLVM
8.0.1
|
An MIRBuilder which does trivial constant folding of binary ops. More...
#include "llvm/CodeGen/GlobalISel/ConstantFoldingMIRBuilder.h"
Public Member Functions | |
virtual | ~ConstantFoldingMIRBuilder ()=default |
MachineInstrBuilder | buildInstr (unsigned Opc, ArrayRef< DstOp > DstOps, ArrayRef< SrcOp > SrcOps, Optional< unsigned > Flags=None) override |
Public Member Functions inherited from llvm::MachineIRBuilder | |
MachineIRBuilder ()=default | |
Some constructors for easy use. More... | |
MachineIRBuilder (MachineFunction &MF) | |
MachineIRBuilder (MachineInstr &MI) | |
virtual | ~MachineIRBuilder ()=default |
MachineIRBuilder (const MachineIRBuilderState &BState) | |
const TargetInstrInfo & | getTII () |
MachineFunction & | getMF () |
Getter for the function we currently build. More... | |
const DebugLoc & | getDL () |
Getter for DebugLoc. More... | |
MachineRegisterInfo * | getMRI () |
Getter for MRI. More... | |
const MachineRegisterInfo * | getMRI () const |
MachineIRBuilderState & | getState () |
Getter for the State. More... | |
const MachineBasicBlock & | getMBB () const |
Getter for the basic block we currently build. More... | |
MachineBasicBlock & | getMBB () |
GISelCSEInfo * | getCSEInfo () |
const GISelCSEInfo * | getCSEInfo () const |
MachineBasicBlock::iterator | getInsertPt () |
Current insertion point for new instructions. More... | |
void | setInsertPt (MachineBasicBlock &MBB, MachineBasicBlock::iterator II) |
Set the insertion point before the specified position. More... | |
void | setCSEInfo (GISelCSEInfo *Info) |
void | setChangeObserver (GISelChangeObserver &Observer) |
void | stopObservingChanges () |
void | setDebugLoc (const DebugLoc &DL) |
Set the debug location to DL for all the next build instructions. More... | |
DebugLoc | getDebugLoc () |
Get the current instruction's debug location. More... | |
MachineInstrBuilder | buildInstr (unsigned Opcode) |
Build and insert <empty> = Opcode <empty>. More... | |
MachineInstrBuilder | buildInstrNoInsert (unsigned Opcode) |
Build but don't insert <empty> = Opcode <empty>. More... | |
MachineInstrBuilder | insertInstr (MachineInstrBuilder MIB) |
Insert an existing instruction at the insertion point. More... | |
MachineInstrBuilder | buildDirectDbgValue (unsigned Reg, const MDNode *Variable, const MDNode *Expr) |
Build and insert a DBG_VALUE instruction expressing the fact that the associated Variable lives in Reg (suitably modified by Expr ). More... | |
MachineInstrBuilder | buildIndirectDbgValue (unsigned Reg, const MDNode *Variable, const MDNode *Expr) |
Build and insert a DBG_VALUE instruction expressing the fact that the associated Variable lives in memory at Reg (suitably modified by Expr ). More... | |
MachineInstrBuilder | buildFIDbgValue (int FI, const MDNode *Variable, const MDNode *Expr) |
Build and insert a DBG_VALUE instruction expressing the fact that the associated Variable lives in the stack slot specified by FI (suitably modified by Expr ). More... | |
MachineInstrBuilder | buildConstDbgValue (const Constant &C, const MDNode *Variable, const MDNode *Expr) |
Build and insert a DBG_VALUE instructions specifying that Variable is given by C (suitably modified by Expr ). More... | |
MachineInstrBuilder | buildDbgLabel (const MDNode *Label) |
Build and insert a DBG_LABEL instructions specifying that Label is given. More... | |
MachineInstrBuilder | buildFrameIndex (unsigned Res, int Idx) |
Build and insert Res = G_FRAME_INDEX Idx . More... | |
MachineInstrBuilder | buildGlobalValue (unsigned Res, const GlobalValue *GV) |
Build and insert Res = G_GLOBAL_VALUE GV . More... | |
MachineInstrBuilder | buildGEP (unsigned Res, unsigned Op0, unsigned Op1) |
Build and insert Res = G_GEP Op0 , Op1 . More... | |
Optional< MachineInstrBuilder > | materializeGEP (unsigned &Res, unsigned Op0, const LLT &ValueTy, uint64_t Value) |
Materialize and insert Res = G_GEP Op0 , (G_CONSTANT Value ) More... | |
MachineInstrBuilder | buildPtrMask (unsigned Res, unsigned Op0, uint32_t NumBits) |
Build and insert Res = G_PTR_MASK Op0 , NumBits . More... | |
MachineInstrBuilder | buildUAdde (const DstOp &Res, const DstOp &CarryOut, const SrcOp &Op0, const SrcOp &Op1, const SrcOp &CarryIn) |
Build and insert Res , CarryOut = G_UADDE Op0 , Op1 , CarryIn . More... | |
MachineInstrBuilder | buildAnyExt (const DstOp &Res, const SrcOp &Op) |
Build and insert Res = G_ANYEXT Op0 . More... | |
MachineInstrBuilder | buildSExt (const DstOp &Res, const SrcOp &Op) |
Build and insert Res = G_SEXT Op . More... | |
MachineInstrBuilder | buildZExt (const DstOp &Res, const SrcOp &Op) |
Build and insert Res = G_ZEXT Op . More... | |
MachineInstrBuilder | buildSExtOrTrunc (const DstOp &Res, const SrcOp &Op) |
Build and insert Res = G_SEXT Op , Res = G_TRUNC Op , or Res = COPY Op depending on the differing sizes of Res and Op . More... | |
MachineInstrBuilder | buildZExtOrTrunc (const DstOp &Res, const SrcOp &Op) |
Build and insert Res = G_ZEXT Op , Res = G_TRUNC Op , or Res = COPY Op depending on the differing sizes of Res and Op . More... | |
MachineInstrBuilder | buildAnyExtOrTrunc (const DstOp &Res, const SrcOp &Op) |
Res = COPY Op depending on the differing sizes of Res and Op . More... | |
MachineInstrBuilder | buildExtOrTrunc (unsigned ExtOpc, const DstOp &Res, const SrcOp &Op) |
Build and insert Res = ExtOpc , Res = G_TRUNC Op , or Res = COPY Op depending on the differing sizes of Res and Op . More... | |
MachineInstrBuilder | buildCast (const DstOp &Dst, const SrcOp &Src) |
Build and insert an appropriate cast between two registers of equal size. More... | |
MachineInstrBuilder | buildBr (MachineBasicBlock &Dest) |
Build and insert G_BR Dest . More... | |
MachineInstrBuilder | buildBrCond (unsigned Tst, MachineBasicBlock &Dest) |
Build and insert G_BRCOND Tst , Dest . More... | |
MachineInstrBuilder | buildBrIndirect (unsigned Tgt) |
Build and insert G_BRINDIRECT Tgt . More... | |
virtual MachineInstrBuilder | buildConstant (const DstOp &Res, const ConstantInt &Val) |
Build and insert Res = G_CONSTANT Val . More... | |
MachineInstrBuilder | buildConstant (const DstOp &Res, int64_t Val) |
Build and insert Res = G_CONSTANT Val . More... | |
virtual MachineInstrBuilder | buildFConstant (const DstOp &Res, const ConstantFP &Val) |
Build and insert Res = G_FCONSTANT Val . More... | |
MachineInstrBuilder | buildFConstant (const DstOp &Res, double Val) |
MachineInstrBuilder | buildCopy (const DstOp &Res, const SrcOp &Op) |
Build and insert Res = COPY Op. More... | |
MachineInstrBuilder | buildLoad (unsigned Res, unsigned Addr, MachineMemOperand &MMO) |
Build and insert Res = G_LOAD Addr, MMO . More... | |
MachineInstrBuilder | buildLoadInstr (unsigned Opcode, unsigned Res, unsigned Addr, MachineMemOperand &MMO) |
Build and insert Res = <opcode> Addr, MMO . More... | |
MachineInstrBuilder | buildStore (unsigned Val, unsigned Addr, MachineMemOperand &MMO) |
Build and insert G_STORE Val, Addr, MMO . More... | |
MachineInstrBuilder | buildExtract (unsigned Res, unsigned Src, uint64_t Index) |
Build and insert `Res0, ... More... | |
MachineInstrBuilder | buildUndef (const DstOp &Res) |
Build and insert Res = IMPLICIT_DEF. More... | |
void | buildSequence (unsigned Res, ArrayRef< unsigned > Ops, ArrayRef< uint64_t > Indices) |
Build and insert instructions to put Ops together at the specified p Indices to form a larger register. More... | |
MachineInstrBuilder | buildMerge (const DstOp &Res, ArrayRef< unsigned > Ops) |
Build and insert Res = G_MERGE_VALUES Op0 , ... More... | |
MachineInstrBuilder | buildUnmerge (ArrayRef< LLT > Res, const SrcOp &Op) |
Build and insert Res0 , ... More... | |
MachineInstrBuilder | buildUnmerge (ArrayRef< unsigned > Res, const SrcOp &Op) |
MachineInstrBuilder | buildBuildVector (const DstOp &Res, ArrayRef< unsigned > Ops) |
Build and insert Res = G_BUILD_VECTOR Op0 , ... More... | |
MachineInstrBuilder | buildBuildVectorTrunc (const DstOp &Res, ArrayRef< unsigned > Ops) |
Build and insert Res = G_BUILD_VECTOR_TRUNC Op0 , ... More... | |
MachineInstrBuilder | buildConcatVectors (const DstOp &Res, ArrayRef< unsigned > Ops) |
Build and insert Res = G_CONCAT_VECTORS Op0 , ... More... | |
MachineInstrBuilder | buildInsert (unsigned Res, unsigned Src, unsigned Op, unsigned Index) |
MachineInstrBuilder | buildIntrinsic (Intrinsic::ID ID, unsigned Res, bool HasSideEffects) |
Build and insert either a G_INTRINSIC (if HasSideEffects is false) or G_INTRINSIC_W_SIDE_EFFECTS instruction. More... | |
MachineInstrBuilder | buildFPTrunc (const DstOp &Res, const SrcOp &Op) |
Build and insert Res = G_FPTRUNC Op . More... | |
MachineInstrBuilder | buildTrunc (const DstOp &Res, const SrcOp &Op) |
Build and insert Res = G_TRUNC Op . More... | |
MachineInstrBuilder | buildICmp (CmpInst::Predicate Pred, const DstOp &Res, const SrcOp &Op0, const SrcOp &Op1) |
Build and insert a Res = G_ICMP Pred , Op0 , Op1 . More... | |
MachineInstrBuilder | buildFCmp (CmpInst::Predicate Pred, const DstOp &Res, const SrcOp &Op0, const SrcOp &Op1) |
Build and insert a Res = G_FCMP Pred Op1 . More... | |
MachineInstrBuilder | buildSelect (const DstOp &Res, const SrcOp &Tst, const SrcOp &Op0, const SrcOp &Op1) |
Build and insert a Res = G_SELECT Tst , Op0 , Op1 . More... | |
MachineInstrBuilder | buildInsertVectorElement (const DstOp &Res, const SrcOp &Val, const SrcOp &Elt, const SrcOp &Idx) |
Build and insert Res = G_INSERT_VECTOR_ELT Val , Elt , Idx . More... | |
MachineInstrBuilder | buildExtractVectorElement (const DstOp &Res, const SrcOp &Val, const SrcOp &Idx) |
Build and insert Res = G_EXTRACT_VECTOR_ELT Val , Idx . More... | |
MachineInstrBuilder | buildAtomicCmpXchgWithSuccess (unsigned OldValRes, unsigned SuccessRes, unsigned Addr, unsigned CmpVal, unsigned NewVal, MachineMemOperand &MMO) |
Build and insert OldValRes<def>, SuccessRes<def> = G_ATOMIC_CMPXCHG_WITH_SUCCESS Addr, CmpVal, NewVal, MMO . More... | |
MachineInstrBuilder | buildAtomicCmpXchg (unsigned OldValRes, unsigned Addr, unsigned CmpVal, unsigned NewVal, MachineMemOperand &MMO) |
Build and insert OldValRes<def> = G_ATOMIC_CMPXCHG Addr, CmpVal, NewVal, MMO . More... | |
MachineInstrBuilder | buildAtomicRMW (unsigned Opcode, unsigned OldValRes, unsigned Addr, unsigned Val, MachineMemOperand &MMO) |
Build and insert OldValRes<def> = G_ATOMICRMW_<Opcode> Addr, Val, MMO . More... | |
MachineInstrBuilder | buildAtomicRMWXchg (unsigned OldValRes, unsigned Addr, unsigned Val, MachineMemOperand &MMO) |
Build and insert OldValRes<def> = G_ATOMICRMW_XCHG Addr, Val, MMO . More... | |
MachineInstrBuilder | buildAtomicRMWAdd (unsigned OldValRes, unsigned Addr, unsigned Val, MachineMemOperand &MMO) |
Build and insert OldValRes<def> = G_ATOMICRMW_ADD Addr, Val, MMO . More... | |
MachineInstrBuilder | buildAtomicRMWSub (unsigned OldValRes, unsigned Addr, unsigned Val, MachineMemOperand &MMO) |
Build and insert OldValRes<def> = G_ATOMICRMW_SUB Addr, Val, MMO . More... | |
MachineInstrBuilder | buildAtomicRMWAnd (unsigned OldValRes, unsigned Addr, unsigned Val, MachineMemOperand &MMO) |
Build and insert OldValRes<def> = G_ATOMICRMW_AND Addr, Val, MMO . More... | |
MachineInstrBuilder | buildAtomicRMWNand (unsigned OldValRes, unsigned Addr, unsigned Val, MachineMemOperand &MMO) |
Build and insert OldValRes<def> = G_ATOMICRMW_NAND Addr, Val, MMO . More... | |
MachineInstrBuilder | buildAtomicRMWOr (unsigned OldValRes, unsigned Addr, unsigned Val, MachineMemOperand &MMO) |
Build and insert OldValRes<def> = G_ATOMICRMW_OR Addr, Val, MMO . More... | |
MachineInstrBuilder | buildAtomicRMWXor (unsigned OldValRes, unsigned Addr, unsigned Val, MachineMemOperand &MMO) |
Build and insert OldValRes<def> = G_ATOMICRMW_XOR Addr, Val, MMO . More... | |
MachineInstrBuilder | buildAtomicRMWMax (unsigned OldValRes, unsigned Addr, unsigned Val, MachineMemOperand &MMO) |
Build and insert OldValRes<def> = G_ATOMICRMW_MAX Addr, Val, MMO . More... | |
MachineInstrBuilder | buildAtomicRMWMin (unsigned OldValRes, unsigned Addr, unsigned Val, MachineMemOperand &MMO) |
Build and insert OldValRes<def> = G_ATOMICRMW_MIN Addr, Val, MMO . More... | |
MachineInstrBuilder | buildAtomicRMWUmax (unsigned OldValRes, unsigned Addr, unsigned Val, MachineMemOperand &MMO) |
Build and insert OldValRes<def> = G_ATOMICRMW_UMAX Addr, Val, MMO . More... | |
MachineInstrBuilder | buildAtomicRMWUmin (unsigned OldValRes, unsigned Addr, unsigned Val, MachineMemOperand &MMO) |
Build and insert OldValRes<def> = G_ATOMICRMW_UMIN Addr, Val, MMO . More... | |
MachineInstrBuilder | buildBlockAddress (unsigned Res, const BlockAddress *BA) |
Build and insert Res = G_BLOCK_ADDR BA . More... | |
MachineInstrBuilder | buildAdd (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1, Optional< unsigned > Flags=None) |
Build and insert Res = G_ADD Op0 , Op1 . More... | |
MachineInstrBuilder | buildSub (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1, Optional< unsigned > Flags=None) |
Build and insert Res = G_SUB Op0 , Op1 . More... | |
MachineInstrBuilder | buildMul (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1, Optional< unsigned > Flags=None) |
Build and insert Res = G_MUL Op0 , Op1 . More... | |
MachineInstrBuilder | buildAnd (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1) |
Build and insert Res = G_AND Op0 , Op1 . More... | |
MachineInstrBuilder | buildOr (const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1) |
Build and insert Res = G_OR Op0 , Op1 . More... | |
void | setMF (MachineFunction &MF) |
void | setMBB (MachineBasicBlock &MBB) |
Set the insertion point to the end of MBB . More... | |
void | setInstr (MachineInstr &MI) |
Set the insertion point to before MI. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from llvm::MachineIRBuilder | |
void | validateTruncExt (const LLT &Dst, const LLT &Src, bool IsExtend) |
void | validateBinaryOp (const LLT &Res, const LLT &Op0, const LLT &Op1) |
void | validateSelectOp (const LLT &ResTy, const LLT &TstTy, const LLT &Op0Ty, const LLT &Op1Ty) |
void | recordInsertion (MachineInstr *MI) const |
An MIRBuilder which does trivial constant folding of binary ops.
Calls to buildInstr will also try to constant fold binary ops.
Definition at line 20 of file ConstantFoldingMIRBuilder.h.
|
virtualdefault |
|
inlineoverridevirtual |
Reimplemented from llvm::MachineIRBuilder.
Definition at line 29 of file ConstantFoldingMIRBuilder.h.
References assert(), llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildInstr(), llvm::ConstantFoldBinOp(), llvm::MachineIRBuilder::getMRI(), llvm::SrcOp::getReg(), and llvm::ArrayRef< T >::size().