30#define DEBUG_TYPE "mips-isel"
31#define PASS_NAME "MIPS DAG->DAG Pattern Instruction Selection"
53 processFunctionAfterISel(
MF);
147bool MipsDAGToDAGISel::selectVSplat(
SDNode *
N,
APInt &Imm,
148 unsigned MinSizeInBits)
const {
154 unsigned ImmBitSize)
const {
158bool MipsDAGToDAGISel::selectVSplatUimmPow2(
SDValue N,
SDValue &Imm)
const {
163bool MipsDAGToDAGISel::selectVSplatUimmInvPow2(
SDValue N,
SDValue &Imm)
const {
168bool MipsDAGToDAGISel::selectVSplatMaskL(
SDValue N,
SDValue &Imm)
const {
173bool MipsDAGToDAGISel::selectVSplatMaskR(
SDValue N,
SDValue &Imm)
const {
178bool MipsDAGToDAGISel::selectVSplatImmEq1(
SDValue N)
const {
185bool MipsDAGToDAGISel::selectVecAddAsVecSubIfProfitable(
SDNode *
Node) {
188 EVT VT =
Node->getValueType(0);
194 auto *BVN = dyn_cast<BuildVectorSDNode>(
C);
198 APInt SplatValue, SplatUndef;
199 unsigned SplatBitSize;
202 if (!BVN->isConstantSplat(SplatValue, SplatUndef, SplatBitSize, HasAnyUndefs,
206 auto IsInlineConstant = [](
const APInt &
Imm) {
return Imm.isIntN(5); };
208 if (IsInlineConstant(SplatValue))
211 APInt NegSplatValue = 0 - SplatValue;
212 if (!IsInlineConstant(NegSplatValue))
219 assert(NegC &&
"Constant-folding failed!");
230 unsigned Opcode =
Node->getOpcode();
233 if (
Node->isMachineOpcode()) {
247 if (
Node->getSimpleValueType(0).isVector() &&
248 selectVecAddAsVecSubIfProfitable(
Node))
261 cast<MemSDNode>(
Node)->getAlign() >=
262 cast<MemSDNode>(
Node)->getMemoryVT().getStoreSize()) &&
263 "Unexpected unaligned loads/stores.");
272bool MipsDAGToDAGISel::SelectInlineAsmMemoryOperand(
274 std::vector<SDValue> &OutOps) {
276 switch(ConstraintID) {
282 OutOps.push_back(
Op);
288bool MipsDAGToDAGISel::isUnneededShiftMask(
SDNode *
N,
289 unsigned ShAmtBits)
const {
292 const APInt &
RHS =
N->getConstantOperandAPInt(1);
293 if (
RHS.countr_one() >= ShAmtBits) {
297 <<
" Need optimize 'and & shl/srl/sra' and operand value bits is "
298 <<
RHS.countr_one() <<
"\n");
303 return (Known.
Zero | RHS).countr_one() >= ShAmtBits;
309 std::unique_ptr<SelectionDAGISel> S)
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
This file declares the MachineConstantPool class which is an abstract constant pool to keep track of ...
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
DEMANGLE_DUMP_METHOD void dump() const
Class for arbitrary precision integers.
Represent the analysis usage information of a pass.
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
This class represents an Operation in the Expression.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
MipsDAGToDAGISelLegacy(std::unique_ptr< SelectionDAGISel > S)
bool runOnMachineFunction(MachineFunction &MF) override
const MipsSubtarget * Subtarget
Keep a pointer to the MipsSubtarget around so that we can make the right decision when generating cod...
SDNode * getGlobalBaseReg()
getGlobalBaseReg - Output the instructions required to put the GOT address into a register.
MipsFunctionInfo - This class is derived from MachineFunction private Mips target-specific informatio...
bool systemSupportsUnalignedAccess() const
Does the system support unaligned memory access.
Wrapper class representing virtual and physical registers.
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
Represents one node in the SelectionDAG.
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation.
SDNode * getNode() const
get the SDNode which holds the desired result
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
void ReplaceNode(SDNode *F, SDNode *T)
Replace all uses of F with T, then remove F from the DAG.
virtual bool runOnMachineFunction(MachineFunction &mf)
const TargetLowering * getTargetLowering() const
SDValue getRegister(Register Reg, EVT VT)
const DataLayout & getDataLayout() const
SDValue getConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isTarget=false, bool isOpaque=false)
Create a ConstantSDNode wrapping a constant value.
SDValue FoldConstantArithmetic(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDValue > Ops, SDNodeFlags Flags=SDNodeFlags())
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDUse > Ops)
Gets or creates the specified node.
KnownBits computeKnownBits(SDValue Op, unsigned Depth=0) const
Determine which bits of Op are known to be either zero or one and return them in Known.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ C
The default llvm calling convention, compatible with C.
@ ADD
Simple integer binary arithmetic operators.
@ LOAD
LOAD and STORE have token chains as their first operand, then the same operands as an LLVM load/store...
@ GLOBAL_OFFSET_TABLE
The address of the GOT.
@ AND
Bitwise operators - logical and, logical or, logical xor.
This is an optimization pass for GlobalISel generic memory operations.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Implement std::hash so that hash_code can be used in STL containers.
bool isVector() const
Return true if this is a vector value type.