| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
#ifndef LLVM_CODEGEN_SELECTIONDAG_H |
| 15 |
#define LLVM_CODEGEN_SELECTIONDAG_H |
| 16 |
|
| 17 |
#include "llvm/ADT/APFloat.h" |
| 18 |
#include "llvm/ADT/APInt.h" |
| 19 |
#include "llvm/ADT/ArrayRef.h" |
| 20 |
#include "llvm/ADT/DenseMap.h" |
| 21 |
#include "llvm/ADT/DenseSet.h" |
| 22 |
#include "llvm/ADT/FoldingSet.h" |
| 23 |
#include "llvm/ADT/SetVector.h" |
| 24 |
#include "llvm/ADT/SmallVector.h" |
| 25 |
#include "llvm/ADT/StringMap.h" |
| 26 |
#include "llvm/ADT/ilist.h" |
| 27 |
#include "llvm/ADT/iterator.h" |
| 28 |
#include "llvm/ADT/iterator_range.h" |
| 29 |
#include "llvm/CodeGen/DAGCombine.h" |
| 30 |
#include "llvm/CodeGen/ISDOpcodes.h" |
| 31 |
#include "llvm/CodeGen/MachineFunction.h" |
| 32 |
#include "llvm/CodeGen/MachineMemOperand.h" |
| 33 |
#include "llvm/CodeGen/SelectionDAGNodes.h" |
| 34 |
#include "llvm/CodeGen/ValueTypes.h" |
| 35 |
#include "llvm/IR/DebugLoc.h" |
| 36 |
#include "llvm/IR/Instructions.h" |
| 37 |
#include "llvm/IR/Metadata.h" |
| 38 |
#include "llvm/Support/Allocator.h" |
| 39 |
#include "llvm/Support/ArrayRecycler.h" |
| 40 |
#include "llvm/Support/AtomicOrdering.h" |
| 41 |
#include "llvm/Support/Casting.h" |
| 42 |
#include "llvm/Support/CodeGen.h" |
| 43 |
#include "llvm/Support/ErrorHandling.h" |
| 44 |
#include "llvm/Support/MachineValueType.h" |
| 45 |
#include "llvm/Support/RecyclingAllocator.h" |
| 46 |
#include <algorithm> |
| 47 |
#include <cassert> |
| 48 |
#include <cstdint> |
| 49 |
#include <functional> |
| 50 |
#include <map> |
| 51 |
#include <string> |
| 52 |
#include <tuple> |
| 53 |
#include <utility> |
| 54 |
#include <vector> |
| 55 |
|
| 56 |
namespace llvm { |
| 57 |
|
| 58 |
class AAResults; |
| 59 |
class BlockAddress; |
| 60 |
class BlockFrequencyInfo; |
| 61 |
class Constant; |
| 62 |
class ConstantFP; |
| 63 |
class ConstantInt; |
| 64 |
class DataLayout; |
| 65 |
struct fltSemantics; |
| 66 |
class FunctionLoweringInfo; |
| 67 |
class GlobalValue; |
| 68 |
struct KnownBits; |
| 69 |
class LegacyDivergenceAnalysis; |
| 70 |
class LLVMContext; |
| 71 |
class MachineBasicBlock; |
| 72 |
class MachineConstantPoolValue; |
| 73 |
class MCSymbol; |
| 74 |
class OptimizationRemarkEmitter; |
| 75 |
class ProfileSummaryInfo; |
| 76 |
class SDDbgValue; |
| 77 |
class SDDbgOperand; |
| 78 |
class SDDbgLabel; |
| 79 |
class SelectionDAG; |
| 80 |
class SelectionDAGTargetInfo; |
| 81 |
class TargetLibraryInfo; |
| 82 |
class TargetLowering; |
| 83 |
class TargetMachine; |
| 84 |
class TargetSubtargetInfo; |
| 85 |
class Value; |
| 86 |
|
| 87 |
class SDVTListNode : public FoldingSetNode { |
| 88 |
friend struct FoldingSetTrait<SDVTListNode>; |
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
FoldingSetNodeIDRef FastID; |
| 96 |
const EVT *VTs; |
| 97 |
unsigned int NumVTs; |
| 98 |
|
| 99 |
|
| 100 |
unsigned HashValue; |
| 101 |
|
| 102 |
public: |
| 103 |
SDVTListNode(const FoldingSetNodeIDRef ID, const EVT *VT, unsigned int Num) : |
| 104 |
FastID(ID), VTs(VT), NumVTs(Num) { |
| 105 |
HashValue = ID.ComputeHash(); |
| 106 |
} |
| 107 |
|
| 108 |
SDVTList getSDVTList() { |
| 109 |
SDVTList result = {VTs, NumVTs}; |
| 110 |
return result; |
| 111 |
} |
| 112 |
}; |
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
template<> struct FoldingSetTrait<SDVTListNode> : DefaultFoldingSetTrait<SDVTListNode> { |
| 117 |
static void Profile(const SDVTListNode &X, FoldingSetNodeID& ID) { |
| 118 |
ID = X.FastID; |
| 119 |
} |
| 120 |
|
| 121 |
static bool Equals(const SDVTListNode &X, const FoldingSetNodeID &ID, |
| 122 |
unsigned IDHash, FoldingSetNodeID &TempID) { |
| 123 |
if (X.HashValue != IDHash) |
| 124 |
return false; |
| 125 |
return ID == X.FastID; |
| 126 |
} |
| 127 |
|
| 128 |
static unsigned ComputeHash(const SDVTListNode &X, FoldingSetNodeID &TempID) { |
| 129 |
return X.HashValue; |
| 130 |
} |
| 131 |
}; |
| 132 |
|
| 133 |
template <> struct ilist_alloc_traits<SDNode> { |
| 134 |
static void deleteNode(SDNode *) { |
| 135 |
llvm_unreachable("ilist_traits<SDNode> shouldn't see a deleteNode call!"); |
| 136 |
} |
| 137 |
}; |
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
class SDDbgInfo { |
| 151 |
BumpPtrAllocator Alloc; |
| 152 |
SmallVector<SDDbgValue*, 32> DbgValues; |
| 153 |
SmallVector<SDDbgValue*, 32> ByvalParmDbgValues; |
| 154 |
SmallVector<SDDbgLabel*, 4> DbgLabels; |
| 155 |
using DbgValMapType = DenseMap<const SDNode *, SmallVector<SDDbgValue *, 2>>; |
| 156 |
DbgValMapType DbgValMap; |
| 157 |
|
| 158 |
public: |
| 159 |
SDDbgInfo() = default; |
| 160 |
SDDbgInfo(const SDDbgInfo &) = delete; |
| 161 |
SDDbgInfo &operator=(const SDDbgInfo &) = delete; |
| 162 |
|
| 163 |
void add(SDDbgValue *V, bool isParameter); |
| 164 |
|
| 165 |
void add(SDDbgLabel *L) { DbgLabels.push_back(L); } |
| 166 |
|
| 167 |
|
| 168 |
|
| 169 |
void erase(const SDNode *Node); |
| 170 |
|
| 171 |
void clear() { |
| 172 |
DbgValMap.clear(); |
| 173 |
DbgValues.clear(); |
| 174 |
ByvalParmDbgValues.clear(); |
| 175 |
DbgLabels.clear(); |
| 176 |
Alloc.Reset(); |
| 177 |
} |
| 178 |
|
| 179 |
BumpPtrAllocator &getAlloc() { return Alloc; } |
| 180 |
|
| 181 |
bool empty() const { |
| 182 |
return DbgValues.empty() && ByvalParmDbgValues.empty() && DbgLabels.empty(); |
| 183 |
} |
| 184 |
|
| 185 |
ArrayRef<SDDbgValue*> getSDDbgValues(const SDNode *Node) const { |
| 186 |
auto I = DbgValMap.find(Node); |
| 187 |
if (I != DbgValMap.end()) |
| 188 |
return I->second; |
| 189 |
return ArrayRef<SDDbgValue*>(); |
| 190 |
} |
| 191 |
|
| 192 |
using DbgIterator = SmallVectorImpl<SDDbgValue*>::iterator; |
| 193 |
using DbgLabelIterator = SmallVectorImpl<SDDbgLabel*>::iterator; |
| 194 |
|
| 195 |
DbgIterator DbgBegin() { return DbgValues.begin(); } |
| 196 |
DbgIterator DbgEnd() { return DbgValues.end(); } |
| 197 |
DbgIterator ByvalParmDbgBegin() { return ByvalParmDbgValues.begin(); } |
| 198 |
DbgIterator ByvalParmDbgEnd() { return ByvalParmDbgValues.end(); } |
| 199 |
DbgLabelIterator DbgLabelBegin() { return DbgLabels.begin(); } |
| 200 |
DbgLabelIterator DbgLabelEnd() { return DbgLabels.end(); } |
| 201 |
}; |
| 202 |
|
| 203 |
void checkForCycles(const SelectionDAG *DAG, bool force = false); |
| 204 |
|
| 205 |
|
| 206 |
|
| 207 |
|
| 208 |
|
| 209 |
|
| 210 |
|
| 211 |
|
| 212 |
|
| 213 |
|
| 214 |
|
| 215 |
|
| 216 |
class SelectionDAG { |
| 217 |
const TargetMachine &TM; |
| 218 |
const SelectionDAGTargetInfo *TSI = nullptr; |
| 219 |
const TargetLowering *TLI = nullptr; |
| 220 |
const TargetLibraryInfo *LibInfo = nullptr; |
| 221 |
MachineFunction *MF; |
| 222 |
Pass *SDAGISelPass = nullptr; |
| 223 |
LLVMContext *Context; |
| 224 |
CodeGenOpt::Level OptLevel; |
| 225 |
|
| 226 |
LegacyDivergenceAnalysis * DA = nullptr; |
| 227 |
FunctionLoweringInfo * FLI = nullptr; |
| 228 |
|
| 229 |
|
| 230 |
|
| 231 |
OptimizationRemarkEmitter *ORE; |
| 232 |
|
| 233 |
ProfileSummaryInfo *PSI = nullptr; |
| 234 |
BlockFrequencyInfo *BFI = nullptr; |
| 235 |
|
| 236 |
|
| 237 |
SDNode EntryNode; |
| 238 |
|
| 239 |
|
| 240 |
SDValue Root; |
| 241 |
|
| 242 |
|
| 243 |
ilist<SDNode> AllNodes; |
| 244 |
|
| 245 |
|
| 246 |
|
| 247 |
using NodeAllocatorType = RecyclingAllocator<BumpPtrAllocator, SDNode, |
| 248 |
sizeof(LargestSDNode), |
| 249 |
alignof(MostAlignedSDNode)>; |
| 250 |
|
| 251 |
|
| 252 |
NodeAllocatorType NodeAllocator; |
| 253 |
|
| 254 |
|
| 255 |
|
| 256 |
FoldingSet<SDNode> CSEMap; |
| 257 |
|
| 258 |
|
| 259 |
BumpPtrAllocator OperandAllocator; |
| 260 |
ArrayRecycler<SDUse> OperandRecycler; |
| 261 |
|
| 262 |
|
| 263 |
BumpPtrAllocator Allocator; |
| 264 |
|
| 265 |
|
| 266 |
SDDbgInfo *DbgInfo; |
| 267 |
|
| 268 |
using CallSiteInfo = MachineFunction::CallSiteInfo; |
| 269 |
using CallSiteInfoImpl = MachineFunction::CallSiteInfoImpl; |
| 270 |
|
| 271 |
struct CallSiteDbgInfo { |
| 272 |
CallSiteInfo CSInfo; |
| 273 |
MDNode *HeapAllocSite = nullptr; |
| 274 |
bool NoMerge = false; |
| 275 |
}; |
| 276 |
|
| 277 |
DenseMap<const SDNode *, CallSiteDbgInfo> SDCallSiteDbgInfo; |
| 278 |
|
| 279 |
uint16_t NextPersistentId = 0; |
| 280 |
|
| 281 |
|
| 282 |
bool UseInstrRefDebugInfo = false; |
| 283 |
|
| 284 |
public: |
| 285 |
|
| 286 |
|
| 287 |
|
| 288 |
|
| 289 |
|
| 290 |
|
| 291 |
struct DAGUpdateListener { |
| 292 |
DAGUpdateListener *const Next; |
| 293 |
SelectionDAG &DAG; |
| 294 |
|
| 295 |
explicit DAGUpdateListener(SelectionDAG &D) |
| 296 |
: Next(D.UpdateListeners), DAG(D) { |
| 297 |
DAG.UpdateListeners = this; |
| 298 |
} |
| 299 |
|
| 300 |
virtual ~DAGUpdateListener() { |
| 301 |
assert(DAG.UpdateListeners == this && |
| 302 |
"DAGUpdateListeners must be destroyed in LIFO order"); |
| 303 |
DAG.UpdateListeners = Next; |
| 304 |
} |
| 305 |
|
| 306 |
|
| 307 |
|
| 308 |
virtual void NodeDeleted(SDNode *N, SDNode *E); |
| 309 |
|
| 310 |
|
| 311 |
virtual void NodeUpdated(SDNode *N); |
| 312 |
|
| 313 |
|
| 314 |
virtual void NodeInserted(SDNode *N); |
| 315 |
}; |
| 316 |
|
| 317 |
struct DAGNodeDeletedListener : public DAGUpdateListener { |
| 318 |
std::function<void(SDNode *, SDNode *)> Callback; |
| 319 |
|
| 320 |
DAGNodeDeletedListener(SelectionDAG &DAG, |
| 321 |
std::function<void(SDNode *, SDNode *)> Callback) |
| 322 |
: DAGUpdateListener(DAG), Callback(std::move(Callback)) {} |
| 323 |
|
| 324 |
void NodeDeleted(SDNode *N, SDNode *E) override { Callback(N, E); } |
| 325 |
|
| 326 |
private: |
| 327 |
virtual void anchor(); |
| 328 |
}; |
| 329 |
|
| 330 |
|
| 331 |
|
| 332 |
class FlagInserter { |
| 333 |
SelectionDAG &DAG; |
| 334 |
SDNodeFlags Flags; |
| 335 |
FlagInserter *LastInserter; |
| 336 |
|
| 337 |
public: |
| 338 |
FlagInserter(SelectionDAG &SDAG, SDNodeFlags Flags) |
| 339 |
: DAG(SDAG), Flags(Flags), |
| 340 |
LastInserter(SDAG.getFlagInserter()) { |
| 341 |
SDAG.setFlagInserter(this); |
| 342 |
} |
| 343 |
FlagInserter(SelectionDAG &SDAG, SDNode *N) |
| 344 |
: FlagInserter(SDAG, N->getFlags()) {} |
| 345 |
|
| 346 |
FlagInserter(const FlagInserter &) = delete; |
| 347 |
FlagInserter &operator=(const FlagInserter &) = delete; |
| 348 |
~FlagInserter() { DAG.setFlagInserter(LastInserter); } |
| 349 |
|
| 350 |
SDNodeFlags getFlags() const { return Flags; } |
| 351 |
}; |
| 352 |
|
| 353 |
|
| 354 |
|
| 355 |
|
| 356 |
|
| 357 |
|
| 358 |
bool NewNodesMustHaveLegalTypes = false; |
| 359 |
|
| 360 |
private: |
| 361 |
|
| 362 |
friend struct DAGUpdateListener; |
| 363 |
|
| 364 |
|
| 365 |
|
| 366 |
DAGUpdateListener *UpdateListeners = nullptr; |
| 367 |
|
| 368 |
|
| 369 |
|
| 370 |
bool setSubgraphColorHelper(SDNode *N, const char *Color, |
| 371 |
DenseSet<SDNode *> &visited, |
| 372 |
int level, bool &printed); |
| 373 |
|
| 374 |
template <typename SDNodeT, typename... ArgTypes> |
| 375 |
SDNodeT *newSDNode(ArgTypes &&... Args) { |
| 376 |
return new (NodeAllocator.template Allocate<SDNodeT>()) |
| 377 |
SDNodeT(std::forward<ArgTypes>(Args)...); |
| 378 |
} |
| 379 |
|
| 380 |
|
| 381 |
|
| 382 |
|
| 383 |
|
| 384 |
|
| 385 |
|
| 386 |
template <typename SDNodeT, typename... ArgTypes> |
| 387 |
static uint16_t getSyntheticNodeSubclassData(unsigned IROrder, |
| 388 |
ArgTypes &&... Args) { |
| 389 |
|
| 390 |
|
| 391 |
|
| 392 |
return SDNodeT(IROrder, DebugLoc(), std::forward<ArgTypes>(Args)...) |
| 393 |
.getRawSubclassData(); |
| 394 |
} |
| 395 |
|
| 396 |
template <typename SDNodeTy> |
| 397 |
static uint16_t getSyntheticNodeSubclassData(unsigned Opc, unsigned Order, |
| 398 |
SDVTList VTs, EVT MemoryVT, |
| 399 |
MachineMemOperand *MMO) { |
| 400 |
return SDNodeTy(Opc, Order, DebugLoc(), VTs, MemoryVT, MMO) |
| 401 |
.getRawSubclassData(); |
| 402 |
} |
| 403 |
|
| 404 |
void createOperands(SDNode *Node, ArrayRef<SDValue> Vals); |
| 405 |
|
| 406 |
void removeOperands(SDNode *Node) { |
| 407 |
if (!Node->OperandList) |
| 408 |
return; |
| 409 |
OperandRecycler.deallocate( |
| 410 |
ArrayRecycler<SDUse>::Capacity::get(Node->NumOperands), |
| 411 |
Node->OperandList); |
| 412 |
Node->NumOperands = 0; |
| 413 |
Node->OperandList = nullptr; |
| 414 |
} |
| 415 |
void CreateTopologicalOrder(std::vector<SDNode*>& Order); |
| 416 |
|
| 417 |
public: |
| 418 |
|
| 419 |
static constexpr unsigned MaxRecursionDepth = 6; |
| 420 |
|
| 421 |
explicit SelectionDAG(const TargetMachine &TM, CodeGenOpt::Level); |
| 422 |
SelectionDAG(const SelectionDAG &) = delete; |
| 423 |
SelectionDAG &operator=(const SelectionDAG &) = delete; |
| 424 |
~SelectionDAG(); |
| 425 |
|
| 426 |
|
| 427 |
void init(MachineFunction &NewMF, OptimizationRemarkEmitter &NewORE, |
| 428 |
Pass *PassPtr, const TargetLibraryInfo *LibraryInfo, |
| 429 |
LegacyDivergenceAnalysis * Divergence, |
| 430 |
ProfileSummaryInfo *PSIin, BlockFrequencyInfo *BFIin); |
| 431 |
|
| 432 |
void setFunctionLoweringInfo(FunctionLoweringInfo * FuncInfo) { |
| 433 |
FLI = FuncInfo; |
| 434 |
} |
| 435 |
|
| 436 |
|
| 437 |
|
| 438 |
void clear(); |
| 439 |
|
| 440 |
MachineFunction &getMachineFunction() const { return *MF; } |
| 441 |
const Pass *getPass() const { return SDAGISelPass; } |
| 442 |
|
| 443 |
const DataLayout &getDataLayout() const { return MF->getDataLayout(); } |
| 444 |
const TargetMachine &getTarget() const { return TM; } |
| 445 |
const TargetSubtargetInfo &getSubtarget() const { return MF->getSubtarget(); } |
| 446 |
const TargetLowering &getTargetLoweringInfo() const { return *TLI; } |
| 447 |
const TargetLibraryInfo &getLibInfo() const { return *LibInfo; } |
| 448 |
const SelectionDAGTargetInfo &getSelectionDAGInfo() const { return *TSI; } |
| 449 |
const LegacyDivergenceAnalysis *getDivergenceAnalysis() const { return DA; } |
| 450 |
LLVMContext *getContext() const { return Context; } |
| 451 |
OptimizationRemarkEmitter &getORE() const { return *ORE; } |
| 452 |
ProfileSummaryInfo *getPSI() const { return PSI; } |
| 453 |
BlockFrequencyInfo *getBFI() const { return BFI; } |
| 454 |
|
| 455 |
FlagInserter *getFlagInserter() { return Inserter; } |
| 456 |
void setFlagInserter(FlagInserter *FI) { Inserter = FI; } |
| 457 |
|
| 458 |
|
| 459 |
|
| 460 |
|
| 461 |
|
| 462 |
|
| 463 |
|
| 464 |
|
| 465 |
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) |
| 466 |
LLVM_DUMP_METHOD void dumpDotGraph(const Twine &FileName, const Twine &Title); |
| 467 |
#endif |
| 468 |
|
| 469 |
|
| 470 |
void viewGraph(const std::string &Title); |
| 471 |
void viewGraph(); |
| 472 |
|
| 473 |
#ifndef NDEBUG |
| 474 |
std::map<const SDNode *, std::string> NodeGraphAttrs; |
| 475 |
#endif |
| 476 |
|
| 477 |
|
| 478 |
|
| 479 |
void clearGraphAttrs(); |
| 480 |
|
| 481 |
|
| 482 |
void setGraphAttrs(const SDNode *N, const char *Attrs); |
| 483 |
|
| 484 |
|
| 485 |
|
| 486 |
std::string getGraphAttrs(const SDNode *N) const; |
| 487 |
|
| 488 |
|
| 489 |
void setGraphColor(const SDNode *N, const char *Color); |
| 490 |
|
| 491 |
|
| 492 |
void setSubgraphColor(SDNode *N, const char *Color); |
| 493 |
|
| 494 |
using allnodes_const_iterator = ilist<SDNode>::const_iterator; |
| 495 |
|
| 496 |
allnodes_const_iterator allnodes_begin() const { return AllNodes.begin(); } |
| 497 |
allnodes_const_iterator allnodes_end() const { return AllNodes.end(); } |
| 498 |
|
| 499 |
using allnodes_iterator = ilist<SDNode>::iterator; |
| 500 |
|
| 501 |
allnodes_iterator allnodes_begin() { return AllNodes.begin(); } |
| 502 |
allnodes_iterator allnodes_end() { return AllNodes.end(); } |
| 503 |
|
| 504 |
ilist<SDNode>::size_type allnodes_size() const { |
| 505 |
return AllNodes.size(); |
| 506 |
} |
| 507 |
|
| 508 |
iterator_range<allnodes_iterator> allnodes() { |
| 509 |
return make_range(allnodes_begin(), allnodes_end()); |
| 510 |
} |
| 511 |
iterator_range<allnodes_const_iterator> allnodes() const { |
| 512 |
return make_range(allnodes_begin(), allnodes_end()); |
| 513 |
} |
| 514 |
|
| 515 |
|
| 516 |
const SDValue &getRoot() const { return Root; } |
| 517 |
|
| 518 |
|
| 519 |
SDValue getEntryNode() const { |
| 520 |
return SDValue(const_cast<SDNode *>(&EntryNode), 0); |
| 521 |
} |
| 522 |
|
| 523 |
|
| 524 |
|
| 525 |
const SDValue &setRoot(SDValue N) { |
| 526 |
assert((!N.getNode() || N.getValueType() == MVT::Other) && |
| 527 |
"DAG root value is not a chain!"); |
| 528 |
if (N.getNode()) |
| 529 |
checkForCycles(N.getNode(), this); |
| 530 |
Root = N; |
| 531 |
if (N.getNode()) |
| 532 |
checkForCycles(this); |
| 533 |
return Root; |
| 534 |
} |
| 535 |
|
| 536 |
#ifndef NDEBUG |
| 537 |
void VerifyDAGDivergence(); |
| 538 |
#endif |
| 539 |
|
| 540 |
|
| 541 |
|
| 542 |
|
| 543 |
|
| 544 |
void Combine(CombineLevel Level, AAResults *AA, |
| 545 |
CodeGenOpt::Level OptLevel); |
| 546 |
|
| 547 |
|
| 548 |
|
| 549 |
|
| 550 |
|
| 551 |
|
| 552 |
|
| 553 |
bool LegalizeTypes(); |
| 554 |
|
| 555 |
|
| 556 |
|
| 557 |
|
| 558 |
|
| 559 |
|
| 560 |
|
| 561 |
void Legalize(); |
| 562 |
|
| 563 |
|
| 564 |
|
| 565 |
|
| 566 |
|
| 567 |
|
| 568 |
|
| 569 |
|
| 570 |
|
| 571 |
|
| 572 |
|
| 573 |
|
| 574 |
|
| 575 |
|
| 576 |
|
| 577 |
|
| 578 |
|
| 579 |
|
| 580 |
|
| 581 |
|
| 582 |
bool LegalizeOp(SDNode *N, SmallSetVector<SDNode *, 16> &UpdatedNodes); |
| 583 |
|
| 584 |
|
| 585 |
|
| 586 |
|
| 587 |
|
| 588 |
|
| 589 |
|
| 590 |
|
| 591 |
|
| 592 |
|
| 593 |
|
| 594 |
|
| 595 |
bool LegalizeVectors(); |
| 596 |
|
| 597 |
|
| 598 |
void RemoveDeadNodes(); |
| 599 |
|
| 600 |
|
| 601 |
|
| 602 |
void DeleteNode(SDNode *N); |
| 603 |
|
| 604 |
|
| 605 |
SDVTList getVTList(EVT VT); |
| 606 |
SDVTList getVTList(EVT VT1, EVT VT2); |
| 607 |
SDVTList getVTList(EVT VT1, EVT VT2, EVT VT3); |
| 608 |
SDVTList getVTList(EVT VT1, EVT VT2, EVT VT3, EVT VT4); |
| 609 |
SDVTList getVTList(ArrayRef<EVT> VTs); |
| 610 |
|
| 611 |
|
| 612 |
|
| 613 |
|
| 614 |
|
| 615 |
|
| 616 |
|
| 617 |
|
| 618 |
|
| 619 |
|
| 620 |
SDValue getConstant(uint64_t Val, const SDLoc &DL, EVT VT, |
| 621 |
bool isTarget = false, bool isOpaque = false); |
| 622 |
SDValue getConstant(const APInt &Val, const SDLoc &DL, EVT VT, |
| 623 |
bool isTarget = false, bool isOpaque = false); |
| 624 |
|
| 625 |
SDValue getAllOnesConstant(const SDLoc &DL, EVT VT, bool IsTarget = false, |
| 626 |
bool IsOpaque = false) { |
| 627 |
return getConstant(APInt::getAllOnes(VT.getScalarSizeInBits()), DL, VT, |
| 628 |
IsTarget, IsOpaque); |
| 629 |
} |
| 630 |
|
| 631 |
SDValue getConstant(const ConstantInt &Val, const SDLoc &DL, EVT VT, |
| 632 |
bool isTarget = false, bool isOpaque = false); |
| 633 |
SDValue getIntPtrConstant(uint64_t Val, const SDLoc &DL, |
| 634 |
bool isTarget = false); |
| 635 |
SDValue getShiftAmountConstant(uint64_t Val, EVT VT, const SDLoc &DL, |
| 636 |
bool LegalTypes = true); |
| 637 |
SDValue getVectorIdxConstant(uint64_t Val, const SDLoc &DL, |
| 638 |
bool isTarget = false); |
| 639 |
|
| 640 |
SDValue getTargetConstant(uint64_t Val, const SDLoc &DL, EVT VT, |
| 641 |
bool isOpaque = false) { |
| 642 |
return getConstant(Val, DL, VT, true, isOpaque); |
| 643 |
} |
| 644 |
SDValue getTargetConstant(const APInt &Val, const SDLoc &DL, EVT VT, |
| 645 |
bool isOpaque = false) { |
| 646 |
return getConstant(Val, DL, VT, true, isOpaque); |
| 647 |
} |
| 648 |
SDValue getTargetConstant(const ConstantInt &Val, const SDLoc &DL, EVT VT, |
| 649 |
bool isOpaque = false) { |
| 650 |
return getConstant(Val, DL, VT, true, isOpaque); |
| 651 |
} |
| 652 |
|
| 653 |
|
| 654 |
|
| 655 |
SDValue getBoolConstant(bool V, const SDLoc &DL, EVT VT, EVT OpVT); |
| 656 |
|
| 657 |
|
| 658 |
|
| 659 |
|
| 660 |
|
| 661 |
|
| 662 |
|
| 663 |
|
| 664 |
|
| 665 |
|
| 666 |
SDValue getConstantFP(double Val, const SDLoc &DL, EVT VT, |
| 667 |
bool isTarget = false); |
| 668 |
SDValue getConstantFP(const APFloat &Val, const SDLoc &DL, EVT VT, |
| 669 |
bool isTarget = false); |
| 670 |
SDValue getConstantFP(const ConstantFP &V, const SDLoc &DL, EVT VT, |
| 671 |
bool isTarget = false); |
| 672 |
SDValue getTargetConstantFP(double Val, const SDLoc &DL, EVT VT) { |
| 673 |
return getConstantFP(Val, DL, VT, true); |
| 674 |
} |
| 675 |
SDValue getTargetConstantFP(const APFloat &Val, const SDLoc &DL, EVT VT) { |
| 676 |
return getConstantFP(Val, DL, VT, true); |
| 677 |
} |
| 678 |
SDValue getTargetConstantFP(const ConstantFP &Val, const SDLoc &DL, EVT VT) { |
| 679 |
return getConstantFP(Val, DL, VT, true); |
| 680 |
} |
| 681 |
|
| 682 |
|
| 683 |
SDValue getGlobalAddress(const GlobalValue *GV, const SDLoc &DL, EVT VT, |
| 684 |
int64_t offset = 0, bool isTargetGA = false, |
| 685 |
unsigned TargetFlags = 0); |
| 686 |
SDValue getTargetGlobalAddress(const GlobalValue *GV, const SDLoc &DL, EVT VT, |
| 687 |
int64_t offset = 0, unsigned TargetFlags = 0) { |
| 688 |
return getGlobalAddress(GV, DL, VT, offset, true, TargetFlags); |
| 689 |
} |
| 690 |
SDValue getFrameIndex(int FI, EVT VT, bool isTarget = false); |
| 691 |
SDValue getTargetFrameIndex(int FI, EVT VT) { |
| 692 |
return getFrameIndex(FI, VT, true); |
| 693 |
} |
| 694 |
SDValue getJumpTable(int JTI, EVT VT, bool isTarget = false, |
| 695 |
unsigned TargetFlags = 0); |
| 696 |
SDValue getTargetJumpTable(int JTI, EVT VT, unsigned TargetFlags = 0) { |
| 697 |
return getJumpTable(JTI, VT, true, TargetFlags); |
| 698 |
} |
| 699 |
SDValue getConstantPool(const Constant *C, EVT VT, MaybeAlign Align = None, |
| 700 |
int Offs = 0, bool isT = false, |
| 701 |
unsigned TargetFlags = 0); |
| 702 |
SDValue getTargetConstantPool(const Constant *C, EVT VT, |
| 703 |
MaybeAlign Align = None, int Offset = 0, |
| 704 |
unsigned TargetFlags = 0) { |
| 705 |
return getConstantPool(C, VT, Align, Offset, true, TargetFlags); |
| 706 |
} |
| 707 |
SDValue getConstantPool(MachineConstantPoolValue *C, EVT VT, |
| 708 |
MaybeAlign Align = None, int Offs = 0, |
| 709 |
bool isT = false, unsigned TargetFlags = 0); |
| 710 |
SDValue getTargetConstantPool(MachineConstantPoolValue *C, EVT VT, |
| 711 |
MaybeAlign Align = None, int Offset = 0, |
| 712 |
unsigned TargetFlags = 0) { |
| 713 |
return getConstantPool(C, VT, Align, Offset, true, TargetFlags); |
| 714 |
} |
| 715 |
SDValue getTargetIndex(int Index, EVT VT, int64_t Offset = 0, |
| 716 |
unsigned TargetFlags = 0); |
| 717 |
|
| 718 |
|
| 719 |
SDValue getBasicBlock(MachineBasicBlock *MBB); |
| 720 |
SDValue getExternalSymbol(const char *Sym, EVT VT); |
| 721 |
SDValue getTargetExternalSymbol(const char *Sym, EVT VT, |
| 722 |
unsigned TargetFlags = 0); |
| 723 |
SDValue getMCSymbol(MCSymbol *Sym, EVT VT); |
| 724 |
|
| 725 |
SDValue getValueType(EVT); |
| 726 |
SDValue getRegister(unsigned Reg, EVT VT); |
| 727 |
SDValue getRegisterMask(const uint32_t *RegMask); |
| 728 |
SDValue getEHLabel(const SDLoc &dl, SDValue Root, MCSymbol *Label); |
| 729 |
SDValue getLabelNode(unsigned Opcode, const SDLoc &dl, SDValue Root, |
| 730 |
MCSymbol *Label); |
| 731 |
SDValue getBlockAddress(const BlockAddress *BA, EVT VT, int64_t Offset = 0, |
| 732 |
bool isTarget = false, unsigned TargetFlags = 0); |
| 733 |
SDValue getTargetBlockAddress(const BlockAddress *BA, EVT VT, |
| 734 |
int64_t Offset = 0, unsigned TargetFlags = 0) { |
| 735 |
return getBlockAddress(BA, VT, Offset, true, TargetFlags); |
| 736 |
} |
| 737 |
|
| 738 |
SDValue getCopyToReg(SDValue Chain, const SDLoc &dl, unsigned Reg, |
| 739 |
SDValue N) { |
| 740 |
return getNode(ISD::CopyToReg, dl, MVT::Other, Chain, |
| 741 |
getRegister(Reg, N.getValueType()), N); |
| 742 |
} |
| 743 |
|
| 744 |
|
| 745 |
|
| 746 |
|
| 747 |
SDValue getCopyToReg(SDValue Chain, const SDLoc &dl, unsigned Reg, SDValue N, |
| 748 |
SDValue Glue) { |
| 749 |
SDVTList VTs = getVTList(MVT::Other, MVT::Glue); |
| 750 |
SDValue Ops[] = { Chain, getRegister(Reg, N.getValueType()), N, Glue }; |
| 751 |
return getNode(ISD::CopyToReg, dl, VTs, |
| 752 |
makeArrayRef(Ops, Glue.getNode() ? 4 : 3)); |
| 753 |
} |
| 754 |
|
| 755 |
|
| 756 |
SDValue getCopyToReg(SDValue Chain, const SDLoc &dl, SDValue Reg, SDValue N, |
| 757 |
SDValue Glue) { |
| 758 |
SDVTList VTs = getVTList(MVT::Other, MVT::Glue); |
| 759 |
SDValue Ops[] = { Chain, Reg, N, Glue }; |
| 760 |
return getNode(ISD::CopyToReg, dl, VTs, |
| 761 |
makeArrayRef(Ops, Glue.getNode() ? 4 : 3)); |
| 762 |
} |
| 763 |
|
| 764 |
SDValue getCopyFromReg(SDValue Chain, const SDLoc &dl, unsigned Reg, EVT VT) { |
| 765 |
SDVTList VTs = getVTList(VT, MVT::Other); |
| 766 |
SDValue Ops[] = { Chain, getRegister(Reg, VT) }; |
| 767 |
return getNode(ISD::CopyFromReg, dl, VTs, Ops); |
| 768 |
} |
| 769 |
|
| 770 |
|
| 771 |
|
| 772 |
|
| 773 |
SDValue getCopyFromReg(SDValue Chain, const SDLoc &dl, unsigned Reg, EVT VT, |
| 774 |
SDValue Glue) { |
| 775 |
SDVTList VTs = getVTList(VT, MVT::Other, MVT::Glue); |
| 776 |
SDValue Ops[] = { Chain, getRegister(Reg, VT), Glue }; |
| 777 |
return getNode(ISD::CopyFromReg, dl, VTs, |
| 778 |
makeArrayRef(Ops, Glue.getNode() ? 3 : 2)); |
| 779 |
} |
| 780 |
|
| 781 |
SDValue getCondCode(ISD::CondCode Cond); |
| 782 |
|
| 783 |
|
| 784 |
|
| 785 |
|
| 786 |
SDValue getVectorShuffle(EVT VT, const SDLoc &dl, SDValue N1, SDValue N2, |
| 787 |
ArrayRef<int> Mask); |
| 788 |
|
| 789 |
|
| 790 |
|
| 791 |
|
| 792 |
|
| 793 |
SDValue getBuildVector(EVT VT, const SDLoc &DL, ArrayRef<SDValue> Ops) { |
| 794 |
|
| 795 |
return getNode(ISD::BUILD_VECTOR, DL, VT, Ops); |
| 796 |
} |
| 797 |
|
| 798 |
|
| 799 |
|
| 800 |
|
| 801 |
|
| 802 |
SDValue getBuildVector(EVT VT, const SDLoc &DL, ArrayRef<SDUse> Ops) { |
| 803 |
|
| 804 |
return getNode(ISD::BUILD_VECTOR, DL, VT, Ops); |
| 805 |
} |
| 806 |
|
| 807 |
|
| 808 |
|
| 809 |
|
| 810 |
SDValue getSplatBuildVector(EVT VT, const SDLoc &DL, SDValue Op) { |
| 811 |
|
| 812 |
if (Op.getOpcode() == ISD::UNDEF) { |
| 813 |
assert((VT.getVectorElementType() == Op.getValueType() || |
| 814 |
(VT.isInteger() && |
| 815 |
VT.getVectorElementType().bitsLE(Op.getValueType()))) && |
| 816 |
"A splatted value must have a width equal or (for integers) " |
| 817 |
"greater than the vector element type!"); |
| 818 |
return getNode(ISD::UNDEF, SDLoc(), VT); |
| 819 |
} |
| 820 |
|
| 821 |
SmallVector<SDValue, 16> Ops(VT.getVectorNumElements(), Op); |
| 822 |
return getNode(ISD::BUILD_VECTOR, DL, VT, Ops); |
| 823 |
} |
| 824 |
|
| 825 |
|
| 826 |
|
| 827 |
SDValue getSplatVector(EVT VT, const SDLoc &DL, SDValue Op) { |
| 828 |
if (Op.getOpcode() == ISD::UNDEF) { |
| 829 |
assert((VT.getVectorElementType() == Op.getValueType() || |
| 830 |
(VT.isInteger() && |
| 831 |
VT.getVectorElementType().bitsLE(Op.getValueType()))) && |
| 832 |
"A splatted value must have a width equal or (for integers) " |
| 833 |
"greater than the vector element type!"); |
| 834 |
return getNode(ISD::UNDEF, SDLoc(), VT); |
| 835 |
} |
| 836 |
return getNode(ISD::SPLAT_VECTOR, DL, VT, Op); |
| 837 |
} |
| 838 |
|
| 839 |
|
| 840 |
|
| 841 |
SDValue getStepVector(const SDLoc &DL, EVT ResVT, APInt StepVal); |
| 842 |
|
| 843 |
|
| 844 |
|
| 845 |
SDValue getStepVector(const SDLoc &DL, EVT ResVT); |
| 846 |
|
| 847 |
|
| 848 |
|
| 849 |
|
| 850 |
|
| 851 |
SDValue getCommutedVectorShuffle(const ShuffleVectorSDNode &SV); |
| 852 |
|
| 853 |
|
| 854 |
|
| 855 |
SDValue getFPExtendOrRound(SDValue Op, const SDLoc &DL, EVT VT); |
| 856 |
|
| 857 |
|
| 858 |
|
| 859 |
std::pair<SDValue, SDValue> |
| 860 |
getStrictFPExtendOrRound(SDValue Op, SDValue Chain, const SDLoc &DL, EVT VT); |
| 861 |
|
| 862 |
|
| 863 |
|
| 864 |
SDValue getAnyExtOrTrunc(SDValue Op, const SDLoc &DL, EVT VT); |
| 865 |
|
| 866 |
|
| 867 |
|
| 868 |
SDValue getSExtOrTrunc(SDValue Op, const SDLoc &DL, EVT VT); |
| 869 |
|
| 870 |
|
| 871 |
|
| 872 |
SDValue getZExtOrTrunc(SDValue Op, const SDLoc &DL, EVT VT); |
| 873 |
|
| 874 |
|
| 875 |
|
| 876 |
SDValue getZeroExtendInReg(SDValue Op, const SDLoc &DL, EVT VT); |
| 877 |
|
| 878 |
|
| 879 |
|
| 880 |
|
| 881 |
SDValue getPtrExtOrTrunc(SDValue Op, const SDLoc &DL, EVT VT); |
| 882 |
|
| 883 |
|
| 884 |
|
| 885 |
|
| 886 |
SDValue getPtrExtendInReg(SDValue Op, const SDLoc &DL, EVT VT); |
| 887 |
|
| 888 |
|
| 889 |
|
| 890 |
|
| 891 |
SDValue getBoolExtOrTrunc(SDValue Op, const SDLoc &SL, EVT VT, EVT OpVT); |
| 892 |
|
| 893 |
|
| 894 |
SDValue getNOT(const SDLoc &DL, SDValue Val, EVT VT); |
| 895 |
|
| 896 |
|
| 897 |
SDValue getLogicalNOT(const SDLoc &DL, SDValue Val, EVT VT); |
| 898 |
|
| 899 |
|
| 900 |
|
| 901 |
SDValue getMemBasePlusOffset(SDValue Base, TypeSize Offset, const SDLoc &DL, |
| 902 |
const SDNodeFlags Flags = SDNodeFlags()); |
| 903 |
SDValue getMemBasePlusOffset(SDValue Base, SDValue Offset, const SDLoc &DL, |
| 904 |
const SDNodeFlags Flags = SDNodeFlags()); |
| 905 |
|
| 906 |
|
| 907 |
|
| 908 |
|
| 909 |
SDValue getObjectPtrOffset(const SDLoc &SL, SDValue Ptr, TypeSize Offset) { |
| 910 |
SDNodeFlags Flags; |
| 911 |
Flags.setNoUnsignedWrap(true); |
| 912 |
return getMemBasePlusOffset(Ptr, Offset, SL, Flags); |
| 913 |
} |
| 914 |
|
| 915 |
SDValue getObjectPtrOffset(const SDLoc &SL, SDValue Ptr, SDValue Offset) { |
| 916 |
|
| 917 |
|
| 918 |
SDNodeFlags Flags; |
| 919 |
Flags.setNoUnsignedWrap(true); |
| 920 |
return getMemBasePlusOffset(Ptr, Offset, SL, Flags); |
| 921 |
} |
| 922 |
|
| 923 |
|
| 924 |
|
| 925 |
|
| 926 |
SDValue getCALLSEQ_START(SDValue Chain, uint64_t InSize, uint64_t OutSize, |
| 927 |
const SDLoc &DL) { |
| 928 |
SDVTList VTs = getVTList(MVT::Other, MVT::Glue); |
| 929 |
SDValue Ops[] = { Chain, |
| 930 |
getIntPtrConstant(InSize, DL, true), |
| 931 |
getIntPtrConstant(OutSize, DL, true) }; |
| 932 |
return getNode(ISD::CALLSEQ_START, DL, VTs, Ops); |
| 933 |
} |
| 934 |
|
| 935 |
|
| 936 |
|
| 937 |
|
| 938 |
SDValue getCALLSEQ_END(SDValue Chain, SDValue Op1, SDValue Op2, |
| 939 |
SDValue InGlue, const SDLoc &DL) { |
| 940 |
SDVTList NodeTys = getVTList(MVT::Other, MVT::Glue); |
| 941 |
SmallVector<SDValue, 4> Ops; |
| 942 |
Ops.push_back(Chain); |
| 943 |
Ops.push_back(Op1); |
| 944 |
Ops.push_back(Op2); |
| 945 |
if (InGlue.getNode()) |
| 946 |
Ops.push_back(InGlue); |
| 947 |
return getNode(ISD::CALLSEQ_END, DL, NodeTys, Ops); |
| 948 |
} |
| 949 |
|
| 950 |
|
| 951 |
bool isUndef(unsigned Opcode, ArrayRef<SDValue> Ops); |
| 952 |
|
| 953 |
|
| 954 |
SDValue getUNDEF(EVT VT) { |
| 955 |
return getNode(ISD::UNDEF, SDLoc(), VT); |
| 956 |
} |
| 957 |
|
| 958 |
|
| 959 |
SDValue getVScale(const SDLoc &DL, EVT VT, APInt MulImm) { |
| 960 |
assert(MulImm.getMinSignedBits() <= VT.getSizeInBits() && |
| 961 |
"Immediate does not fit VT"); |
| 962 |
return getNode(ISD::VSCALE, DL, VT, |
| 963 |
getConstant(MulImm.sextOrTrunc(VT.getSizeInBits()), DL, VT)); |
| 964 |
} |
| 965 |
|
| 966 |
|
| 967 |
SDValue getGLOBAL_OFFSET_TABLE(EVT VT) { |
| 968 |
return getNode(ISD::GLOBAL_OFFSET_TABLE, SDLoc(), VT); |
| 969 |
} |
| 970 |
|
| 971 |
|
| 972 |
|
| 973 |
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, |
| 974 |
ArrayRef<SDUse> Ops); |
| 975 |
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, |
| 976 |
ArrayRef<SDValue> Ops, const SDNodeFlags Flags); |
| 977 |
SDValue getNode(unsigned Opcode, const SDLoc &DL, ArrayRef<EVT> ResultTys, |
| 978 |
ArrayRef<SDValue> Ops); |
| 979 |
SDValue getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTList, |
| 980 |
ArrayRef<SDValue> Ops, const SDNodeFlags Flags); |
| 981 |
|
| 982 |
|
| 983 |
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, |
| 984 |
ArrayRef<SDValue> Ops); |
| 985 |
SDValue getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTList, |
| 986 |
ArrayRef<SDValue> Ops); |
| 987 |
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue Operand); |
| 988 |
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue N1, |
| 989 |
SDValue N2); |
| 990 |
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue N1, |
| 991 |
SDValue N2, SDValue N3); |
| 992 |
|
| 993 |
|
| 994 |
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT); |
| 995 |
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue Operand, |
| 996 |
const SDNodeFlags Flags); |
| 997 |
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue N1, |
| 998 |
SDValue N2, const SDNodeFlags Flags); |
| 999 |
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue N1, |
| 1000 |
SDValue N2, SDValue N3, const SDNodeFlags Flags); |
| 1001 |
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue N1, |
| 1002 |
SDValue N2, SDValue N3, SDValue N4); |
| 1003 |
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue N1, |
| 1004 |
SDValue N2, SDValue N3, SDValue N4, SDValue N5); |
| 1005 |
|
| 1006 |
|
| 1007 |
|
| 1008 |
SDValue getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTList); |
| 1009 |
SDValue getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTList, SDValue N); |
| 1010 |
SDValue getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTList, SDValue N1, |
| 1011 |
SDValue N2); |
| 1012 |
SDValue getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTList, SDValue N1, |
| 1013 |
SDValue N2, SDValue N3); |
| 1014 |
SDValue getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTList, SDValue N1, |
| 1015 |
SDValue N2, SDValue N3, SDValue N4); |
| 1016 |
SDValue getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTList, SDValue N1, |
| 1017 |
SDValue N2, SDValue N3, SDValue N4, SDValue N5); |
| 1018 |
|
| 1019 |
|
| 1020 |
|
| 1021 |
|
| 1022 |
SDValue getStackArgumentTokenFactor(SDValue Chain); |
| 1023 |
|
| 1024 |
SDValue getMemcpy(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Src, |
| 1025 |
SDValue Size, Align Alignment, bool isVol, |
| 1026 |
bool AlwaysInline, bool isTailCall, |
| 1027 |
MachinePointerInfo DstPtrInfo, |
| 1028 |
MachinePointerInfo SrcPtrInfo, |
| 1029 |
const AAMDNodes &AAInfo = AAMDNodes()); |
| 1030 |
|
| 1031 |
SDValue getMemmove(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Src, |
| 1032 |
SDValue Size, Align Alignment, bool isVol, bool isTailCall, |
| 1033 |
MachinePointerInfo DstPtrInfo, |
| 1034 |
MachinePointerInfo SrcPtrInfo, |
| 1035 |
const AAMDNodes &AAInfo = AAMDNodes()); |
| 1036 |
|
| 1037 |
SDValue getMemset(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Src, |
| 1038 |
SDValue Size, Align Alignment, bool isVol, bool isTailCall, |
| 1039 |
MachinePointerInfo DstPtrInfo, |
| 1040 |
const AAMDNodes &AAInfo = AAMDNodes()); |
| 1041 |
|
| 1042 |
SDValue getAtomicMemcpy(SDValue Chain, const SDLoc &dl, SDValue Dst, |
| 1043 |
unsigned DstAlign, SDValue Src, unsigned SrcAlign, |
| 1044 |
SDValue Size, Type *SizeTy, unsigned ElemSz, |
| 1045 |
bool isTailCall, MachinePointerInfo DstPtrInfo, |
| 1046 |
MachinePointerInfo SrcPtrInfo); |
| 1047 |
|
| 1048 |
SDValue getAtomicMemmove(SDValue Chain, const SDLoc &dl, SDValue Dst, |
| 1049 |
unsigned DstAlign, SDValue Src, unsigned SrcAlign, |
| 1050 |
SDValue Size, Type *SizeTy, unsigned ElemSz, |
| 1051 |
bool isTailCall, MachinePointerInfo DstPtrInfo, |
| 1052 |
MachinePointerInfo SrcPtrInfo); |
| 1053 |
|
| 1054 |
SDValue getAtomicMemset(SDValue Chain, const SDLoc &dl, SDValue Dst, |
| 1055 |
unsigned DstAlign, SDValue Value, SDValue Size, |
| 1056 |
Type *SizeTy, unsigned ElemSz, bool isTailCall, |
| 1057 |
MachinePointerInfo DstPtrInfo); |
| 1058 |
|
| 1059 |
|
| 1060 |
|
| 1061 |
SDValue getSetCC(const SDLoc &DL, EVT VT, SDValue LHS, SDValue RHS, |
| 1062 |
ISD::CondCode Cond, SDValue Chain = SDValue(), |
| 1063 |
bool IsSignaling = false) { |
| 1064 |
assert(LHS.getValueType().isVector() == RHS.getValueType().isVector() && |
| 1065 |
"Cannot compare scalars to vectors"); |
| 1066 |
assert(LHS.getValueType().isVector() == VT.isVector() && |
| 1067 |
"Cannot compare scalars to vectors"); |
| 1068 |
assert(Cond != ISD::SETCC_INVALID && |
| 1069 |
"Cannot create a setCC of an invalid node."); |
| 1070 |
if (Chain) |
| 1071 |
return getNode(IsSignaling ? ISD::STRICT_FSETCCS : ISD::STRICT_FSETCC, DL, |
| 1072 |
{VT, MVT::Other}, {Chain, LHS, RHS, getCondCode(Cond)}); |
| 1073 |
return getNode(ISD::SETCC, DL, VT, LHS, RHS, getCondCode(Cond)); |
| 1074 |
} |
| 1075 |
|
| 1076 |
|
| 1077 |
|
| 1078 |
SDValue getSelect(const SDLoc &DL, EVT VT, SDValue Cond, SDValue LHS, |
| 1079 |
SDValue RHS) { |
| 1080 |
assert(LHS.getValueType() == RHS.getValueType() && |
| 1081 |
"Cannot use select on differing types"); |
| 1082 |
assert(VT.isVector() == LHS.getValueType().isVector() && |
| 1083 |
"Cannot mix vectors and scalars"); |
| 1084 |
auto Opcode = Cond.getValueType().isVector() ? ISD::VSELECT : ISD::SELECT; |
| 1085 |
return getNode(Opcode, DL, VT, Cond, LHS, RHS); |
| 1086 |
} |
| 1087 |
|
| 1088 |
|
| 1089 |
|
| 1090 |
SDValue getSelectCC(const SDLoc &DL, SDValue LHS, SDValue RHS, SDValue True, |
| 1091 |
SDValue False, ISD::CondCode Cond) { |
| 1092 |
return getNode(ISD::SELECT_CC, DL, True.getValueType(), LHS, RHS, True, |
| 1093 |
False, getCondCode(Cond)); |
| 1094 |
} |
| 1095 |
|
| 1096 |
|
| 1097 |
SDValue simplifySelect(SDValue Cond, SDValue TVal, SDValue FVal); |
| 1098 |
|
| 1099 |
|
| 1100 |
SDValue simplifyShift(SDValue X, SDValue Y); |
| 1101 |
|
| 1102 |
|
| 1103 |
|
| 1104 |
SDValue simplifyFPBinop(unsigned Opcode, SDValue X, SDValue Y, |
| 1105 |
SDNodeFlags Flags); |
| 1106 |
|
| 1107 |
|
| 1108 |
|
| 1109 |
SDValue getVAArg(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr, |
| 1110 |
SDValue SV, unsigned Align); |
| 1111 |
|
| 1112 |
|
| 1113 |
|
| 1114 |
|
| 1115 |
|
| 1116 |
SDValue getAtomicCmpSwap(unsigned Opcode, const SDLoc &dl, EVT MemVT, |
| 1117 |
SDVTList VTs, SDValue Chain, SDValue Ptr, |
| 1118 |
SDValue Cmp, SDValue Swp, MachineMemOperand *MMO); |
| 1119 |
|
| 1120 |
|
| 1121 |
|
| 1122 |
SDValue getAtomic(unsigned Opcode, const SDLoc &dl, EVT MemVT, SDValue Chain, |
| 1123 |
SDValue Ptr, SDValue Val, MachineMemOperand *MMO); |
| 1124 |
|
| 1125 |
|
| 1126 |
|
| 1127 |
SDValue getAtomic(unsigned Opcode, const SDLoc &dl, EVT MemVT, EVT VT, |
| 1128 |
SDValue Chain, SDValue Ptr, MachineMemOperand *MMO); |
| 1129 |
|
| 1130 |
|
| 1131 |
|
| 1132 |
SDValue getAtomic(unsigned Opcode, const SDLoc &dl, EVT MemVT, |
| 1133 |
SDVTList VTList, ArrayRef<SDValue> Ops, |
| 1134 |
MachineMemOperand *MMO); |
| 1135 |
|
| 1136 |
|
| 1137 |
|
| 1138 |
|
| 1139 |
|
| 1140 |
SDValue getMemIntrinsicNode( |
| 1141 |
unsigned Opcode, const SDLoc &dl, SDVTList VTList, ArrayRef<SDValue> Ops, |
| 1142 |
EVT MemVT, MachinePointerInfo PtrInfo, Align Alignment, |
| 1143 |
MachineMemOperand::Flags Flags = MachineMemOperand::MOLoad | |
| 1144 |
MachineMemOperand::MOStore, |
| 1145 |
uint64_t Size = 0, const AAMDNodes &AAInfo = AAMDNodes()); |
| 1146 |
|
| 1147 |
inline SDValue getMemIntrinsicNode( |
| 1148 |
unsigned Opcode, const SDLoc &dl, SDVTList VTList, ArrayRef<SDValue> Ops, |
| 1149 |
EVT MemVT, MachinePointerInfo PtrInfo, MaybeAlign Alignment = None, |
| 1150 |
MachineMemOperand::Flags Flags = MachineMemOperand::MOLoad | |
| 1151 |
MachineMemOperand::MOStore, |
| 1152 |
uint64_t Size = 0, const AAMDNodes &AAInfo = AAMDNodes()) { |
| 1153 |
|
| 1154 |
return getMemIntrinsicNode(Opcode, dl, VTList, Ops, MemVT, PtrInfo, |
| 1155 |
Alignment.getValueOr(getEVTAlign(MemVT)), Flags, |
| 1156 |
Size, AAInfo); |
| 1157 |
} |
| 1158 |
|
| 1159 |
SDValue getMemIntrinsicNode(unsigned Opcode, const SDLoc &dl, SDVTList VTList, |
| 1160 |
ArrayRef<SDValue> Ops, EVT MemVT, |
| 1161 |
MachineMemOperand *MMO); |
| 1162 |
|
| 1163 |
|
| 1164 |
|
| 1165 |
|
| 1166 |
SDValue getLifetimeNode(bool IsStart, const SDLoc &dl, SDValue Chain, |
| 1167 |
int FrameIndex, int64_t Size, int64_t Offset = -1); |
| 1168 |
|
| 1169 |
|
| 1170 |
|
| 1171 |
|
| 1172 |
SDValue getPseudoProbeNode(const SDLoc &Dl, SDValue Chain, uint64_t Guid, |
| 1173 |
uint64_t Index, uint32_t Attr); |
| 1174 |
|
| 1175 |
|
| 1176 |
SDValue getMergeValues(ArrayRef<SDValue> Ops, const SDLoc &dl); |
| 1177 |
|
| 1178 |
|
| 1179 |
|
| 1180 |
|
| 1181 |
|
| 1182 |
|
| 1183 |
SDValue getLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr, |
| 1184 |
MachinePointerInfo PtrInfo, |
| 1185 |
MaybeAlign Alignment = MaybeAlign(), |
| 1186 |
MachineMemOperand::Flags MMOFlags = MachineMemOperand::MONone, |
| 1187 |
const AAMDNodes &AAInfo = AAMDNodes(), |
| 1188 |
const MDNode *Ranges = nullptr); |
| 1189 |
|
| 1190 |
inline SDValue |
| 1191 |
getLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr, |
| 1192 |
MachinePointerInfo PtrInfo, unsigned Alignment, |
| 1193 |
MachineMemOperand::Flags MMOFlags = MachineMemOperand::MONone, |
| 1194 |
const AAMDNodes &AAInfo = AAMDNodes(), |
| 1195 |
const MDNode *Ranges = nullptr) { |
| 1196 |
return getLoad(VT, dl, Chain, Ptr, PtrInfo, MaybeAlign(Alignment), MMOFlags, |
| 1197 |
AAInfo, Ranges); |
| 1198 |
} |
| 1199 |
SDValue getLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr, |
| 1200 |
MachineMemOperand *MMO); |
| 1201 |
SDValue |
| 1202 |
getExtLoad(ISD::LoadExtType ExtType, const SDLoc &dl, EVT VT, SDValue Chain, |
| 1203 |
SDValue Ptr, MachinePointerInfo PtrInfo, EVT MemVT, |
| 1204 |
MaybeAlign Alignment = MaybeAlign(), |
| 1205 |
MachineMemOperand::Flags MMOFlags = MachineMemOperand::MONone, |
| 1206 |
const AAMDNodes &AAInfo = AAMDNodes()); |
| 1207 |
|
| 1208 |
inline SDValue |
| 1209 |
getExtLoad(ISD::LoadExtType ExtType, const SDLoc &dl, EVT VT, SDValue Chain, |
| 1210 |
SDValue Ptr, MachinePointerInfo PtrInfo, EVT MemVT, |
| 1211 |
unsigned Alignment, |
| 1212 |
MachineMemOperand::Flags MMOFlags = MachineMemOperand::MONone, |
| 1213 |
const AAMDNodes &AAInfo = AAMDNodes()) { |
| 1214 |
return getExtLoad(ExtType, dl, VT, Chain, Ptr, PtrInfo, MemVT, |
| 1215 |
MaybeAlign(Alignment), MMOFlags, AAInfo); |
| 1216 |
} |
| 1217 |
SDValue getExtLoad(ISD::LoadExtType ExtType, const SDLoc &dl, EVT VT, |
| 1218 |
SDValue Chain, SDValue Ptr, EVT MemVT, |
| 1219 |
MachineMemOperand *MMO); |
| 1220 |
SDValue getIndexedLoad(SDValue OrigLoad, const SDLoc &dl, SDValue Base, |
| 1221 |
SDValue Offset, ISD::MemIndexedMode AM); |
| 1222 |
SDValue getLoad(ISD::MemIndexedMode AM, ISD::LoadExtType ExtType, EVT VT, |
| 1223 |
const SDLoc &dl, SDValue Chain, SDValue Ptr, SDValue Offset, |
| 1224 |
MachinePointerInfo PtrInfo, EVT MemVT, Align Alignment, |
| 1225 |
MachineMemOperand::Flags MMOFlags = MachineMemOperand::MONone, |
| 1226 |
const AAMDNodes &AAInfo = AAMDNodes(), |
| 1227 |
const MDNode *Ranges = nullptr); |
| 1228 |
inline SDValue getLoad( |
| 1229 |
ISD::MemIndexedMode AM, ISD::LoadExtType ExtType, EVT VT, const SDLoc &dl, |
| 1230 |
SDValue Chain, SDValue Ptr, SDValue Offset, MachinePointerInfo PtrInfo, |
| 1231 |
EVT MemVT, MaybeAlign Alignment = MaybeAlign(), |
| 1232 |
MachineMemOperand::Flags MMOFlags = MachineMemOperand::MONone, |
| 1233 |
const AAMDNodes &AAInfo = AAMDNodes(), const MDNode *Ranges = nullptr) { |
| 1234 |
|
| 1235 |
return getLoad(AM, ExtType, VT, dl, Chain, Ptr, Offset, PtrInfo, MemVT, |
| 1236 |
Alignment.getValueOr(getEVTAlign(MemVT)), MMOFlags, AAInfo, |
| 1237 |
Ranges); |
| 1238 |
} |
| 1239 |
|
| 1240 |
inline SDValue |
| 1241 |
getLoad(ISD::MemIndexedMode AM, ISD::LoadExtType ExtType, EVT VT, |
| 1242 |
const SDLoc &dl, SDValue Chain, SDValue Ptr, SDValue Offset, |
| 1243 |
MachinePointerInfo PtrInfo, EVT MemVT, unsigned Alignment, |
| 1244 |
MachineMemOperand::Flags MMOFlags = MachineMemOperand::MONone, |
| 1245 |
const AAMDNodes &AAInfo = AAMDNodes(), |
| 1246 |
const MDNode *Ranges = nullptr) { |
| 1247 |
return getLoad(AM, ExtType, VT, dl, Chain, Ptr, Offset, PtrInfo, MemVT, |
| 1248 |
MaybeAlign(Alignment), MMOFlags, AAInfo, Ranges); |
| 1249 |
} |
| 1250 |
SDValue getLoad(ISD::MemIndexedMode AM, ISD::LoadExtType ExtType, EVT VT, |
| 1251 |
const SDLoc &dl, SDValue Chain, SDValue Ptr, SDValue Offset, |
| 1252 |
EVT MemVT, MachineMemOperand *MMO); |
| 1253 |
|
| 1254 |
|
| 1255 |
|
| 1256 |
|
| 1257 |
|
| 1258 |
|
| 1259 |
SDValue |
| 1260 |
getStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, |
| 1261 |
MachinePointerInfo PtrInfo, Align Alignment, |
| 1262 |
MachineMemOperand::Flags MMOFlags = MachineMemOperand::MONone, |
| 1263 |
const AAMDNodes &AAInfo = AAMDNodes()); |
| 1264 |
inline SDValue |
| 1265 |
getStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, |
| 1266 |
MachinePointerInfo PtrInfo, MaybeAlign Alignment = MaybeAlign(), |
| 1267 |
MachineMemOperand::Flags MMOFlags = MachineMemOperand::MONone, |
| 1268 |
const AAMDNodes &AAInfo = AAMDNodes()) { |
| 1269 |
return getStore(Chain, dl, Val, Ptr, PtrInfo, |
| 1270 |
Alignment.getValueOr(getEVTAlign(Val.getValueType())), |
| 1271 |
MMOFlags, AAInfo); |
| 1272 |
} |
| 1273 |
|
| 1274 |
inline SDValue |
| 1275 |
getStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, |
| 1276 |
MachinePointerInfo PtrInfo, unsigned Alignment, |
| 1277 |
MachineMemOperand::Flags MMOFlags = MachineMemOperand::MONone, |
| 1278 |
const AAMDNodes &AAInfo = AAMDNodes()) { |
| 1279 |
return getStore(Chain, dl, Val, Ptr, PtrInfo, MaybeAlign(Alignment), |
| 1280 |
MMOFlags, AAInfo); |
| 1281 |
} |
| 1282 |
SDValue getStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, |
| 1283 |
MachineMemOperand *MMO); |
| 1284 |
SDValue |
| 1285 |
getTruncStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, |
| 1286 |
MachinePointerInfo PtrInfo, EVT SVT, Align Alignment, |
| 1287 |
MachineMemOperand::Flags MMOFlags = MachineMemOperand::MONone, |
| 1288 |
const AAMDNodes &AAInfo = AAMDNodes()); |
| 1289 |
inline SDValue |
| 1290 |
getTruncStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, |
| 1291 |
MachinePointerInfo PtrInfo, EVT SVT, |
| 1292 |
MaybeAlign Alignment = MaybeAlign(), |
| 1293 |
MachineMemOperand::Flags MMOFlags = MachineMemOperand::MONone, |
| 1294 |
const AAMDNodes &AAInfo = AAMDNodes()) { |
| 1295 |
return getTruncStore(Chain, dl, Val, Ptr, PtrInfo, SVT, |
| 1296 |
Alignment.getValueOr(getEVTAlign(SVT)), MMOFlags, |
| 1297 |
AAInfo); |
| 1298 |
} |
| 1299 |
|
| 1300 |
inline SDValue |
| 1301 |
getTruncStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, |
| 1302 |
MachinePointerInfo PtrInfo, EVT SVT, unsigned Alignment, |
| 1303 |
MachineMemOperand::Flags MMOFlags = MachineMemOperand::MONone, |
| 1304 |
const AAMDNodes &AAInfo = AAMDNodes()) { |
| 1305 |
return getTruncStore(Chain, dl, Val, Ptr, PtrInfo, SVT, |
| 1306 |
MaybeAlign(Alignment), MMOFlags, AAInfo); |
| 1307 |
} |
| 1308 |
SDValue getTruncStore(SDValue Chain, const SDLoc &dl, SDValue Val, |
| 1309 |
SDValue Ptr, EVT SVT, MachineMemOperand *MMO); |
| 1310 |
SDValue getIndexedStore(SDValue OrigStore, const SDLoc &dl, SDValue Base, |
| 1311 |
SDValue Offset, ISD::MemIndexedMode AM); |
| 1312 |
|
| 1313 |
SDValue getLoadVP(ISD::MemIndexedMode AM, ISD::LoadExtType ExtType, EVT VT, |
| 1314 |
const SDLoc &dl, SDValue Chain, SDValue Ptr, SDValue Offset, |
| 1315 |
SDValue Mask, SDValue EVL, MachinePointerInfo PtrInfo, |
| 1316 |
EVT MemVT, Align Alignment, |
| 1317 |
MachineMemOperand::Flags MMOFlags, const AAMDNodes &AAInfo, |
| 1318 |
const MDNode *Ranges = nullptr, bool IsExpanding = false); |
| 1319 |
inline SDValue |
| 1320 |
getLoadVP(ISD::MemIndexedMode AM, ISD::LoadExtType ExtType, EVT VT, |
| 1321 |
const SDLoc &dl, SDValue Chain, SDValue Ptr, SDValue Offset, |
| 1322 |
SDValue Mask, SDValue EVL, MachinePointerInfo PtrInfo, EVT MemVT, |
| 1323 |
MaybeAlign Alignment = MaybeAlign(), |
| 1324 |
MachineMemOperand::Flags MMOFlags = MachineMemOperand::MONone, |
| 1325 |
const AAMDNodes &AAInfo = AAMDNodes(), |
| 1326 |
const MDNode *Ranges = nullptr, bool IsExpanding = false) { |
| 1327 |
|
| 1328 |
return getLoadVP(AM, ExtType, VT, dl, Chain, Ptr, Offset, Mask, EVL, |
| 1329 |
PtrInfo, MemVT, Alignment.getValueOr(getEVTAlign(MemVT)), |
| 1330 |
MMOFlags, AAInfo, Ranges, IsExpanding); |
| 1331 |
} |
| 1332 |
SDValue getLoadVP(ISD::MemIndexedMode AM, ISD::LoadExtType ExtType, EVT VT, |
| 1333 |
const SDLoc &dl, SDValue Chain, SDValue Ptr, SDValue Offset, |
| 1334 |
SDValue Mask, SDValue EVL, EVT MemVT, |
| 1335 |
MachineMemOperand *MMO, bool IsExpanding = false); |
| 1336 |
SDValue getLoadVP(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr, |
| 1337 |
SDValue Mask, SDValue EVL, MachinePointerInfo PtrInfo, |
| 1338 |
MaybeAlign Alignment, MachineMemOperand::Flags MMOFlags, |
| 1339 |
const AAMDNodes &AAInfo, const MDNode *Ranges = nullptr, |
| 1340 |
bool IsExpanding = false); |
| 1341 |
SDValue getLoadVP(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr, |
| 1342 |
SDValue Mask, SDValue EVL, MachineMemOperand *MMO, |
| 1343 |
bool IsExpanding = false); |
| 1344 |
SDValue getExtLoadVP(ISD::LoadExtType ExtType, const SDLoc &dl, EVT VT, |
| 1345 |
SDValue Chain, SDValue Ptr, SDValue Mask, SDValue EVL, |
| 1346 |
MachinePointerInfo PtrInfo, EVT MemVT, |
| 1347 |
MaybeAlign Alignment, MachineMemOperand::Flags MMOFlags, |
| 1348 |
const AAMDNodes &AAInfo, bool IsExpanding = false); |
| 1349 |
SDValue getExtLoadVP(ISD::LoadExtType ExtType, const SDLoc &dl, EVT VT, |
| 1350 |
SDValue Chain, SDValue Ptr, SDValue Mask, SDValue EVL, |
| 1351 |
EVT MemVT, MachineMemOperand *MMO, |
| 1352 |
bool IsExpanding = false); |
| 1353 |
SDValue getIndexedLoadVP(SDValue OrigLoad, const SDLoc &dl, SDValue Base, |
| 1354 |
SDValue Offset, ISD::MemIndexedMode AM); |
| 1355 |
SDValue getStoreVP(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, |
| 1356 |
SDValue Offset, SDValue Mask, SDValue EVL, EVT MemVT, |
| 1357 |
MachineMemOperand *MMO, ISD::MemIndexedMode AM, |
| 1358 |
bool IsTruncating = false, bool IsCompressing = false); |
| 1359 |
SDValue getTruncStoreVP(SDValue Chain, const SDLoc &dl, SDValue Val, |
| 1360 |
SDValue Ptr, SDValue Mask, SDValue EVL, |
| 1361 |
MachinePointerInfo PtrInfo, EVT SVT, Align Alignment, |
| 1362 |
MachineMemOperand::Flags MMOFlags, |
| 1363 |
const AAMDNodes &AAInfo, bool IsCompressing = false); |
| 1364 |
SDValue getTruncStoreVP(SDValue Chain, const SDLoc &dl, SDValue Val, |
| 1365 |
SDValue Ptr, SDValue Mask, SDValue EVL, EVT SVT, |
| 1366 |
MachineMemOperand *MMO, bool IsCompressing = false); |
| 1367 |
SDValue getIndexedStoreVP(SDValue OrigStore, const SDLoc &dl, SDValue Base, |
| 1368 |
SDValue Offset, ISD::MemIndexedMode AM); |
| 1369 |
|
| 1370 |
SDValue getGatherVP(SDVTList VTs, EVT VT, const SDLoc &dl, |
| 1371 |
ArrayRef<SDValue> Ops, MachineMemOperand *MMO, |
| 1372 |
ISD::MemIndexType IndexType); |
| 1373 |
SDValue getScatterVP(SDVTList VTs, EVT VT, const SDLoc &dl, |
| 1374 |
ArrayRef<SDValue> Ops, MachineMemOperand *MMO, |
| 1375 |
ISD::MemIndexType IndexType); |
| 1376 |
|
| 1377 |
SDValue getMaskedLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Base, |
| 1378 |
SDValue Offset, SDValue Mask, SDValue Src0, EVT MemVT, |
| 1379 |
MachineMemOperand *MMO, ISD::MemIndexedMode AM, |
| 1380 |
ISD::LoadExtType, bool IsExpanding = false); |
| 1381 |
SDValue getIndexedMaskedLoad(SDValue OrigLoad, const SDLoc &dl, SDValue Base, |
| 1382 |
SDValue Offset, ISD::MemIndexedMode AM); |
| 1383 |
SDValue getMaskedStore(SDValue Chain, const SDLoc &dl, SDValue Val, |
| 1384 |
SDValue Base, SDValue Offset, SDValue Mask, EVT MemVT, |
| 1385 |
MachineMemOperand *MMO, ISD::MemIndexedMode AM, |
| 1386 |
bool IsTruncating = false, bool IsCompressing = false); |
| 1387 |
SDValue getIndexedMaskedStore(SDValue OrigStore, const SDLoc &dl, |
| 1388 |
SDValue Base, SDValue Offset, |
| 1389 |
ISD::MemIndexedMode AM); |
| 1390 |
SDValue getMaskedGather(SDVTList VTs, EVT MemVT, const SDLoc &dl, |
| 1391 |
ArrayRef<SDValue> Ops, MachineMemOperand *MMO, |
| 1392 |
ISD::MemIndexType IndexType, ISD::LoadExtType ExtTy); |
| 1393 |
SDValue getMaskedScatter(SDVTList VTs, EVT MemVT, const SDLoc &dl, |
| 1394 |
ArrayRef<SDValue> Ops, MachineMemOperand *MMO, |
| 1395 |
ISD::MemIndexType IndexType, |
| 1396 |
bool IsTruncating = false); |
| 1397 |
|
| 1398 |
|
| 1399 |
SDValue getSrcValue(const Value *v); |
| 1400 |
|
| 1401 |
|
| 1402 |
SDValue getMDNode(const MDNode *MD); |
| 1403 |
|
| 1404 |
|
| 1405 |
|
| 1406 |
SDValue getBitcast(EVT VT, SDValue V); |
| 1407 |
|
| 1408 |
|
| 1409 |
SDValue getAddrSpaceCast(const SDLoc &dl, EVT VT, SDValue Ptr, unsigned SrcAS, |
| 1410 |
unsigned DestAS); |
| 1411 |
|
| 1412 |
|
| 1413 |
SDValue getFreeze(SDValue V); |
| 1414 |
|
| 1415 |
|
| 1416 |
SDValue getAssertAlign(const SDLoc &DL, SDValue V, Align A); |
| 1417 |
|
| 1418 |
|
| 1419 |
|
| 1420 |
SDValue getShiftAmountOperand(EVT LHSTy, SDValue Op); |
| 1421 |
|
| 1422 |
|
| 1423 |
SDValue expandVAArg(SDNode *Node); |
| 1424 |
|
| 1425 |
|
| 1426 |
SDValue expandVACopy(SDNode *Node); |
| 1427 |
|
| 1428 |
|
| 1429 |
|
| 1430 |
|
| 1431 |
|
| 1432 |
SDValue getSymbolFunctionGlobalAddress(SDValue Op, |
| 1433 |
Function **TargetFunction = nullptr); |
| 1434 |
|
| 1435 |
|
| 1436 |
|
| 1437 |
|
| 1438 |
|
| 1439 |
|
| 1440 |
|
| 1441 |
SDNode *UpdateNodeOperands(SDNode *N, SDValue Op); |
| 1442 |
SDNode *UpdateNodeOperands(SDNode *N, SDValue Op1, SDValue Op2); |
| 1443 |
SDNode *UpdateNodeOperands(SDNode *N, SDValue Op1, SDValue Op2, |
| 1444 |
SDValue Op3); |
| 1445 |
SDNode *UpdateNodeOperands(SDNode *N, SDValue Op1, SDValue Op2, |
| 1446 |
SDValue Op3, SDValue Op4); |
| 1447 |
SDNode *UpdateNodeOperands(SDNode *N, SDValue Op1, SDValue Op2, |
| 1448 |
SDValue Op3, SDValue Op4, SDValue Op5); |
| 1449 |
SDNode *UpdateNodeOperands(SDNode *N, ArrayRef<SDValue> Ops); |
| 1450 |
|
| 1451 |
|
| 1452 |
|
| 1453 |
|
| 1454 |
SDValue getTokenFactor(const SDLoc &DL, SmallVectorImpl<SDValue> &Vals); |
| 1455 |
|
| 1456 |
|
| 1457 |
|
| 1458 |
void setNodeMemRefs(MachineSDNode *N, |
| 1459 |
ArrayRef<MachineMemOperand *> NewMemRefs); |
| 1460 |
|
| 1461 |
|
| 1462 |
bool calculateDivergence(SDNode *N); |
| 1463 |
|
| 1464 |
|
| 1465 |
void updateDivergence(SDNode * N); |
| 1466 |
|
| 1467 |
|
| 1468 |
|
| 1469 |
|
| 1470 |
|
| 1471 |
SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT); |
| 1472 |
SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT, SDValue Op1); |
| 1473 |
SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT, |
| 1474 |
SDValue Op1, SDValue Op2); |
| 1475 |
SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT, |
| 1476 |
SDValue Op1, SDValue Op2, SDValue Op3); |
| 1477 |
SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT, |
| 1478 |
ArrayRef<SDValue> Ops); |
| 1479 |
SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT1, EVT VT2); |
| 1480 |
SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT1, |
| 1481 |
EVT VT2, ArrayRef<SDValue> Ops); |
| 1482 |
SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT1, |
| 1483 |
EVT VT2, EVT VT3, ArrayRef<SDValue> Ops); |
| 1484 |
SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT1, |
| 1485 |
EVT VT2, SDValue Op1, SDValue Op2); |
| 1486 |
SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, SDVTList VTs, |
| 1487 |
ArrayRef<SDValue> Ops); |
| 1488 |
|
| 1489 |
|
| 1490 |
|
| 1491 |
SDNode *MorphNodeTo(SDNode *N, unsigned Opc, SDVTList VTs, |
| 1492 |
ArrayRef<SDValue> Ops); |
| 1493 |
|
| 1494 |
|
| 1495 |
|
| 1496 |
|
| 1497 |
SDNode *mutateStrictFPToFP(SDNode *Node); |
| 1498 |
|
| 1499 |
|
| 1500 |
|
| 1501 |
|
| 1502 |
|
| 1503 |
|
| 1504 |
|
| 1505 |
MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT); |
| 1506 |
MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT, |
| 1507 |
SDValue Op1); |
| 1508 |
MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT, |
| 1509 |
SDValue Op1, SDValue Op2); |
| 1510 |
MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT, |
| 1511 |
SDValue Op1, SDValue Op2, SDValue Op3); |
| 1512 |
MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT, |
| 1513 |
ArrayRef<SDValue> Ops); |
| 1514 |
MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT1, |
| 1515 |
EVT VT2, SDValue Op1, SDValue Op2); |
| 1516 |
MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT1, |
| 1517 |
EVT VT2, SDValue Op1, SDValue Op2, SDValue Op3); |
| 1518 |
MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT1, |
| 1519 |
EVT VT2, ArrayRef<SDValue> Ops); |
| 1520 |
MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT1, |
| 1521 |
EVT VT2, EVT VT3, SDValue Op1, SDValue Op2); |
| 1522 |
MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT1, |
| 1523 |
EVT VT2, EVT VT3, SDValue Op1, SDValue Op2, |
| 1524 |
SDValue Op3); |
| 1525 |
MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT1, |
| 1526 |
EVT VT2, EVT VT3, ArrayRef<SDValue> Ops); |
| 1527 |
MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl, |
| 1528 |
ArrayRef<EVT> ResultTys, ArrayRef<SDValue> Ops); |
| 1529 |
MachineSDNode *getMachineNode(unsigned Opcode, const SDLoc &dl, SDVTList VTs, |
| 1530 |
ArrayRef<SDValue> Ops); |
| 1531 |
|
| 1532 |
|
| 1533 |
SDValue getTargetExtractSubreg(int SRIdx, const SDLoc &DL, EVT VT, |
| 1534 |
SDValue Operand); |
| 1535 |
|
| 1536 |
|
| 1537 |
SDValue getTargetInsertSubreg(int SRIdx, const SDLoc &DL, EVT VT, |
| 1538 |
SDValue Operand, SDValue Subreg); |
| 1539 |
|
| 1540 |
|
| 1541 |
SDNode *getNodeIfExists(unsigned Opcode, SDVTList VTList, |
| 1542 |
ArrayRef<SDValue> Ops, const SDNodeFlags Flags); |
| 1543 |
SDNode *getNodeIfExists(unsigned Opcode, SDVTList VTList, |
| 1544 |
ArrayRef<SDValue> Ops); |
| 1545 |
|
| 1546 |
|
| 1547 |
bool doesNodeExist(unsigned Opcode, SDVTList VTList, ArrayRef<SDValue> Ops); |
| 1548 |
|
| 1549 |
|
| 1550 |
SDDbgValue *getDbgValue(DIVariable *Var, DIExpression *Expr, SDNode *N, |
| 1551 |
unsigned R, bool IsIndirect, const DebugLoc &DL, |
| 1552 |
unsigned O); |
| 1553 |
|
| 1554 |
|
| 1555 |
SDDbgValue *getConstantDbgValue(DIVariable *Var, DIExpression *Expr, |
| 1556 |
const Value *C, const DebugLoc &DL, |
| 1557 |
unsigned O); |
| 1558 |
|
| 1559 |
|
| 1560 |
SDDbgValue *getFrameIndexDbgValue(DIVariable *Var, DIExpression *Expr, |
| 1561 |
unsigned FI, bool IsIndirect, |
| 1562 |
const DebugLoc &DL, unsigned O); |
| 1563 |
|
| 1564 |
|
| 1565 |
SDDbgValue *getFrameIndexDbgValue(DIVariable *Var, DIExpression *Expr, |
| 1566 |
unsigned FI, |
| 1567 |
ArrayRef<SDNode *> Dependencies, |
| 1568 |
bool IsIndirect, const DebugLoc &DL, |
| 1569 |
unsigned O); |
| 1570 |
|
| 1571 |
|
| 1572 |
SDDbgValue *getVRegDbgValue(DIVariable *Var, DIExpression *Expr, |
| 1573 |
unsigned VReg, bool IsIndirect, |
| 1574 |
const DebugLoc &DL, unsigned O); |
| 1575 |
|
| 1576 |
|
| 1577 |
SDDbgValue *getDbgValueList(DIVariable *Var, DIExpression *Expr, |
| 1578 |
ArrayRef<SDDbgOperand> Locs, |
| 1579 |
ArrayRef<SDNode *> Dependencies, bool IsIndirect, |
| 1580 |
const DebugLoc &DL, unsigned O, bool IsVariadic); |
| 1581 |
|
| 1582 |
|
| 1583 |
SDDbgLabel *getDbgLabel(DILabel *Label, const DebugLoc &DL, unsigned O); |
| 1584 |
|
| 1585 |
|
| 1586 |
|
| 1587 |
|
| 1588 |
void transferDbgValues(SDValue From, SDValue To, unsigned OffsetInBits = 0, |
| 1589 |
unsigned SizeInBits = 0, bool InvalidateDbg = true); |
| 1590 |
|
| 1591 |
|
| 1592 |
|
| 1593 |
|
| 1594 |
void RemoveDeadNode(SDNode *N); |
| 1595 |
|
| 1596 |
|
| 1597 |
|
| 1598 |
void RemoveDeadNodes(SmallVectorImpl<SDNode *> &DeadNodes); |
| 1599 |
|
| 1600 |
|
| 1601 |
|
| 1602 |
|
| 1603 |
|
| 1604 |
|
| 1605 |
|
| 1606 |
|
| 1607 |
|
| 1608 |
|
| 1609 |
|
| 1610 |
|
| 1611 |
|
| 1612 |
|
| 1613 |
|
| 1614 |
|
| 1615 |
void ReplaceAllUsesWith(SDValue From, SDValue To); |
| 1616 |
void ReplaceAllUsesWith(SDNode *From, SDNode *To); |
| 1617 |
void ReplaceAllUsesWith(SDNode *From, const SDValue *To); |
| 1618 |
|
| 1619 |
|
| 1620 |
|
| 1621 |
void ReplaceAllUsesOfValueWith(SDValue From, SDValue To); |
| 1622 |
|
| 1623 |
|
| 1624 |
|
| 1625 |
|
| 1626 |
void ReplaceAllUsesOfValuesWith(const SDValue *From, const SDValue *To, |
| 1627 |
unsigned Num); |
| 1628 |
|
| 1629 |
|
| 1630 |
|
| 1631 |
|
| 1632 |
|
| 1633 |
|
| 1634 |
SDValue makeEquivalentMemoryOrdering(SDValue OldChain, SDValue NewMemOpChain); |
| 1635 |
|
| 1636 |
|
| 1637 |
|
| 1638 |
|
| 1639 |
|
| 1640 |
|
| 1641 |
SDValue makeEquivalentMemoryOrdering(LoadSDNode *OldLoad, SDValue NewMemOp); |
| 1642 |
|
| 1643 |
|
| 1644 |
|
| 1645 |
|
| 1646 |
unsigned AssignTopologicalOrder(); |
| 1647 |
|
| 1648 |
|
| 1649 |
|
| 1650 |
|
| 1651 |
void RepositionNode(allnodes_iterator Position, SDNode *N) { |
| 1652 |
AllNodes.insert(Position, AllNodes.remove(N)); |
| 1653 |
} |
| 1654 |
|
| 1655 |
|
| 1656 |
|
| 1657 |
static const fltSemantics &EVTToAPFloatSemantics(EVT VT) { |
| 1658 |
switch (VT.getScalarType().getSimpleVT().SimpleTy) { |
| 1659 |
default: llvm_unreachable("Unknown FP format"); |
| 1660 |
case MVT::f16: return APFloat::IEEEhalf(); |
| 1661 |
case MVT::bf16: return APFloat::BFloat(); |
| 1662 |
case MVT::f32: return APFloat::IEEEsingle(); |
| 1663 |
case MVT::f64: return APFloat::IEEEdouble(); |
| 1664 |
case MVT::f80: return APFloat::x87DoubleExtended(); |
| 1665 |
case MVT::f128: return APFloat::IEEEquad(); |
| 1666 |
case MVT::ppcf128: return APFloat::PPCDoubleDouble(); |
| 1667 |
} |
| 1668 |
} |
| 1669 |
|
| 1670 |
|
| 1671 |
|
| 1672 |
void AddDbgValue(SDDbgValue *DB, bool isParameter); |
| 1673 |
|
| 1674 |
|
| 1675 |
void AddDbgLabel(SDDbgLabel *DB); |
| 1676 |
|
| 1677 |
|
| 1678 |
ArrayRef<SDDbgValue*> GetDbgValues(const SDNode* SD) const { |
| 1679 |
return DbgInfo->getSDDbgValues(SD); |
| 1680 |
} |
| 1681 |
|
| 1682 |
public: |
| 1683 |
|
| 1684 |
|
| 1685 |
bool hasDebugValues() const { return !DbgInfo->empty(); } |
| 1686 |
|
| 1687 |
SDDbgInfo::DbgIterator DbgBegin() const { return DbgInfo->DbgBegin(); } |
| 1688 |
SDDbgInfo::DbgIterator DbgEnd() const { return DbgInfo->DbgEnd(); } |
| 1689 |
|
| 1690 |
SDDbgInfo::DbgIterator ByvalParmDbgBegin() const { |
| 1691 |
return DbgInfo->ByvalParmDbgBegin(); |
| 1692 |
} |
| 1693 |
SDDbgInfo::DbgIterator ByvalParmDbgEnd() const { |
| 1694 |
return DbgInfo->ByvalParmDbgEnd(); |
| 1695 |
} |
| 1696 |
|
| 1697 |
SDDbgInfo::DbgLabelIterator DbgLabelBegin() const { |
| 1698 |
return DbgInfo->DbgLabelBegin(); |
| 1699 |
} |
| 1700 |
SDDbgInfo::DbgLabelIterator DbgLabelEnd() const { |
| 1701 |
return DbgInfo->DbgLabelEnd(); |
| 1702 |
} |
| 1703 |
|
| 1704 |
|
| 1705 |
|
| 1706 |
void salvageDebugInfo(SDNode &N); |
| 1707 |
|
| 1708 |
|
| 1709 |
|
| 1710 |
void useInstrRefDebugInfo(bool Flag) { |
| 1711 |
UseInstrRefDebugInfo = Flag; |
| 1712 |
} |
| 1713 |
|
| 1714 |
bool getUseInstrRefDebugInfo() const { |
| 1715 |
return UseInstrRefDebugInfo; |
| 1716 |
} |
| 1717 |
|
| 1718 |
void dump() const; |
| 1719 |
|
| 1720 |
|
| 1721 |
|
| 1722 |
|
| 1723 |
|
| 1724 |
Align getReducedAlign(EVT VT, bool UseABI); |
| 1725 |
|
| 1726 |
|
| 1727 |
SDValue CreateStackTemporary(TypeSize Bytes, Align Alignment); |
| 1728 |
|
| 1729 |
|
| 1730 |
|
| 1731 |
SDValue CreateStackTemporary(EVT VT, unsigned minAlign = 1); |
| 1732 |
|
| 1733 |
|
| 1734 |
|
| 1735 |
SDValue CreateStackTemporary(EVT VT1, EVT VT2); |
| 1736 |
|
| 1737 |
SDValue FoldSymbolOffset(unsigned Opcode, EVT VT, |
| 1738 |
const GlobalAddressSDNode *GA, |
| 1739 |
const SDNode *N2); |
| 1740 |
|
| 1741 |
SDValue FoldConstantArithmetic(unsigned Opcode, const SDLoc &DL, EVT VT, |
| 1742 |
ArrayRef<SDValue> Ops); |
| 1743 |
|
| 1744 |
|
| 1745 |
|
| 1746 |
SDValue foldConstantFPMath(unsigned Opcode, const SDLoc &DL, EVT VT, |
| 1747 |
SDValue N1, SDValue N2); |
| 1748 |
|
| 1749 |
|
| 1750 |
SDValue FoldSetCC(EVT VT, SDValue N1, SDValue N2, ISD::CondCode Cond, |
| 1751 |
const SDLoc &dl); |
| 1752 |
|
| 1753 |
|
| 1754 |
|
| 1755 |
|
| 1756 |
|
| 1757 |
|
| 1758 |
|
| 1759 |
SDValue GetDemandedBits(SDValue V, const APInt &DemandedBits); |
| 1760 |
|
| 1761 |
|
| 1762 |
|
| 1763 |
|
| 1764 |
|
| 1765 |
|
| 1766 |
|
| 1767 |
|
| 1768 |
SDValue GetDemandedBits(SDValue V, const APInt &DemandedBits, |
| 1769 |
const APInt &DemandedElts); |
| 1770 |
|
| 1771 |
|
| 1772 |
|
| 1773 |
bool SignBitIsZero(SDValue Op, unsigned Depth = 0) const; |
| 1774 |
|
| 1775 |
|
| 1776 |
|
| 1777 |
|
| 1778 |
bool MaskedValueIsZero(SDValue Op, const APInt &Mask, |
| 1779 |
unsigned Depth = 0) const; |
| 1780 |
|
| 1781 |
|
| 1782 |
|
| 1783 |
|
| 1784 |
bool MaskedValueIsZero(SDValue Op, const APInt &Mask, |
| 1785 |
const APInt &DemandedElts, unsigned Depth = 0) const; |
| 1786 |
|
| 1787 |
|
| 1788 |
|
| 1789 |
bool MaskedValueIsAllOnes(SDValue Op, const APInt &Mask, |
| 1790 |
unsigned Depth = 0) const; |
| 1791 |
|
| 1792 |
|
| 1793 |
|
| 1794 |
|
| 1795 |
|
| 1796 |
|
| 1797 |
KnownBits computeKnownBits(SDValue Op, unsigned Depth = 0) const; |
| 1798 |
|
| 1799 |
|
| 1800 |
|
| 1801 |
|
| 1802 |
|
| 1803 |
|
| 1804 |
KnownBits computeKnownBits(SDValue Op, const APInt &DemandedElts, |
| 1805 |
unsigned Depth = 0) const; |
| 1806 |
|
| 1807 |
|
| 1808 |
|
| 1809 |
|
| 1810 |
|
| 1811 |
enum OverflowKind { |
| 1812 |
OFK_Never, |
| 1813 |
OFK_Sometime, |
| 1814 |
OFK_Always, |
| 1815 |
}; |
| 1816 |
|
| 1817 |
|
| 1818 |
OverflowKind computeOverflowKind(SDValue N0, SDValue N1) const; |
| 1819 |
|
| 1820 |
|
| 1821 |
|
| 1822 |
|
| 1823 |
bool isKnownToBeAPowerOfTwo(SDValue Val) const; |
| 1824 |
|
| 1825 |
|
| 1826 |
|
| 1827 |
|
| 1828 |
|
| 1829 |
|
| 1830 |
|
| 1831 |
|
| 1832 |
unsigned ComputeNumSignBits(SDValue Op, unsigned Depth = 0) const; |
| 1833 |
|
| 1834 |
|
| 1835 |
|
| 1836 |
|
| 1837 |
|
| 1838 |
|
| 1839 |
|
| 1840 |
|
| 1841 |
|
| 1842 |
unsigned ComputeNumSignBits(SDValue Op, const APInt &DemandedElts, |
| 1843 |
unsigned Depth = 0) const; |
| 1844 |
|
| 1845 |
|
| 1846 |
|
| 1847 |
|
| 1848 |
|
| 1849 |
unsigned ComputeMaxSignificantBits(SDValue Op, unsigned Depth = 0) const; |
| 1850 |
|
| 1851 |
|
| 1852 |
|
| 1853 |
|
| 1854 |
|
| 1855 |
unsigned ComputeMaxSignificantBits(SDValue Op, const APInt &DemandedElts, |
| 1856 |
unsigned Depth = 0) const; |
| 1857 |
|
| 1858 |
|
| 1859 |
|
| 1860 |
bool isGuaranteedNotToBeUndefOrPoison(SDValue Op, bool PoisonOnly = false, |
| 1861 |
unsigned Depth = 0) const; |
| 1862 |
|
| 1863 |
|
| 1864 |
|
| 1865 |
|
| 1866 |
bool isGuaranteedNotToBeUndefOrPoison(SDValue Op, const APInt &DemandedElts, |
| 1867 |
bool PoisonOnly = false, |
| 1868 |
unsigned Depth = 0) const; |
| 1869 |
|
| 1870 |
|
| 1871 |
bool isGuaranteedNotToBePoison(SDValue Op, unsigned Depth = 0) const { |
| 1872 |
return isGuaranteedNotToBeUndefOrPoison(Op, true, Depth); |
| 1873 |
} |
| 1874 |
|
| 1875 |
|
| 1876 |
|
| 1877 |
bool isGuaranteedNotToBePoison(SDValue Op, const APInt &DemandedElts, |
| 1878 |
unsigned Depth = 0) const { |
| 1879 |
return isGuaranteedNotToBeUndefOrPoison(Op, DemandedElts, |
| 1880 |
true, Depth); |
| 1881 |
} |
| 1882 |
|
| 1883 |
|
| 1884 |
|
| 1885 |
|
| 1886 |
|
| 1887 |
|
| 1888 |
bool isBaseWithConstantOffset(SDValue Op) const; |
| 1889 |
|
| 1890 |
|
| 1891 |
|
| 1892 |
|
| 1893 |
bool isKnownNeverNaN(SDValue Op, bool SNaN = false, unsigned Depth = 0) const; |
| 1894 |
|
| 1895 |
|
| 1896 |
bool isKnownNeverSNaN(SDValue Op, unsigned Depth = 0) const { |
| 1897 |
return isKnownNeverNaN(Op, true, Depth); |
| 1898 |
} |
| 1899 |
|
| 1900 |
|
| 1901 |
|
| 1902 |
bool isKnownNeverZeroFloat(SDValue Op) const; |
| 1903 |
|
| 1904 |
|
| 1905 |
bool isKnownNeverZero(SDValue Op) const; |
| 1906 |
|
| 1907 |
|
| 1908 |
|
| 1909 |
|
| 1910 |
bool isEqualTo(SDValue A, SDValue B) const; |
| 1911 |
|
| 1912 |
|
| 1913 |
|
| 1914 |
bool haveNoCommonBitsSet(SDValue A, SDValue B) const; |
| 1915 |
|
| 1916 |
|
| 1917 |
|
| 1918 |
|
| 1919 |
|
| 1920 |
|
| 1921 |
|
| 1922 |
|
| 1923 |
bool isSplatValue(SDValue V, const APInt &DemandedElts, APInt &UndefElts, |
| 1924 |
unsigned Depth = 0) const; |
| 1925 |
|
| 1926 |
|
| 1927 |
bool isSplatValue(SDValue V, bool AllowUndefs = false) const; |
| 1928 |
|
| 1929 |
|
| 1930 |
SDValue getSplatSourceVector(SDValue V, int &SplatIndex); |
| 1931 |
|
| 1932 |
|
| 1933 |
|
| 1934 |
|
| 1935 |
|
| 1936 |
SDValue getSplatValue(SDValue V, bool LegalTypes = false); |
| 1937 |
|
| 1938 |
|
| 1939 |
|
| 1940 |
const APInt *getValidShiftAmountConstant(SDValue V, |
| 1941 |
const APInt &DemandedElts) const; |
| 1942 |
|
| 1943 |
|
| 1944 |
|
| 1945 |
const APInt * |
| 1946 |
getValidMinimumShiftAmountConstant(SDValue V, |
| 1947 |
const APInt &DemandedElts) const; |
| 1948 |
|
| 1949 |
|
| 1950 |
|
| 1951 |
const APInt * |
| 1952 |
getValidMaximumShiftAmountConstant(SDValue V, |
| 1953 |
const APInt &DemandedElts) const; |
| 1954 |
|
| 1955 |
|
| 1956 |
|
| 1957 |
|
| 1958 |
|
| 1959 |
|
| 1960 |
|
| 1961 |
|
| 1962 |
|
| 1963 |
SDValue matchBinOpReduction(SDNode *Extract, ISD::NodeType &BinOp, |
| 1964 |
ArrayRef<ISD::NodeType> CandidateBinOps, |
| 1965 |
bool AllowPartials = false); |
| 1966 |
|
| 1967 |
|
| 1968 |
|
| 1969 |
|
| 1970 |
|
| 1971 |
|
| 1972 |
|
| 1973 |
SDValue UnrollVectorOp(SDNode *N, unsigned ResNE = 0); |
| 1974 |
|
| 1975 |
|
| 1976 |
|
| 1977 |
std::pair<SDValue, SDValue> UnrollVectorOverflowOp(SDNode *N, |
| 1978 |
unsigned ResNE = 0); |
| 1979 |
|
| 1980 |
|
| 1981 |
|
| 1982 |
|
| 1983 |
|
| 1984 |
bool areNonVolatileConsecutiveLoads(LoadSDNode *LD, LoadSDNode *Base, |
| 1985 |
unsigned Bytes, int Dist) const; |
| 1986 |
|
| 1987 |
|
| 1988 |
|
| 1989 |
MaybeAlign InferPtrAlign(SDValue Ptr) const; |
| 1990 |
|
| 1991 |
|
| 1992 |
|
| 1993 |
std::pair<EVT, EVT> GetSplitDestVTs(const EVT &VT) const; |
| 1994 |
|
| 1995 |
|
| 1996 |
|
| 1997 |
|
| 1998 |
std::pair<EVT, EVT> GetDependentSplitDestVTs(const EVT &VT, const EVT &EnvVT, |
| 1999 |
bool *HiIsEmpty) const; |
| 2000 |
|
| 2001 |
|
| 2002 |
|
| 2003 |
std::pair<SDValue, SDValue> SplitVector(const SDValue &N, const SDLoc &DL, |
| 2004 |
const EVT &LoVT, const EVT &HiVT); |
| 2005 |
|
| 2006 |
|
| 2007 |
std::pair<SDValue, SDValue> SplitVector(const SDValue &N, const SDLoc &DL) { |
| 2008 |
EVT LoVT, HiVT; |
| 2009 |
std::tie(LoVT, HiVT) = GetSplitDestVTs(N.getValueType()); |
| 2010 |
return SplitVector(N, DL, LoVT, HiVT); |
| 2011 |
} |
| 2012 |
|
| 2013 |
|
| 2014 |
std::pair<SDValue, SDValue> SplitEVL(SDValue N, EVT VecVT, const SDLoc &DL); |
| 2015 |
|
| 2016 |
|
| 2017 |
|
| 2018 |
std::pair<SDValue, SDValue> SplitVectorOperand(const SDNode *N, unsigned OpNo) |
| 2019 |
{ |
| 2020 |
return SplitVector(N->getOperand(OpNo), SDLoc(N)); |
| 2021 |
} |
| 2022 |
|
| 2023 |
|
| 2024 |
SDValue WidenVector(const SDValue &N, const SDLoc &DL); |
| 2025 |
|
| 2026 |
|
| 2027 |
|
| 2028 |
|
| 2029 |
|
| 2030 |
void ExtractVectorElements(SDValue Op, SmallVectorImpl<SDValue> &Args, |
| 2031 |
unsigned Start = 0, unsigned Count = 0, |
| 2032 |
EVT EltVT = EVT()); |
| 2033 |
|
| 2034 |
|
| 2035 |
Align getEVTAlign(EVT MemoryVT) const; |
| 2036 |
|
| 2037 |
|
| 2038 |
inline unsigned getEVTAlignment(EVT MemoryVT) const { |
| 2039 |
return getEVTAlign(MemoryVT).value(); |
| 2040 |
} |
| 2041 |
|
| 2042 |
|
| 2043 |
SDNode *isConstantIntBuildVectorOrConstantInt(SDValue N) const; |
| 2044 |
|
| 2045 |
|
| 2046 |
SDNode *isConstantFPBuildVectorOrConstantFP(SDValue N) const ; |
| 2047 |
|
| 2048 |
|
| 2049 |
|
| 2050 |
inline bool isConstantValueOfAnyType(SDValue N) const { |
| 2051 |
return isConstantIntBuildVectorOrConstantInt(N) || |
| 2052 |
isConstantFPBuildVectorOrConstantFP(N); |
| 2053 |
} |
| 2054 |
|
| 2055 |
void addCallSiteInfo(const SDNode *CallNode, CallSiteInfoImpl &&CallInfo) { |
| 2056 |
SDCallSiteDbgInfo[CallNode].CSInfo = std::move(CallInfo); |
| 2057 |
} |
| 2058 |
|
| 2059 |
CallSiteInfo getSDCallSiteInfo(const SDNode *CallNode) { |
| 2060 |
auto I = SDCallSiteDbgInfo.find(CallNode); |
| 2061 |
if (I != SDCallSiteDbgInfo.end()) |
| 2062 |
return std::move(I->second).CSInfo; |
| 2063 |
return CallSiteInfo(); |
| 2064 |
} |
| 2065 |
|
| 2066 |
void addHeapAllocSite(const SDNode *Node, MDNode *MD) { |
| 2067 |
SDCallSiteDbgInfo[Node].HeapAllocSite = MD; |
| 2068 |
} |
| 2069 |
|
| 2070 |
|
| 2071 |
MDNode *getHeapAllocSite(const SDNode *Node) { |
| 2072 |
auto It = SDCallSiteDbgInfo.find(Node); |
| 2073 |
if (It == SDCallSiteDbgInfo.end()) |
| 2074 |
return nullptr; |
| 2075 |
return It->second.HeapAllocSite; |
| 2076 |
} |
| 2077 |
|
| 2078 |
void addNoMergeSiteInfo(const SDNode *Node, bool NoMerge) { |
| 2079 |
if (NoMerge) |
| 2080 |
SDCallSiteDbgInfo[Node].NoMerge = NoMerge; |
| 2081 |
} |
| 2082 |
|
| 2083 |
bool getNoMergeSiteInfo(const SDNode *Node) { |
| 2084 |
auto I = SDCallSiteDbgInfo.find(Node); |
| 2085 |
if (I == SDCallSiteDbgInfo.end()) |
| 2086 |
return false; |
| 2087 |
return I->second.NoMerge; |
| 2088 |
} |
| 2089 |
|
| 2090 |
|
| 2091 |
|
| 2092 |
DenormalMode getDenormalMode(EVT VT) const { |
| 2093 |
return MF->getDenormalMode(EVTToAPFloatSemantics(VT)); |
| 2094 |
} |
| 2095 |
|
| 2096 |
bool shouldOptForSize() const; |
| 2097 |
|
| 2098 |
|
| 2099 |
SDValue getNeutralElement(unsigned Opcode, const SDLoc &DL, EVT VT, |
| 2100 |
SDNodeFlags Flags); |
| 2101 |
|
| 2102 |
private: |
| 2103 |
void InsertNode(SDNode *N); |
| 2104 |
bool RemoveNodeFromCSEMaps(SDNode *N); |
| 2105 |
void AddModifiedNodeToCSEMaps(SDNode *N); |
| 2106 |
SDNode *FindModifiedNodeSlot(SDNode *N, SDValue Op, void *&InsertPos); |
| 2107 |
SDNode *FindModifiedNodeSlot(SDNode *N, SDValue Op1, SDValue Op2, |
| 2108 |
void *&InsertPos); |
| 2109 |
SDNode *FindModifiedNodeSlot(SDNode *N, ArrayRef<SDValue> Ops, |
| 2110 |
void *&InsertPos); |
| 2111 |
SDNode *UpdateSDLocOnMergeSDNode(SDNode *N, const SDLoc &loc); |
| 2112 |
|
| 2113 |
void DeleteNodeNotInCSEMaps(SDNode *N); |
| 2114 |
void DeallocateNode(SDNode *N); |
| 2115 |
|
| 2116 |
void allnodes_clear(); |
| 2117 |
|
| 2118 |
|
| 2119 |
|
| 2120 |
|
| 2121 |
|
| 2122 |
SDNode *FindNodeOrInsertPos(const FoldingSetNodeID &ID, void *&InsertPos); |
| 2123 |
|
| 2124 |
|
| 2125 |
|
| 2126 |
|
| 2127 |
SDNode *FindNodeOrInsertPos(const FoldingSetNodeID &ID, const SDLoc &DL, |
| 2128 |
void *&InsertPos); |
| 2129 |
|
| 2130 |
|
| 2131 |
FoldingSet<SDVTListNode> VTListMap; |
| 2132 |
|
| 2133 |
|
| 2134 |
std::vector<CondCodeSDNode*> CondCodeNodes; |
| 2135 |
|
| 2136 |
std::vector<SDNode*> ValueTypeNodes; |
| 2137 |
std::map<EVT, SDNode*, EVT::compareRawBits> ExtendedValueTypeNodes; |
| 2138 |
StringMap<SDNode*> ExternalSymbols; |
| 2139 |
|
| 2140 |
std::map<std::pair<std::string, unsigned>, SDNode *> TargetExternalSymbols; |
| 2141 |
DenseMap<MCSymbol *, SDNode *> MCSymbols; |
| 2142 |
|
| 2143 |
FlagInserter *Inserter = nullptr; |
| 2144 |
}; |
| 2145 |
|
| 2146 |
template <> struct GraphTraits<SelectionDAG*> : public GraphTraits<SDNode*> { |
| 2147 |
using nodes_iterator = pointer_iterator<SelectionDAG::allnodes_iterator>; |
| 2148 |
|
| 2149 |
static nodes_iterator nodes_begin(SelectionDAG *G) { |
| 2150 |
return nodes_iterator(G->allnodes_begin()); |
| 2151 |
} |
| 2152 |
|
| 2153 |
static nodes_iterator nodes_end(SelectionDAG *G) { |
| 2154 |
return nodes_iterator(G->allnodes_end()); |
| 2155 |
} |
| 2156 |
}; |
| 2157 |
|
| 2158 |
} |
| 2159 |
|
| 2160 |
#endif |