2005-01-07 07:46:32 +00:00
|
|
|
//===-- llvm/CodeGen/SelectionDAG.h - InstSelection DAG ---------*- C++ -*-===//
|
2005-04-21 20:39:54 +00:00
|
|
|
//
|
2003-10-20 20:19:47 +00:00
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 19:59:42 +00:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2005-04-21 20:39:54 +00:00
|
|
|
//
|
2003-10-20 20:19:47 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
2005-04-21 20:39:54 +00:00
|
|
|
//
|
2005-01-07 07:46:32 +00:00
|
|
|
// This file declares the SelectionDAG class, and transitively defines the
|
|
|
|
// SDNode class and subclasses.
|
2005-04-21 20:39:54 +00:00
|
|
|
//
|
2003-08-11 14:56:26 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_CODEGEN_SELECTIONDAG_H
|
|
|
|
#define LLVM_CODEGEN_SELECTIONDAG_H
|
|
|
|
|
2008-10-27 18:17:03 +00:00
|
|
|
#include "llvm/ADT/DenseSet.h"
|
2014-07-26 05:49:40 +00:00
|
|
|
#include "llvm/ADT/SetVector.h"
|
2008-06-23 21:08:32 +00:00
|
|
|
#include "llvm/ADT/StringMap.h"
|
2012-12-03 17:02:12 +00:00
|
|
|
#include "llvm/ADT/ilist.h"
|
2012-12-27 06:47:41 +00:00
|
|
|
#include "llvm/CodeGen/DAGCombine.h"
|
2014-08-05 02:39:49 +00:00
|
|
|
#include "llvm/CodeGen/MachineFunction.h"
|
2006-10-27 23:46:08 +00:00
|
|
|
#include "llvm/CodeGen/SelectionDAGNodes.h"
|
2009-09-25 20:36:54 +00:00
|
|
|
#include "llvm/Support/RecyclingAllocator.h"
|
2009-04-29 23:29:43 +00:00
|
|
|
#include "llvm/Target/TargetMachine.h"
|
2008-07-22 18:04:23 +00:00
|
|
|
#include <cassert>
|
2006-06-29 23:57:05 +00:00
|
|
|
#include <map>
|
2005-11-30 22:45:14 +00:00
|
|
|
#include <string>
|
2012-12-03 17:02:12 +00:00
|
|
|
#include <vector>
|
2003-11-11 22:41:34 +00:00
|
|
|
|
|
|
|
namespace llvm {
|
2008-07-28 21:51:04 +00:00
|
|
|
|
|
|
|
class AliasAnalysis;
|
2009-12-18 23:32:53 +00:00
|
|
|
class MachineConstantPoolValue;
|
|
|
|
class MachineFunction;
|
2010-03-29 20:48:30 +00:00
|
|
|
class MDNode;
|
2010-03-10 22:13:47 +00:00
|
|
|
class SDDbgValue;
|
2009-12-18 23:32:53 +00:00
|
|
|
class TargetLowering;
|
2010-05-11 17:31:57 +00:00
|
|
|
class TargetSelectionDAGInfo;
|
2008-07-28 21:51:04 +00:00
|
|
|
|
2013-10-22 08:02:02 +00:00
|
|
|
class SDVTListNode : public FoldingSetNode {
|
|
|
|
friend struct FoldingSetTrait<SDVTListNode>;
|
|
|
|
/// FastID - A reference to an Interned FoldingSetNodeID for this node.
|
|
|
|
/// The Allocator in SelectionDAG holds the data.
|
|
|
|
/// SDVTList contains all types which are frequently accessed in SelectionDAG.
|
|
|
|
/// The size of this list is not expected big so it won't introduce memory penalty.
|
|
|
|
FoldingSetNodeIDRef FastID;
|
|
|
|
const EVT *VTs;
|
|
|
|
unsigned int NumVTs;
|
|
|
|
/// The hash value for SDVTList is fixed so cache it to avoid hash calculation
|
|
|
|
unsigned HashValue;
|
|
|
|
public:
|
|
|
|
SDVTListNode(const FoldingSetNodeIDRef ID, const EVT *VT, unsigned int Num) :
|
|
|
|
FastID(ID), VTs(VT), NumVTs(Num) {
|
|
|
|
HashValue = ID.ComputeHash();
|
|
|
|
}
|
|
|
|
SDVTList getSDVTList() {
|
|
|
|
SDVTList result = {VTs, NumVTs};
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
// Specialize FoldingSetTrait for SDVTListNode
|
|
|
|
// To avoid computing temp FoldingSetNodeID and hash value.
|
|
|
|
template<> struct FoldingSetTrait<SDVTListNode> : DefaultFoldingSetTrait<SDVTListNode> {
|
|
|
|
static void Profile(const SDVTListNode &X, FoldingSetNodeID& ID) {
|
|
|
|
ID = X.FastID;
|
|
|
|
}
|
|
|
|
static bool Equals(const SDVTListNode &X, const FoldingSetNodeID &ID,
|
|
|
|
unsigned IDHash, FoldingSetNodeID &TempID) {
|
|
|
|
if (X.HashValue != IDHash)
|
|
|
|
return false;
|
|
|
|
return ID == X.FastID;
|
|
|
|
}
|
|
|
|
static unsigned ComputeHash(const SDVTListNode &X, FoldingSetNodeID &TempID) {
|
|
|
|
return X.HashValue;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2008-09-20 18:02:18 +00:00
|
|
|
template<> struct ilist_traits<SDNode> : public ilist_default_traits<SDNode> {
|
|
|
|
private:
|
2009-08-26 19:16:32 +00:00
|
|
|
mutable ilist_half_node<SDNode> Sentinel;
|
2008-07-28 21:51:04 +00:00
|
|
|
public:
|
|
|
|
SDNode *createSentinel() const {
|
2009-03-04 06:57:48 +00:00
|
|
|
return static_cast<SDNode*>(&Sentinel);
|
2008-07-28 21:51:04 +00:00
|
|
|
}
|
|
|
|
static void destroySentinel(SDNode *) {}
|
|
|
|
|
2009-03-04 20:36:44 +00:00
|
|
|
SDNode *provideInitialHead() const { return createSentinel(); }
|
|
|
|
SDNode *ensureHead(SDNode*) const { return createSentinel(); }
|
2009-03-04 21:54:31 +00:00
|
|
|
static void noteHead(SDNode*, SDNode*) {}
|
2009-03-04 20:36:44 +00:00
|
|
|
|
2008-07-28 21:51:04 +00:00
|
|
|
static void deleteNode(SDNode *) {
|
2012-02-05 22:14:15 +00:00
|
|
|
llvm_unreachable("ilist_traits<SDNode> shouldn't see a deleteNode call!");
|
2008-07-28 21:51:04 +00:00
|
|
|
}
|
|
|
|
private:
|
|
|
|
static void createNode(const SDNode &);
|
|
|
|
};
|
2005-01-07 07:46:32 +00:00
|
|
|
|
2010-03-10 22:13:47 +00:00
|
|
|
/// SDDbgInfo - Keeps track of dbg_value information through SDISel. We do
|
|
|
|
/// not build SDNodes for these so as not to perturb the generated code;
|
2010-03-25 01:38:16 +00:00
|
|
|
/// instead the info is kept off to the side in this structure. Each SDNode may
|
|
|
|
/// have one or more associated dbg_value entries. This information is kept in
|
|
|
|
/// DbgValMap.
|
2010-04-26 20:06:49 +00:00
|
|
|
/// Byval parameters are handled separately because they don't use alloca's,
|
|
|
|
/// which busts the normal mechanism. There is good reason for handling all
|
|
|
|
/// parameters separately: they may not have code generated for them, they
|
|
|
|
/// should always go at the beginning of the function regardless of other code
|
|
|
|
/// motion, and debug info for them is potentially useful even if the parameter
|
|
|
|
/// is unused. Right now only byval parameters are handled separately.
|
2010-03-10 22:13:47 +00:00
|
|
|
class SDDbgInfo {
|
2010-03-25 01:38:16 +00:00
|
|
|
SmallVector<SDDbgValue*, 32> DbgValues;
|
2010-04-26 20:06:49 +00:00
|
|
|
SmallVector<SDDbgValue*, 32> ByvalParmDbgValues;
|
2013-07-03 05:11:49 +00:00
|
|
|
typedef DenseMap<const SDNode*, SmallVector<SDDbgValue*, 2> > DbgValMapType;
|
|
|
|
DbgValMapType DbgValMap;
|
2010-03-10 22:13:47 +00:00
|
|
|
|
2012-09-17 06:59:23 +00:00
|
|
|
void operator=(const SDDbgInfo&) LLVM_DELETED_FUNCTION;
|
|
|
|
SDDbgInfo(const SDDbgInfo&) LLVM_DELETED_FUNCTION;
|
2010-03-10 22:13:47 +00:00
|
|
|
public:
|
|
|
|
SDDbgInfo() {}
|
|
|
|
|
2010-04-26 20:06:49 +00:00
|
|
|
void add(SDDbgValue *V, const SDNode *Node, bool isParameter) {
|
|
|
|
if (isParameter) {
|
|
|
|
ByvalParmDbgValues.push_back(V);
|
|
|
|
} else DbgValues.push_back(V);
|
2010-03-25 01:38:16 +00:00
|
|
|
if (Node)
|
2010-03-25 06:26:14 +00:00
|
|
|
DbgValMap[Node].push_back(V);
|
2010-03-10 22:13:47 +00:00
|
|
|
}
|
2010-03-25 01:38:16 +00:00
|
|
|
|
2014-11-11 21:21:08 +00:00
|
|
|
/// \brief Invalidate all DbgValues attached to the node and remove
|
|
|
|
/// it from the Node-to-DbgValues map.
|
|
|
|
void erase(const SDNode *Node);
|
|
|
|
|
2010-03-10 22:13:47 +00:00
|
|
|
void clear() {
|
2010-03-25 06:26:14 +00:00
|
|
|
DbgValMap.clear();
|
2010-03-25 01:38:16 +00:00
|
|
|
DbgValues.clear();
|
2010-04-26 20:06:49 +00:00
|
|
|
ByvalParmDbgValues.clear();
|
2010-03-25 01:38:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool empty() const {
|
2010-04-26 20:06:49 +00:00
|
|
|
return DbgValues.empty() && ByvalParmDbgValues.empty();
|
2010-03-10 22:13:47 +00:00
|
|
|
}
|
2010-03-25 01:38:16 +00:00
|
|
|
|
2011-06-18 13:13:44 +00:00
|
|
|
ArrayRef<SDDbgValue*> getSDDbgValues(const SDNode *Node) {
|
2013-07-03 05:11:49 +00:00
|
|
|
DbgValMapType::iterator I = DbgValMap.find(Node);
|
2011-06-18 13:13:44 +00:00
|
|
|
if (I != DbgValMap.end())
|
|
|
|
return I->second;
|
|
|
|
return ArrayRef<SDDbgValue*>();
|
2010-03-10 22:13:47 +00:00
|
|
|
}
|
2010-03-25 01:38:16 +00:00
|
|
|
|
2013-07-03 05:11:49 +00:00
|
|
|
typedef SmallVectorImpl<SDDbgValue*>::iterator DbgIterator;
|
2010-03-25 01:38:16 +00:00
|
|
|
DbgIterator DbgBegin() { return DbgValues.begin(); }
|
|
|
|
DbgIterator DbgEnd() { return DbgValues.end(); }
|
2010-04-26 20:06:49 +00:00
|
|
|
DbgIterator ByvalParmDbgBegin() { return ByvalParmDbgValues.begin(); }
|
|
|
|
DbgIterator ByvalParmDbgEnd() { return ByvalParmDbgValues.end(); }
|
2010-03-10 22:13:47 +00:00
|
|
|
};
|
|
|
|
|
2010-01-20 20:13:31 +00:00
|
|
|
class SelectionDAG;
|
2014-05-31 16:23:20 +00:00
|
|
|
void checkForCycles(const SelectionDAG *DAG, bool force = false);
|
2010-01-20 20:13:31 +00:00
|
|
|
|
2005-01-07 07:46:32 +00:00
|
|
|
/// SelectionDAG class - This is used to represent a portion of an LLVM function
|
|
|
|
/// in a low-level Data Dependence DAG representation suitable for instruction
|
|
|
|
/// selection. This DAG is constructed as the first step of instruction
|
|
|
|
/// selection in order to allow implementation of machine specific optimizations
|
|
|
|
/// and code simplifications.
|
|
|
|
///
|
|
|
|
/// The representation used by the SelectionDAG is a target-independent
|
|
|
|
/// representation, which has some similarities to the GCC RTL representation,
|
|
|
|
/// but is significantly more simple, powerful, and is a graph form instead of a
|
|
|
|
/// linear form.
|
2003-08-11 14:56:26 +00:00
|
|
|
///
|
|
|
|
class SelectionDAG {
|
2010-04-19 19:22:07 +00:00
|
|
|
const TargetMachine &TM;
|
2014-08-20 21:40:15 +00:00
|
|
|
const TargetSelectionDAGInfo *TSI;
|
2013-11-19 21:20:17 +00:00
|
|
|
const TargetLowering *TLI;
|
2008-08-27 23:52:12 +00:00
|
|
|
MachineFunction *MF;
|
2010-04-05 06:19:28 +00:00
|
|
|
LLVMContext *Context;
|
2011-12-15 18:21:18 +00:00
|
|
|
CodeGenOpt::Level OptLevel;
|
2003-08-11 14:56:26 +00:00
|
|
|
|
2008-08-23 02:25:05 +00:00
|
|
|
/// EntryNode - The starting token.
|
|
|
|
SDNode EntryNode;
|
|
|
|
|
|
|
|
/// Root - The root of the entire DAG.
|
|
|
|
SDValue Root;
|
2003-08-11 14:56:26 +00:00
|
|
|
|
2006-08-14 22:19:25 +00:00
|
|
|
/// AllNodes - A linked list of nodes in the current DAG.
|
2008-07-28 21:51:04 +00:00
|
|
|
ilist<SDNode> AllNodes;
|
|
|
|
|
2008-08-23 02:25:05 +00:00
|
|
|
/// NodeAllocatorType - The AllocatorType for allocating SDNodes. We use
|
|
|
|
/// pool allocation with recycling.
|
|
|
|
typedef RecyclingAllocator<BumpPtrAllocator, SDNode, sizeof(LargestSDNode),
|
|
|
|
AlignOf<MostAlignedSDNode>::Alignment>
|
|
|
|
NodeAllocatorType;
|
|
|
|
|
|
|
|
/// NodeAllocator - Pool allocation for nodes.
|
|
|
|
NodeAllocatorType NodeAllocator;
|
2005-05-03 17:19:30 +00:00
|
|
|
|
2006-08-14 22:19:25 +00:00
|
|
|
/// CSEMap - This structure is used to memoize nodes, automatically performing
|
2009-08-21 17:41:48 +00:00
|
|
|
/// CSE with existing nodes when a duplicate is requested.
|
2006-10-27 23:46:08 +00:00
|
|
|
FoldingSet<SDNode> CSEMap;
|
2006-08-14 22:19:25 +00:00
|
|
|
|
2008-08-23 02:25:05 +00:00
|
|
|
/// OperandAllocator - Pool allocation for machine-opcode SDNode operands.
|
|
|
|
BumpPtrAllocator OperandAllocator;
|
|
|
|
|
2008-07-17 19:10:17 +00:00
|
|
|
/// Allocator - Pool allocation for misc. objects that are created once per
|
|
|
|
/// SelectionDAG.
|
|
|
|
BumpPtrAllocator Allocator;
|
|
|
|
|
2010-03-10 22:13:47 +00:00
|
|
|
/// DbgInfo - Tracks dbg_value information through SDISel.
|
|
|
|
SDDbgInfo *DbgInfo;
|
|
|
|
|
2012-04-20 22:08:46 +00:00
|
|
|
public:
|
|
|
|
/// DAGUpdateListener - Clients of various APIs that cause global effects on
|
|
|
|
/// the DAG can optionally implement this interface. This allows the clients
|
|
|
|
/// to handle the various sorts of updates that happen.
|
|
|
|
///
|
|
|
|
/// A DAGUpdateListener automatically registers itself with DAG when it is
|
|
|
|
/// constructed, and removes itself when destroyed in RAII fashion.
|
|
|
|
struct DAGUpdateListener {
|
|
|
|
DAGUpdateListener *const Next;
|
|
|
|
SelectionDAG &DAG;
|
|
|
|
|
|
|
|
explicit DAGUpdateListener(SelectionDAG &D)
|
|
|
|
: Next(D.UpdateListeners), DAG(D) {
|
|
|
|
DAG.UpdateListeners = this;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual ~DAGUpdateListener() {
|
|
|
|
assert(DAG.UpdateListeners == this &&
|
|
|
|
"DAGUpdateListeners must be destroyed in LIFO order");
|
|
|
|
DAG.UpdateListeners = Next;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// NodeDeleted - The node N that was deleted and, if E is not null, an
|
|
|
|
/// equivalent node E that replaced it.
|
|
|
|
virtual void NodeDeleted(SDNode *N, SDNode *E);
|
|
|
|
|
|
|
|
/// NodeUpdated - The node N that was updated.
|
|
|
|
virtual void NodeUpdated(SDNode *N);
|
|
|
|
};
|
|
|
|
|
Fix illegal DAG produced by SelectionDAG::getConstant() for v2i64 type
Summary:
When getConstant() is called for an expanded vector type, it is split into
multiple scalar constants which are then combined using appropriate build_vector
and bitcast operations.
In addition to the usual big/little endian differences, the case where the
element-order of the vector does not have the same endianness as the elements
themselves is also accounted for. For example, for v4i32 on big-endian MIPS,
the byte-order of the vector is <3210,7654,BA98,FEDC>. For little-endian, it is
<0123,4567,89AB,CDEF>.
Handling this case turns out to be a nop since getConstant() returns a splatted
vector (so reversing the element order doesn't change the value)
This fixes a number of cases in MIPS MSA where calling getConstant() during
operation legalization introduces illegal types (e.g. to legalize v2i64 UNDEF
into a v2i64 BUILD_VECTOR of illegal i64 zeros). It should also handle bigger
differences between illegal and legal types such as legalizing v2i64 into v8i16.
lowerMSASplatImm() in the MIPS backend no longer needs to avoid calling
getConstant() so this function has been updated in the same patch.
For the sake of transparency, the steps I've taken since the review are:
* Added 'virtual' to isVectorEltOrderLittleEndian() as requested. This revealed
that the MIPS tests were falsely passing because a polymorphic function was
not actually polymorphic in the reviewed patch.
* Fixed the tests that were now failing. This involved deleting the code to
handle the MIPS MSA element-order (which was previously doing an byte-order
swap instead of an element-order swap). This left
isVectorEltOrderLittleEndian() unused and it was deleted.
* Fixed build failures caused by rebasing beyond r194467-r194472. These build
failures involved the bset, bneg, and bclr instructions added in these commits
using lowerMSASplatImm() in a way that was no longer valid after this patch.
Some of these were fixed by calling SelectionDAG::getConstant() instead,
others were fixed by a new function getBuildVectorSplat() that provided the
removed functionality of lowerMSASplatImm() in a more sensible way.
Reviewers: bkramer
Reviewed By: bkramer
CC: llvm-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1973
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194811 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-15 12:56:49 +00:00
|
|
|
/// NewNodesMustHaveLegalTypes - When true, additional steps are taken to
|
|
|
|
/// ensure that getConstant() and similar functions return DAG nodes that
|
|
|
|
/// have legal types. This is important after type legalization since
|
|
|
|
/// any illegally typed nodes generated after this point will not experience
|
|
|
|
/// type legalization.
|
|
|
|
bool NewNodesMustHaveLegalTypes;
|
|
|
|
|
2012-04-20 22:08:46 +00:00
|
|
|
private:
|
|
|
|
/// DAGUpdateListener is a friend so it can manipulate the listener stack.
|
|
|
|
friend struct DAGUpdateListener;
|
|
|
|
|
|
|
|
/// UpdateListeners - Linked list of registered DAGUpdateListener instances.
|
|
|
|
/// This stack is maintained by DAGUpdateListener RAII.
|
|
|
|
DAGUpdateListener *UpdateListeners;
|
|
|
|
|
2008-10-27 18:17:03 +00:00
|
|
|
/// setGraphColorHelper - Implementation of setSubgraphColor.
|
|
|
|
/// Return whether we had to truncate the search.
|
|
|
|
///
|
2009-03-04 20:36:44 +00:00
|
|
|
bool setSubgraphColorHelper(SDNode *N, const char *Color,
|
|
|
|
DenseSet<SDNode *> &visited,
|
2008-10-27 18:17:03 +00:00
|
|
|
int level, bool &printed);
|
|
|
|
|
2012-09-17 06:59:23 +00:00
|
|
|
void operator=(const SelectionDAG&) LLVM_DELETED_FUNCTION;
|
|
|
|
SelectionDAG(const SelectionDAG&) LLVM_DELETED_FUNCTION;
|
2009-12-16 20:10:05 +00:00
|
|
|
|
2003-08-11 14:56:26 +00:00
|
|
|
public:
|
2011-12-15 18:21:18 +00:00
|
|
|
explicit SelectionDAG(const TargetMachine &TM, llvm::CodeGenOpt::Level);
|
2003-08-11 14:56:26 +00:00
|
|
|
~SelectionDAG();
|
|
|
|
|
2008-08-27 23:52:12 +00:00
|
|
|
/// init - Prepare this SelectionDAG to process code in the given
|
|
|
|
/// MachineFunction.
|
|
|
|
///
|
2014-10-08 01:57:58 +00:00
|
|
|
void init(MachineFunction &mf);
|
2008-08-27 23:52:12 +00:00
|
|
|
|
|
|
|
/// clear - Clear state and free memory necessary to make this
|
2008-08-23 02:25:05 +00:00
|
|
|
/// SelectionDAG ready to process a new block.
|
|
|
|
///
|
2008-08-27 23:52:12 +00:00
|
|
|
void clear();
|
2008-08-23 02:25:05 +00:00
|
|
|
|
2008-08-27 23:52:12 +00:00
|
|
|
MachineFunction &getMachineFunction() const { return *MF; }
|
2010-04-19 19:22:07 +00:00
|
|
|
const TargetMachine &getTarget() const { return TM; }
|
2014-08-05 02:39:49 +00:00
|
|
|
const TargetSubtargetInfo &getSubtarget() const { return MF->getSubtarget(); }
|
2013-11-19 21:20:17 +00:00
|
|
|
const TargetLowering &getTargetLoweringInfo() const { return *TLI; }
|
2014-08-20 21:40:15 +00:00
|
|
|
const TargetSelectionDAGInfo &getSelectionDAGInfo() const { return *TSI; }
|
2009-07-09 17:57:24 +00:00
|
|
|
LLVMContext *getContext() const {return Context; }
|
2003-08-11 14:56:26 +00:00
|
|
|
|
2006-10-02 12:26:53 +00:00
|
|
|
/// viewGraph - Pop up a GraphViz/gv window with the DAG rendered using 'dot'.
|
2005-01-10 23:05:53 +00:00
|
|
|
///
|
2008-07-21 20:00:07 +00:00
|
|
|
void viewGraph(const std::string &Title);
|
2008-07-30 18:48:53 +00:00
|
|
|
void viewGraph();
|
2009-02-17 22:15:04 +00:00
|
|
|
|
2006-10-02 12:26:53 +00:00
|
|
|
#ifndef NDEBUG
|
|
|
|
std::map<const SDNode *, std::string> NodeGraphAttrs;
|
|
|
|
#endif
|
2005-01-10 23:05:53 +00:00
|
|
|
|
2006-10-02 12:26:53 +00:00
|
|
|
/// clearGraphAttrs - Clear all previously defined node graph attributes.
|
|
|
|
/// Intended to be used from a debugging tool (eg. gdb).
|
|
|
|
void clearGraphAttrs();
|
2009-02-17 22:15:04 +00:00
|
|
|
|
2006-10-02 12:26:53 +00:00
|
|
|
/// setGraphAttrs - Set graph attributes for a node. (eg. "color=red".)
|
|
|
|
///
|
|
|
|
void setGraphAttrs(const SDNode *N, const char *Attrs);
|
2009-02-17 22:15:04 +00:00
|
|
|
|
2006-10-02 12:26:53 +00:00
|
|
|
/// getGraphAttrs - Get graph attributes for a node. (eg. "color=red".)
|
|
|
|
/// Used from getNodeAttributes.
|
|
|
|
const std::string getGraphAttrs(const SDNode *N) const;
|
2009-02-17 22:15:04 +00:00
|
|
|
|
2006-10-02 12:26:53 +00:00
|
|
|
/// setGraphColor - Convenience for setting node color attribute.
|
|
|
|
///
|
|
|
|
void setGraphColor(const SDNode *N, const char *Color);
|
2005-01-10 23:05:53 +00:00
|
|
|
|
2008-10-27 18:17:03 +00:00
|
|
|
/// setGraphColor - Convenience for setting subgraph color attribute.
|
|
|
|
///
|
|
|
|
void setSubgraphColor(SDNode *N, const char *Color);
|
|
|
|
|
2008-07-28 21:51:04 +00:00
|
|
|
typedef ilist<SDNode>::const_iterator allnodes_const_iterator;
|
2005-11-09 23:46:43 +00:00
|
|
|
allnodes_const_iterator allnodes_begin() const { return AllNodes.begin(); }
|
|
|
|
allnodes_const_iterator allnodes_end() const { return AllNodes.end(); }
|
2008-07-28 21:51:04 +00:00
|
|
|
typedef ilist<SDNode>::iterator allnodes_iterator;
|
2005-11-09 23:46:43 +00:00
|
|
|
allnodes_iterator allnodes_begin() { return AllNodes.begin(); }
|
|
|
|
allnodes_iterator allnodes_end() { return AllNodes.end(); }
|
2008-07-28 21:51:04 +00:00
|
|
|
ilist<SDNode>::size_type allnodes_size() const {
|
2008-07-07 23:02:41 +00:00
|
|
|
return AllNodes.size();
|
|
|
|
}
|
2009-02-17 22:15:04 +00:00
|
|
|
|
2005-01-07 07:46:32 +00:00
|
|
|
/// getRoot - Return the root tag of the SelectionDAG.
|
2003-08-11 14:56:26 +00:00
|
|
|
///
|
2008-07-27 21:46:04 +00:00
|
|
|
const SDValue &getRoot() const { return Root; }
|
2003-08-11 14:56:26 +00:00
|
|
|
|
2005-01-07 07:46:32 +00:00
|
|
|
/// getEntryNode - Return the token chain corresponding to the entry of the
|
|
|
|
/// function.
|
2008-08-23 02:25:05 +00:00
|
|
|
SDValue getEntryNode() const {
|
|
|
|
return SDValue(const_cast<SDNode *>(&EntryNode), 0);
|
|
|
|
}
|
2003-08-11 14:56:26 +00:00
|
|
|
|
2005-01-07 07:46:32 +00:00
|
|
|
/// setRoot - Set the current root tag of the SelectionDAG.
|
2003-08-11 14:56:26 +00:00
|
|
|
///
|
2008-07-27 21:46:04 +00:00
|
|
|
const SDValue &setRoot(SDValue N) {
|
2009-08-11 20:47:22 +00:00
|
|
|
assert((!N.getNode() || N.getValueType() == MVT::Other) &&
|
2008-07-22 18:04:23 +00:00
|
|
|
"DAG root value is not a chain!");
|
2010-01-20 20:13:31 +00:00
|
|
|
if (N.getNode())
|
2014-05-31 16:23:17 +00:00
|
|
|
checkForCycles(N.getNode(), this);
|
2010-01-20 20:13:31 +00:00
|
|
|
Root = N;
|
|
|
|
if (N.getNode())
|
|
|
|
checkForCycles(this);
|
|
|
|
return Root;
|
2008-07-22 18:04:23 +00:00
|
|
|
}
|
2003-08-11 14:56:26 +00:00
|
|
|
|
2005-09-01 00:19:25 +00:00
|
|
|
/// Combine - This iterates over the nodes in the SelectionDAG, folding
|
2008-11-24 14:53:14 +00:00
|
|
|
/// certain types of nodes together, or eliminating superfluous nodes. The
|
|
|
|
/// Level argument controls whether Combine is allowed to produce nodes and
|
|
|
|
/// types that are illegal on the target.
|
2009-04-29 23:29:43 +00:00
|
|
|
void Combine(CombineLevel Level, AliasAnalysis &AA,
|
|
|
|
CodeGenOpt::Level OptLevel);
|
2008-11-24 14:53:14 +00:00
|
|
|
|
One mundane change: Change ReplaceAllUsesOfValueWith to *optionally*
take a deleted nodes vector, instead of requiring it.
One more significant change: Implement the start of a legalizer that
just works on types. This legalizer is designed to run before the
operation legalizer and ensure just that the input dag is transformed
into an output dag whose operand and result types are all legal, even
if the operations on those types are not.
This design/impl has the following advantages:
1. When finished, this will *significantly* reduce the amount of code in
LegalizeDAG.cpp. It will remove all the code related to promotion and
expansion as well as splitting and scalarizing vectors.
2. The new code is very simple, idiomatic, and modular: unlike
LegalizeDAG.cpp, it has no 3000 line long functions. :)
3. The implementation is completely iterative instead of recursive, good
for hacking on large dags without blowing out your stack.
4. The implementation updates nodes in place when possible instead of
deallocating and reallocating the entire graph that points to some
mutated node.
5. The code nicely separates out handling of operations with invalid
results from operations with invalid operands, making some cases
simpler and easier to understand.
6. The new -debug-only=legalize-types option is very very handy :),
allowing you to easily understand what legalize types is doing.
This is not yet done. Until the ifdef added to SelectionDAGISel.cpp is
enabled, this does nothing. However, this code is sufficient to legalize
all of the code in 186.crafty, olden and freebench on an x86 machine. The
biggest issues are:
1. Vectors aren't implemented at all yet
2. SoftFP is a mess, I need to talk to Evan about it.
3. No lowering to libcalls is implemented yet.
4. Various operations are missing etc.
5. There are FIXME's for stuff I hax0r'd out, like softfp.
Hey, at least it is a step in the right direction :). If you'd like to help,
just enable the #ifdef in SelectionDAGISel.cpp and compile code with it. If
this explodes it will tell you what needs to be implemented. Help is
certainly appreciated.
Once this goes in, we can do three things:
1. Add a new pass of dag combine between the "type legalizer" and "operation
legalizer" passes. This will let us catch some long-standing isel issues
that we miss because operation legalization often obfuscates the dag with
target-specific nodes.
2. We can rip out all of the type legalization code from LegalizeDAG.cpp,
making it much smaller and simpler. When that happens we can then
reimplement the core functionality left in it in a much more efficient and
non-recursive way.
3. Once the whole legalizer is non-recursive, we can implement whole-function
selectiondags maybe...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42981 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-15 06:10:22 +00:00
|
|
|
/// LegalizeTypes - This transforms the SelectionDAG into a SelectionDAG that
|
2008-11-24 14:53:14 +00:00
|
|
|
/// only uses types natively supported by the target. Returns "true" if it
|
|
|
|
/// made any changes.
|
One mundane change: Change ReplaceAllUsesOfValueWith to *optionally*
take a deleted nodes vector, instead of requiring it.
One more significant change: Implement the start of a legalizer that
just works on types. This legalizer is designed to run before the
operation legalizer and ensure just that the input dag is transformed
into an output dag whose operand and result types are all legal, even
if the operations on those types are not.
This design/impl has the following advantages:
1. When finished, this will *significantly* reduce the amount of code in
LegalizeDAG.cpp. It will remove all the code related to promotion and
expansion as well as splitting and scalarizing vectors.
2. The new code is very simple, idiomatic, and modular: unlike
LegalizeDAG.cpp, it has no 3000 line long functions. :)
3. The implementation is completely iterative instead of recursive, good
for hacking on large dags without blowing out your stack.
4. The implementation updates nodes in place when possible instead of
deallocating and reallocating the entire graph that points to some
mutated node.
5. The code nicely separates out handling of operations with invalid
results from operations with invalid operands, making some cases
simpler and easier to understand.
6. The new -debug-only=legalize-types option is very very handy :),
allowing you to easily understand what legalize types is doing.
This is not yet done. Until the ifdef added to SelectionDAGISel.cpp is
enabled, this does nothing. However, this code is sufficient to legalize
all of the code in 186.crafty, olden and freebench on an x86 machine. The
biggest issues are:
1. Vectors aren't implemented at all yet
2. SoftFP is a mess, I need to talk to Evan about it.
3. No lowering to libcalls is implemented yet.
4. Various operations are missing etc.
5. There are FIXME's for stuff I hax0r'd out, like softfp.
Hey, at least it is a step in the right direction :). If you'd like to help,
just enable the #ifdef in SelectionDAGISel.cpp and compile code with it. If
this explodes it will tell you what needs to be implemented. Help is
certainly appreciated.
Once this goes in, we can do three things:
1. Add a new pass of dag combine between the "type legalizer" and "operation
legalizer" passes. This will let us catch some long-standing isel issues
that we miss because operation legalization often obfuscates the dag with
target-specific nodes.
2. We can rip out all of the type legalization code from LegalizeDAG.cpp,
making it much smaller and simpler. When that happens we can then
reimplement the core functionality left in it in a much more efficient and
non-recursive way.
3. Once the whole legalizer is non-recursive, we can implement whole-function
selectiondags maybe...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42981 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-15 06:10:22 +00:00
|
|
|
///
|
|
|
|
/// Note that this is an involved process that may invalidate pointers into
|
|
|
|
/// the graph.
|
2008-11-24 14:53:14 +00:00
|
|
|
bool LegalizeTypes();
|
|
|
|
|
2005-01-07 07:46:32 +00:00
|
|
|
/// Legalize - This transforms the SelectionDAG into a SelectionDAG that is
|
|
|
|
/// compatible with the target instruction selector, as indicated by the
|
|
|
|
/// TargetLowering object.
|
2003-08-11 14:56:26 +00:00
|
|
|
///
|
2005-01-07 07:46:32 +00:00
|
|
|
/// Note that this is an involved process that may invalidate pointers into
|
|
|
|
/// the graph.
|
2011-05-16 22:19:54 +00:00
|
|
|
void Legalize();
|
2005-01-07 07:46:32 +00:00
|
|
|
|
2014-07-26 05:49:40 +00:00
|
|
|
/// \brief Transforms a SelectionDAG node and any operands to it into a node
|
|
|
|
/// that is compatible with the target instruction selector, as indicated by
|
|
|
|
/// the TargetLowering object.
|
|
|
|
///
|
|
|
|
/// \returns true if \c N is a valid, legal node after calling this.
|
|
|
|
///
|
|
|
|
/// This essentially runs a single recursive walk of the \c Legalize process
|
|
|
|
/// over the given node (and its operands). This can be used to incrementally
|
|
|
|
/// legalize the DAG. All of the nodes which are directly replaced,
|
|
|
|
/// potentially including N, are added to the output parameter \c
|
|
|
|
/// UpdatedNodes so that the delta to the DAG can be understood by the
|
|
|
|
/// caller.
|
|
|
|
///
|
|
|
|
/// When this returns false, N has been legalized in a way that make the
|
|
|
|
/// pointer passed in no longer valid. It may have even been deleted from the
|
|
|
|
/// DAG, and so it shouldn't be used further. When this returns true, the
|
|
|
|
/// N passed in is a legal node, and can be immediately processed as such.
|
|
|
|
/// This may still have done some work on the DAG, and will still populate
|
|
|
|
/// UpdatedNodes with any new nodes replacing those originally in the DAG.
|
|
|
|
bool LegalizeOp(SDNode *N, SmallSetVector<SDNode *, 16> &UpdatedNodes);
|
|
|
|
|
2009-05-23 12:35:30 +00:00
|
|
|
/// LegalizeVectors - This transforms the SelectionDAG into a SelectionDAG
|
|
|
|
/// that only uses vector math operations supported by the target. This is
|
|
|
|
/// necessary as a separate step from Legalize because unrolling a vector
|
|
|
|
/// operation can introduce illegal types, which requires running
|
|
|
|
/// LegalizeTypes again.
|
|
|
|
///
|
|
|
|
/// This returns true if it made any changes; in that case, LegalizeTypes
|
|
|
|
/// is called again before Legalize.
|
|
|
|
///
|
|
|
|
/// Note that this is an involved process that may invalidate pointers into
|
|
|
|
/// the graph.
|
|
|
|
bool LegalizeVectors();
|
|
|
|
|
2005-01-07 21:08:55 +00:00
|
|
|
/// RemoveDeadNodes - This method deletes all unreachable nodes in the
|
2006-08-04 17:45:20 +00:00
|
|
|
/// SelectionDAG.
|
|
|
|
void RemoveDeadNodes();
|
2006-10-12 20:34:05 +00:00
|
|
|
|
|
|
|
/// DeleteNode - Remove the specified node from the system. This node must
|
|
|
|
/// have no referrers.
|
|
|
|
void DeleteNode(SDNode *N);
|
|
|
|
|
2006-08-15 17:46:01 +00:00
|
|
|
/// getVTList - Return an SDVTList that represents the list of values
|
|
|
|
/// specified.
|
2009-08-10 22:56:29 +00:00
|
|
|
SDVTList getVTList(EVT VT);
|
|
|
|
SDVTList getVTList(EVT VT1, EVT VT2);
|
|
|
|
SDVTList getVTList(EVT VT1, EVT VT2, EVT VT3);
|
|
|
|
SDVTList getVTList(EVT VT1, EVT VT2, EVT VT3, EVT VT4);
|
2014-04-16 06:10:51 +00:00
|
|
|
SDVTList getVTList(ArrayRef<EVT> VTs);
|
2009-02-17 22:15:04 +00:00
|
|
|
|
2006-08-30 05:56:52 +00:00
|
|
|
//===--------------------------------------------------------------------===//
|
2006-08-15 17:46:01 +00:00
|
|
|
// Node creation methods.
|
|
|
|
//
|
2014-01-25 02:02:55 +00:00
|
|
|
SDValue getConstant(uint64_t Val, EVT VT, bool isTarget = false,
|
|
|
|
bool isOpaque = false);
|
|
|
|
SDValue getConstant(const APInt &Val, EVT VT, bool isTarget = false,
|
|
|
|
bool isOpaque = false);
|
|
|
|
SDValue getConstant(const ConstantInt &Val, EVT VT, bool isTarget = false,
|
|
|
|
bool isOpaque = false);
|
2008-07-27 21:46:04 +00:00
|
|
|
SDValue getIntPtrConstant(uint64_t Val, bool isTarget = false);
|
2014-01-25 02:02:55 +00:00
|
|
|
SDValue getTargetConstant(uint64_t Val, EVT VT, bool isOpaque = false) {
|
|
|
|
return getConstant(Val, VT, true, isOpaque);
|
2006-08-11 21:00:46 +00:00
|
|
|
}
|
2014-01-25 02:02:55 +00:00
|
|
|
SDValue getTargetConstant(const APInt &Val, EVT VT, bool isOpaque = false) {
|
|
|
|
return getConstant(Val, VT, true, isOpaque);
|
2008-02-08 22:59:30 +00:00
|
|
|
}
|
2014-01-25 02:02:55 +00:00
|
|
|
SDValue getTargetConstant(const ConstantInt &Val, EVT VT,
|
|
|
|
bool isOpaque = false) {
|
|
|
|
return getConstant(Val, VT, true, isOpaque);
|
2008-09-12 18:08:03 +00:00
|
|
|
}
|
2010-05-07 21:35:53 +00:00
|
|
|
// The forms below that take a double should only be used for simple
|
|
|
|
// constants that can be exactly represented in VT. No checks are made.
|
2009-08-10 22:56:29 +00:00
|
|
|
SDValue getConstantFP(double Val, EVT VT, bool isTarget = false);
|
|
|
|
SDValue getConstantFP(const APFloat& Val, EVT VT, bool isTarget = false);
|
|
|
|
SDValue getConstantFP(const ConstantFP &CF, EVT VT, bool isTarget = false);
|
|
|
|
SDValue getTargetConstantFP(double Val, EVT VT) {
|
2006-08-11 21:55:30 +00:00
|
|
|
return getConstantFP(Val, VT, true);
|
|
|
|
}
|
2009-08-10 22:56:29 +00:00
|
|
|
SDValue getTargetConstantFP(const APFloat& Val, EVT VT) {
|
2007-08-30 00:23:21 +00:00
|
|
|
return getConstantFP(Val, VT, true);
|
|
|
|
}
|
2009-08-10 22:56:29 +00:00
|
|
|
SDValue getTargetConstantFP(const ConstantFP &Val, EVT VT) {
|
2008-09-12 18:08:03 +00:00
|
|
|
return getConstantFP(Val, VT, true);
|
|
|
|
}
|
2013-05-25 02:42:55 +00:00
|
|
|
SDValue getGlobalAddress(const GlobalValue *GV, SDLoc DL, EVT VT,
|
2009-06-25 21:21:14 +00:00
|
|
|
int64_t offset = 0, bool isTargetGA = false,
|
|
|
|
unsigned char TargetFlags = 0);
|
2013-05-25 02:42:55 +00:00
|
|
|
SDValue getTargetGlobalAddress(const GlobalValue *GV, SDLoc DL, EVT VT,
|
2009-06-25 21:21:14 +00:00
|
|
|
int64_t offset = 0,
|
|
|
|
unsigned char TargetFlags = 0) {
|
2010-07-06 22:08:15 +00:00
|
|
|
return getGlobalAddress(GV, DL, VT, offset, true, TargetFlags);
|
2006-08-11 21:00:46 +00:00
|
|
|
}
|
2009-08-10 22:56:29 +00:00
|
|
|
SDValue getFrameIndex(int FI, EVT VT, bool isTarget = false);
|
|
|
|
SDValue getTargetFrameIndex(int FI, EVT VT) {
|
2006-08-11 21:55:30 +00:00
|
|
|
return getFrameIndex(FI, VT, true);
|
|
|
|
}
|
2009-08-10 22:56:29 +00:00
|
|
|
SDValue getJumpTable(int JTI, EVT VT, bool isTarget = false,
|
2009-06-25 21:35:31 +00:00
|
|
|
unsigned char TargetFlags = 0);
|
2009-08-10 22:56:29 +00:00
|
|
|
SDValue getTargetJumpTable(int JTI, EVT VT, unsigned char TargetFlags = 0) {
|
2009-06-25 21:35:31 +00:00
|
|
|
return getJumpTable(JTI, VT, true, TargetFlags);
|
2006-08-11 21:55:30 +00:00
|
|
|
}
|
2010-04-15 01:51:59 +00:00
|
|
|
SDValue getConstantPool(const Constant *C, EVT VT,
|
2009-06-25 21:35:31 +00:00
|
|
|
unsigned Align = 0, int Offs = 0, bool isT=false,
|
|
|
|
unsigned char TargetFlags = 0);
|
2010-04-15 01:51:59 +00:00
|
|
|
SDValue getTargetConstantPool(const Constant *C, EVT VT,
|
2009-06-25 21:35:31 +00:00
|
|
|
unsigned Align = 0, int Offset = 0,
|
|
|
|
unsigned char TargetFlags = 0) {
|
|
|
|
return getConstantPool(C, VT, Align, Offset, true, TargetFlags);
|
2006-08-11 21:55:30 +00:00
|
|
|
}
|
2009-08-10 22:56:29 +00:00
|
|
|
SDValue getConstantPool(MachineConstantPoolValue *C, EVT VT,
|
2009-06-25 21:35:31 +00:00
|
|
|
unsigned Align = 0, int Offs = 0, bool isT=false,
|
|
|
|
unsigned char TargetFlags = 0);
|
2008-07-27 21:46:04 +00:00
|
|
|
SDValue getTargetConstantPool(MachineConstantPoolValue *C,
|
2009-08-10 22:56:29 +00:00
|
|
|
EVT VT, unsigned Align = 0,
|
2009-06-25 21:35:31 +00:00
|
|
|
int Offset = 0, unsigned char TargetFlags=0) {
|
|
|
|
return getConstantPool(C, VT, Align, Offset, true, TargetFlags);
|
2006-09-12 21:00:35 +00:00
|
|
|
}
|
2012-08-07 22:37:05 +00:00
|
|
|
SDValue getTargetIndex(int Index, EVT VT, int64_t Offset = 0,
|
|
|
|
unsigned char TargetFlags = 0);
|
2009-02-04 01:17:06 +00:00
|
|
|
// When generating a branch to a BB, we don't in general know enough
|
|
|
|
// to provide debug info for the BB at that time, so keep this one around.
|
2008-07-27 21:46:04 +00:00
|
|
|
SDValue getBasicBlock(MachineBasicBlock *MBB);
|
2013-05-25 02:42:55 +00:00
|
|
|
SDValue getBasicBlock(MachineBasicBlock *MBB, SDLoc dl);
|
2009-08-10 22:56:29 +00:00
|
|
|
SDValue getExternalSymbol(const char *Sym, EVT VT);
|
2013-05-25 02:42:55 +00:00
|
|
|
SDValue getExternalSymbol(const char *Sym, SDLoc dl, EVT VT);
|
2009-08-10 22:56:29 +00:00
|
|
|
SDValue getTargetExternalSymbol(const char *Sym, EVT VT,
|
2009-06-25 18:45:50 +00:00
|
|
|
unsigned char TargetFlags = 0);
|
2009-08-10 22:56:29 +00:00
|
|
|
SDValue getValueType(EVT);
|
|
|
|
SDValue getRegister(unsigned Reg, EVT VT);
|
2012-01-18 23:52:12 +00:00
|
|
|
SDValue getRegisterMask(const uint32_t *RegMask);
|
2013-05-25 02:42:55 +00:00
|
|
|
SDValue getEHLabel(SDLoc dl, SDValue Root, MCSymbol *Label);
|
2010-04-15 01:51:59 +00:00
|
|
|
SDValue getBlockAddress(const BlockAddress *BA, EVT VT,
|
2012-09-12 21:43:09 +00:00
|
|
|
int64_t Offset = 0, bool isTarget = false,
|
|
|
|
unsigned char TargetFlags = 0);
|
|
|
|
SDValue getTargetBlockAddress(const BlockAddress *BA, EVT VT,
|
|
|
|
int64_t Offset = 0,
|
|
|
|
unsigned char TargetFlags = 0) {
|
|
|
|
return getBlockAddress(BA, VT, Offset, true, TargetFlags);
|
|
|
|
}
|
2005-01-07 07:46:32 +00:00
|
|
|
|
2013-05-25 02:42:55 +00:00
|
|
|
SDValue getCopyToReg(SDValue Chain, SDLoc dl, unsigned Reg, SDValue N) {
|
2009-08-11 20:47:22 +00:00
|
|
|
return getNode(ISD::CopyToReg, dl, MVT::Other, Chain,
|
2009-02-03 22:26:09 +00:00
|
|
|
getRegister(Reg, N.getValueType()), N);
|
|
|
|
}
|
2003-08-11 14:56:26 +00:00
|
|
|
|
2005-08-30 01:56:13 +00:00
|
|
|
// This version of the getCopyToReg method takes an extra operand, which
|
2010-12-23 17:24:32 +00:00
|
|
|
// indicates that there is potentially an incoming glue value (if Glue is not
|
|
|
|
// null) and that there should be a glue result.
|
2013-05-25 02:42:55 +00:00
|
|
|
SDValue getCopyToReg(SDValue Chain, SDLoc dl, unsigned Reg, SDValue N,
|
2010-12-23 17:24:32 +00:00
|
|
|
SDValue Glue) {
|
2010-12-21 02:38:05 +00:00
|
|
|
SDVTList VTs = getVTList(MVT::Other, MVT::Glue);
|
2010-12-23 17:24:32 +00:00
|
|
|
SDValue Ops[] = { Chain, getRegister(Reg, N.getValueType()), N, Glue };
|
2014-04-26 18:35:24 +00:00
|
|
|
return getNode(ISD::CopyToReg, dl, VTs,
|
|
|
|
ArrayRef<SDValue>(Ops, Glue.getNode() ? 4 : 3));
|
2009-02-03 22:26:09 +00:00
|
|
|
}
|
Teach tblgen to accept register source operands in patterns, e.g.
def SHL8rCL : I<0xD2, MRM4r, (ops R8 :$dst, R8 :$src),
"shl{b} {%cl, $dst|$dst, %CL}",
[(set R8:$dst, (shl R8:$src, CL))]>, Imp<[CL],[]>;
This generates a CopyToReg operand and added its 2nd result to the shl as
a flag operand.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24557 91177308-0d34-0410-b5e6-96231b3b80d8
2005-12-01 00:18:45 +00:00
|
|
|
|
2008-07-27 21:46:04 +00:00
|
|
|
// Similar to last getCopyToReg() except parameter Reg is a SDValue
|
2013-05-25 02:42:55 +00:00
|
|
|
SDValue getCopyToReg(SDValue Chain, SDLoc dl, SDValue Reg, SDValue N,
|
2010-12-23 17:24:32 +00:00
|
|
|
SDValue Glue) {
|
2010-12-21 02:38:05 +00:00
|
|
|
SDVTList VTs = getVTList(MVT::Other, MVT::Glue);
|
2010-12-23 17:24:32 +00:00
|
|
|
SDValue Ops[] = { Chain, Reg, N, Glue };
|
2014-04-26 18:35:24 +00:00
|
|
|
return getNode(ISD::CopyToReg, dl, VTs,
|
|
|
|
ArrayRef<SDValue>(Ops, Glue.getNode() ? 4 : 3));
|
2009-02-03 22:26:09 +00:00
|
|
|
}
|
2009-02-17 22:15:04 +00:00
|
|
|
|
2013-05-25 02:42:55 +00:00
|
|
|
SDValue getCopyFromReg(SDValue Chain, SDLoc dl, unsigned Reg, EVT VT) {
|
2009-08-11 20:47:22 +00:00
|
|
|
SDVTList VTs = getVTList(VT, MVT::Other);
|
2009-02-03 22:26:09 +00:00
|
|
|
SDValue Ops[] = { Chain, getRegister(Reg, VT) };
|
2014-04-26 18:35:24 +00:00
|
|
|
return getNode(ISD::CopyFromReg, dl, VTs, Ops);
|
2009-02-03 22:26:09 +00:00
|
|
|
}
|
2009-02-17 22:15:04 +00:00
|
|
|
|
2005-08-30 01:56:13 +00:00
|
|
|
// This version of the getCopyFromReg method takes an extra operand, which
|
2010-12-23 17:24:32 +00:00
|
|
|
// indicates that there is potentially an incoming glue value (if Glue is not
|
|
|
|
// null) and that there should be a glue result.
|
2013-05-25 02:42:55 +00:00
|
|
|
SDValue getCopyFromReg(SDValue Chain, SDLoc dl, unsigned Reg, EVT VT,
|
2010-12-23 17:24:32 +00:00
|
|
|
SDValue Glue) {
|
2010-12-21 02:38:05 +00:00
|
|
|
SDVTList VTs = getVTList(VT, MVT::Other, MVT::Glue);
|
2010-12-23 17:24:32 +00:00
|
|
|
SDValue Ops[] = { Chain, getRegister(Reg, VT), Glue };
|
2014-04-26 18:35:24 +00:00
|
|
|
return getNode(ISD::CopyFromReg, dl, VTs,
|
|
|
|
ArrayRef<SDValue>(Ops, Glue.getNode() ? 3 : 2));
|
2009-02-03 22:26:09 +00:00
|
|
|
}
|
2005-01-13 20:50:02 +00:00
|
|
|
|
2008-07-27 21:46:04 +00:00
|
|
|
SDValue getCondCode(ISD::CondCode Cond);
|
2003-08-11 14:56:26 +00:00
|
|
|
|
2008-11-10 20:54:11 +00:00
|
|
|
/// Returns the ConvertRndSat Note: Avoid using this node because it may
|
|
|
|
/// disappear in the future and most targets don't support it.
|
2013-05-25 02:42:55 +00:00
|
|
|
SDValue getConvertRndSat(EVT VT, SDLoc dl, SDValue Val, SDValue DTy,
|
2009-02-03 22:26:09 +00:00
|
|
|
SDValue STy,
|
|
|
|
SDValue Rnd, SDValue Sat, ISD::CvtCode Code);
|
2011-03-07 18:29:47 +00:00
|
|
|
|
2009-04-27 18:41:29 +00:00
|
|
|
/// getVectorShuffle - Return an ISD::VECTOR_SHUFFLE node. The number of
|
|
|
|
/// elements in VT, which must be a vector type, must match the number of
|
2009-04-29 05:20:52 +00:00
|
|
|
/// mask elements NumElts. A integer mask element equal to -1 is treated as
|
2009-04-27 18:41:29 +00:00
|
|
|
/// undefined.
|
2013-05-25 02:42:55 +00:00
|
|
|
SDValue getVectorShuffle(EVT VT, SDLoc dl, SDValue N1, SDValue N2,
|
2009-04-27 18:41:29 +00:00
|
|
|
const int *MaskElts);
|
2014-05-30 03:50:06 +00:00
|
|
|
SDValue getVectorShuffle(EVT VT, SDLoc dl, SDValue N1, SDValue N2,
|
|
|
|
ArrayRef<int> MaskElts) {
|
|
|
|
assert(VT.getVectorNumElements() == MaskElts.size() &&
|
|
|
|
"Must have the same number of vector elements as mask elements!");
|
|
|
|
return getVectorShuffle(VT, dl, N1, N2, MaskElts.data());
|
|
|
|
}
|
2008-11-10 20:54:11 +00:00
|
|
|
|
2014-07-21 07:28:51 +00:00
|
|
|
/// \brief Returns an ISD::VECTOR_SHUFFLE node semantically equivalent to
|
|
|
|
/// the shuffle node in input but with swapped operands.
|
|
|
|
///
|
|
|
|
/// Example: shuffle A, B, <0,5,2,7> -> shuffle B, A, <4,1,6,3>
|
|
|
|
SDValue getCommutedVectorShuffle(const ShuffleVectorSDNode &SV);
|
|
|
|
|
2011-09-27 11:16:47 +00:00
|
|
|
/// getAnyExtOrTrunc - Convert Op, which must be of integer type, to the
|
|
|
|
/// integer type VT, by either any-extending or truncating it.
|
2013-05-25 02:42:55 +00:00
|
|
|
SDValue getAnyExtOrTrunc(SDValue Op, SDLoc DL, EVT VT);
|
2011-09-27 11:16:47 +00:00
|
|
|
|
2009-10-13 21:04:12 +00:00
|
|
|
/// getSExtOrTrunc - Convert Op, which must be of integer type, to the
|
|
|
|
/// integer type VT, by either sign-extending or truncating it.
|
2013-05-25 02:42:55 +00:00
|
|
|
SDValue getSExtOrTrunc(SDValue Op, SDLoc DL, EVT VT);
|
2009-10-13 21:04:12 +00:00
|
|
|
|
|
|
|
/// getZExtOrTrunc - Convert Op, which must be of integer type, to the
|
|
|
|
/// integer type VT, by either zero-extending or truncating it.
|
2013-05-25 02:42:55 +00:00
|
|
|
SDValue getZExtOrTrunc(SDValue Op, SDLoc DL, EVT VT);
|
2009-10-13 21:04:12 +00:00
|
|
|
|
2005-04-13 02:37:19 +00:00
|
|
|
/// getZeroExtendInReg - Return the expression required to zero extend the Op
|
|
|
|
/// value assuming it was the smaller SrcTy value.
|
2013-05-25 02:42:55 +00:00
|
|
|
SDValue getZeroExtendInReg(SDValue Op, SDLoc DL, EVT SrcTy);
|
2009-02-17 22:15:04 +00:00
|
|
|
|
2014-07-10 12:32:32 +00:00
|
|
|
/// getAnyExtendVectorInReg - Return an operation which will any-extend the
|
|
|
|
/// low lanes of the operand into the specified vector type. For example,
|
|
|
|
/// this can convert a v16i8 into a v4i32 by any-extending the low four
|
|
|
|
/// lanes of the operand from i8 to i32.
|
|
|
|
SDValue getAnyExtendVectorInReg(SDValue Op, SDLoc DL, EVT VT);
|
|
|
|
|
|
|
|
/// getSignExtendVectorInReg - Return an operation which will sign extend the
|
|
|
|
/// low lanes of the operand into the specified vector type. For example,
|
|
|
|
/// this can convert a v16i8 into a v4i32 by sign extending the low four
|
|
|
|
/// lanes of the operand from i8 to i32.
|
|
|
|
SDValue getSignExtendVectorInReg(SDValue Op, SDLoc DL, EVT VT);
|
|
|
|
|
2014-07-09 10:58:18 +00:00
|
|
|
/// getZeroExtendVectorInReg - Return an operation which will zero extend the
|
|
|
|
/// low lanes of the operand into the specified vector type. For example,
|
|
|
|
/// this can convert a v16i8 into a v4i32 by zero extending the low four
|
|
|
|
/// lanes of the operand from i8 to i32.
|
|
|
|
SDValue getZeroExtendVectorInReg(SDValue Op, SDLoc DL, EVT VT);
|
|
|
|
|
2014-05-07 18:26:58 +00:00
|
|
|
/// getBoolExtOrTrunc - Convert Op, which must be of integer type, to the
|
|
|
|
/// integer type VT, by using an extension appropriate for the target's
|
2014-07-10 10:18:12 +00:00
|
|
|
/// BooleanContent for type OpVT or truncating it.
|
|
|
|
SDValue getBoolExtOrTrunc(SDValue Op, SDLoc SL, EVT VT, EVT OpVT);
|
2014-05-07 18:26:58 +00:00
|
|
|
|
2009-01-22 17:39:32 +00:00
|
|
|
/// getNOT - Create a bitwise NOT operation as (XOR Val, -1).
|
2013-05-25 02:42:55 +00:00
|
|
|
SDValue getNOT(SDLoc DL, SDValue Val, EVT VT);
|
2009-01-22 17:39:32 +00:00
|
|
|
|
2014-05-12 23:26:58 +00:00
|
|
|
/// \brief Create a logical NOT operation as (XOR Val, BooleanOne).
|
|
|
|
SDValue getLogicalNOT(SDLoc DL, SDValue Val, EVT VT);
|
|
|
|
|
2006-02-13 08:54:46 +00:00
|
|
|
/// getCALLSEQ_START - Return a new CALLSEQ_START node, which always must have
|
2010-12-23 17:24:32 +00:00
|
|
|
/// a glue result (to ensure it's not CSE'd). CALLSEQ_START does not have a
|
2013-05-25 02:42:55 +00:00
|
|
|
/// useful SDLoc.
|
2013-05-29 22:03:55 +00:00
|
|
|
SDValue getCALLSEQ_START(SDValue Chain, SDValue Op, SDLoc DL) {
|
2010-12-21 02:38:05 +00:00
|
|
|
SDVTList VTs = getVTList(MVT::Other, MVT::Glue);
|
2008-07-27 21:46:04 +00:00
|
|
|
SDValue Ops[] = { Chain, Op };
|
2014-04-26 18:35:24 +00:00
|
|
|
return getNode(ISD::CALLSEQ_START, DL, VTs, Ops);
|
2006-02-13 08:54:46 +00:00
|
|
|
}
|
2005-04-13 02:37:19 +00:00
|
|
|
|
2007-11-13 00:44:25 +00:00
|
|
|
/// getCALLSEQ_END - Return a new CALLSEQ_END node, which always must have a
|
2010-12-23 17:24:32 +00:00
|
|
|
/// glue result (to ensure it's not CSE'd). CALLSEQ_END does not have
|
2013-05-25 02:42:55 +00:00
|
|
|
/// a useful SDLoc.
|
2008-07-27 21:46:04 +00:00
|
|
|
SDValue getCALLSEQ_END(SDValue Chain, SDValue Op1, SDValue Op2,
|
2013-05-29 22:03:55 +00:00
|
|
|
SDValue InGlue, SDLoc DL) {
|
2010-12-21 02:38:05 +00:00
|
|
|
SDVTList NodeTys = getVTList(MVT::Other, MVT::Glue);
|
2008-07-27 21:46:04 +00:00
|
|
|
SmallVector<SDValue, 4> Ops;
|
2007-11-13 00:44:25 +00:00
|
|
|
Ops.push_back(Chain);
|
|
|
|
Ops.push_back(Op1);
|
|
|
|
Ops.push_back(Op2);
|
2014-04-26 18:35:24 +00:00
|
|
|
if (InGlue.getNode())
|
|
|
|
Ops.push_back(InGlue);
|
|
|
|
return getNode(ISD::CALLSEQ_END, DL, NodeTys, Ops);
|
2007-11-13 00:44:25 +00:00
|
|
|
}
|
|
|
|
|
2013-05-25 02:42:55 +00:00
|
|
|
/// getUNDEF - Return an UNDEF node. UNDEF does not have a useful SDLoc.
|
2009-08-10 22:56:29 +00:00
|
|
|
SDValue getUNDEF(EVT VT) {
|
2013-05-25 02:42:55 +00:00
|
|
|
return getNode(ISD::UNDEF, SDLoc(), VT);
|
2009-02-06 23:05:02 +00:00
|
|
|
}
|
|
|
|
|
2009-02-07 00:55:49 +00:00
|
|
|
/// getGLOBAL_OFFSET_TABLE - Return a GLOBAL_OFFSET_TABLE node. This does
|
2013-05-25 02:42:55 +00:00
|
|
|
/// not have a useful SDLoc.
|
2009-08-10 22:56:29 +00:00
|
|
|
SDValue getGLOBAL_OFFSET_TABLE(EVT VT) {
|
2013-05-25 02:42:55 +00:00
|
|
|
return getNode(ISD::GLOBAL_OFFSET_TABLE, SDLoc(), VT);
|
2009-02-07 00:55:49 +00:00
|
|
|
}
|
|
|
|
|
2005-01-07 07:46:32 +00:00
|
|
|
/// getNode - Gets or creates the specified node.
|
2003-08-11 14:56:26 +00:00
|
|
|
///
|
2013-05-25 02:42:55 +00:00
|
|
|
SDValue getNode(unsigned Opcode, SDLoc DL, EVT VT);
|
|
|
|
SDValue getNode(unsigned Opcode, SDLoc DL, EVT VT, SDValue N);
|
2014-06-09 12:32:53 +00:00
|
|
|
SDValue getNode(unsigned Opcode, SDLoc DL, EVT VT, SDValue N1, SDValue N2,
|
|
|
|
bool nuw = false, bool nsw = false, bool exact = false);
|
|
|
|
SDValue getNode(unsigned Opcode, SDLoc DL, EVT VT, SDValue N1, SDValue N2,
|
|
|
|
SDValue N3);
|
|
|
|
SDValue getNode(unsigned Opcode, SDLoc DL, EVT VT, SDValue N1, SDValue N2,
|
|
|
|
SDValue N3, SDValue N4);
|
|
|
|
SDValue getNode(unsigned Opcode, SDLoc DL, EVT VT, SDValue N1, SDValue N2,
|
|
|
|
SDValue N3, SDValue N4, SDValue N5);
|
2014-04-27 19:21:06 +00:00
|
|
|
SDValue getNode(unsigned Opcode, SDLoc DL, EVT VT, ArrayRef<SDUse> Ops);
|
2013-05-25 02:42:55 +00:00
|
|
|
SDValue getNode(unsigned Opcode, SDLoc DL, EVT VT,
|
2014-04-26 18:35:24 +00:00
|
|
|
ArrayRef<SDValue> Ops);
|
2013-05-25 02:42:55 +00:00
|
|
|
SDValue getNode(unsigned Opcode, SDLoc DL,
|
2013-03-07 20:33:29 +00:00
|
|
|
ArrayRef<EVT> ResultTys,
|
2014-04-26 18:35:24 +00:00
|
|
|
ArrayRef<SDValue> Ops);
|
2013-05-25 02:42:55 +00:00
|
|
|
SDValue getNode(unsigned Opcode, SDLoc DL, SDVTList VTs,
|
2014-04-26 18:35:24 +00:00
|
|
|
ArrayRef<SDValue> Ops);
|
2013-05-25 02:42:55 +00:00
|
|
|
SDValue getNode(unsigned Opcode, SDLoc DL, SDVTList VTs);
|
|
|
|
SDValue getNode(unsigned Opcode, SDLoc DL, SDVTList VTs, SDValue N);
|
|
|
|
SDValue getNode(unsigned Opcode, SDLoc DL, SDVTList VTs,
|
2009-01-28 22:17:52 +00:00
|
|
|
SDValue N1, SDValue N2);
|
2013-05-25 02:42:55 +00:00
|
|
|
SDValue getNode(unsigned Opcode, SDLoc DL, SDVTList VTs,
|
2009-01-28 22:17:52 +00:00
|
|
|
SDValue N1, SDValue N2, SDValue N3);
|
2013-05-25 02:42:55 +00:00
|
|
|
SDValue getNode(unsigned Opcode, SDLoc DL, SDVTList VTs,
|
2009-01-28 22:17:52 +00:00
|
|
|
SDValue N1, SDValue N2, SDValue N3, SDValue N4);
|
2013-05-25 02:42:55 +00:00
|
|
|
SDValue getNode(unsigned Opcode, SDLoc DL, SDVTList VTs,
|
2009-01-28 22:17:52 +00:00
|
|
|
SDValue N1, SDValue N2, SDValue N3, SDValue N4,
|
|
|
|
SDValue N5);
|
2008-07-27 21:46:04 +00:00
|
|
|
|
Major calling convention code refactoring.
Instead of awkwardly encoding calling-convention information with ISD::CALL,
ISD::FORMAL_ARGUMENTS, ISD::RET, and ISD::ARG_FLAGS nodes, TargetLowering
provides three virtual functions for targets to override:
LowerFormalArguments, LowerCall, and LowerRet, which replace the custom
lowering done on the special nodes. They provide the same information, but
in a more immediately usable format.
This also reworks much of the target-independent tail call logic. The
decision of whether or not to perform a tail call is now cleanly split
between target-independent portions, and the target dependent portion
in IsEligibleForTailCallOptimization.
This also synchronizes all in-tree targets, to help enable future
refactoring and feature work.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78142 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-05 01:29:28 +00:00
|
|
|
/// getStackArgumentTokenFactor - Compute a TokenFactor to force all
|
|
|
|
/// the incoming stack arguments to be loaded from the stack. This is
|
|
|
|
/// used in tail call lowering to protect stack arguments from being
|
|
|
|
/// clobbered.
|
|
|
|
SDValue getStackArgumentTokenFactor(SDValue Chain);
|
|
|
|
|
2013-05-25 02:42:55 +00:00
|
|
|
SDValue getMemcpy(SDValue Chain, SDLoc dl, SDValue Dst, SDValue Src,
|
Reapply address space patch after fixing an issue in MemCopyOptimizer.
Added support for address spaces and added a isVolatile field to memcpy, memmove, and memset,
e.g., llvm.memcpy.i32(i8*, i8*, i32, i32) -> llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100304 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-04 03:10:48 +00:00
|
|
|
SDValue Size, unsigned Align, bool isVol, bool AlwaysInline,
|
2010-09-21 05:40:29 +00:00
|
|
|
MachinePointerInfo DstPtrInfo,
|
|
|
|
MachinePointerInfo SrcPtrInfo);
|
2007-10-19 10:41:11 +00:00
|
|
|
|
2013-05-25 02:42:55 +00:00
|
|
|
SDValue getMemmove(SDValue Chain, SDLoc dl, SDValue Dst, SDValue Src,
|
Reapply address space patch after fixing an issue in MemCopyOptimizer.
Added support for address spaces and added a isVolatile field to memcpy, memmove, and memset,
e.g., llvm.memcpy.i32(i8*, i8*, i32, i32) -> llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100304 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-04 03:10:48 +00:00
|
|
|
SDValue Size, unsigned Align, bool isVol,
|
2010-09-21 05:40:29 +00:00
|
|
|
MachinePointerInfo DstPtrInfo,
|
|
|
|
MachinePointerInfo SrcPtrInfo);
|
2007-10-19 10:41:11 +00:00
|
|
|
|
2013-05-25 02:42:55 +00:00
|
|
|
SDValue getMemset(SDValue Chain, SDLoc dl, SDValue Dst, SDValue Src,
|
Reapply address space patch after fixing an issue in MemCopyOptimizer.
Added support for address spaces and added a isVolatile field to memcpy, memmove, and memset,
e.g., llvm.memcpy.i32(i8*, i8*, i32, i32) -> llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100304 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-04 03:10:48 +00:00
|
|
|
SDValue Size, unsigned Align, bool isVol,
|
2010-09-21 05:40:29 +00:00
|
|
|
MachinePointerInfo DstPtrInfo);
|
2007-10-19 10:41:11 +00:00
|
|
|
|
2005-08-09 20:20:18 +00:00
|
|
|
/// getSetCC - Helper function to make it easier to build SetCC's if you just
|
2008-07-27 21:46:04 +00:00
|
|
|
/// have an ISD::CondCode instead of an SDValue.
|
2005-08-09 20:20:18 +00:00
|
|
|
///
|
2013-05-25 02:42:55 +00:00
|
|
|
SDValue getSetCC(SDLoc DL, EVT VT, SDValue LHS, SDValue RHS,
|
2009-01-30 02:23:43 +00:00
|
|
|
ISD::CondCode Cond) {
|
2011-09-06 19:07:46 +00:00
|
|
|
assert(LHS.getValueType().isVector() == RHS.getValueType().isVector() &&
|
|
|
|
"Cannot compare scalars to vectors");
|
|
|
|
assert(LHS.getValueType().isVector() == VT.isVector() &&
|
|
|
|
"Cannot compare scalars to vectors");
|
2013-06-14 22:04:32 +00:00
|
|
|
assert(Cond != ISD::SETCC_INVALID &&
|
|
|
|
"Cannot create a setCC of an invalid node.");
|
2009-01-30 02:23:43 +00:00
|
|
|
return getNode(ISD::SETCC, DL, VT, LHS, RHS, getCondCode(Cond));
|
2005-08-09 20:20:18 +00:00
|
|
|
}
|
2005-08-10 20:51:12 +00:00
|
|
|
|
2013-06-14 22:04:32 +00:00
|
|
|
// getSelect - Helper function to make it easier to build Select's if you just
|
|
|
|
// have operands and don't want to check for vector.
|
|
|
|
SDValue getSelect(SDLoc DL, EVT VT, SDValue Cond,
|
|
|
|
SDValue LHS, SDValue RHS) {
|
|
|
|
assert(LHS.getValueType() == RHS.getValueType() &&
|
|
|
|
"Cannot use select on differing types");
|
|
|
|
assert(VT.isVector() == LHS.getValueType().isVector() &&
|
|
|
|
"Cannot mix vectors and scalars");
|
|
|
|
return getNode(Cond.getValueType().isVector() ? ISD::VSELECT : ISD::SELECT, DL, VT,
|
|
|
|
Cond, LHS, RHS);
|
|
|
|
}
|
|
|
|
|
2005-08-10 20:51:12 +00:00
|
|
|
/// getSelectCC - Helper function to make it easier to build SelectCC's if you
|
2008-07-27 21:46:04 +00:00
|
|
|
/// just have an ISD::CondCode instead of an SDValue.
|
2005-08-10 20:51:12 +00:00
|
|
|
///
|
2013-05-25 02:42:55 +00:00
|
|
|
SDValue getSelectCC(SDLoc DL, SDValue LHS, SDValue RHS,
|
2009-01-30 02:23:43 +00:00
|
|
|
SDValue True, SDValue False, ISD::CondCode Cond) {
|
|
|
|
return getNode(ISD::SELECT_CC, DL, True.getValueType(),
|
|
|
|
LHS, RHS, True, False, getCondCode(Cond));
|
2005-08-10 20:51:12 +00:00
|
|
|
}
|
2009-02-17 22:15:04 +00:00
|
|
|
|
2006-01-25 18:21:52 +00:00
|
|
|
/// getVAArg - VAArg produces a result and token chain, and takes a pointer
|
|
|
|
/// and a source value as input.
|
2013-05-25 02:42:55 +00:00
|
|
|
SDValue getVAArg(EVT VT, SDLoc dl, SDValue Chain, SDValue Ptr,
|
2010-07-11 04:01:49 +00:00
|
|
|
SDValue SV, unsigned Align);
|
2005-08-16 19:49:35 +00:00
|
|
|
|
IR: add "cmpxchg weak" variant to support permitted failure.
This commit adds a weak variant of the cmpxchg operation, as described
in C++11. A cmpxchg instruction with this modifier is permitted to
fail to store, even if the comparison indicated it should.
As a result, cmpxchg instructions must return a flag indicating
success in addition to their original iN value loaded. Thus, for
uniformity *all* cmpxchg instructions now return "{ iN, i1 }". The
second flag is 1 when the store succeeded.
At the DAG level, a new ATOMIC_CMP_SWAP_WITH_SUCCESS node has been
added as the natural representation for the new cmpxchg instructions.
It is a strong cmpxchg.
By default this gets Expanded to the existing ATOMIC_CMP_SWAP during
Legalization, so existing backends should see no change in behaviour.
If they wish to deal with the enhanced node instead, they can call
setOperationAction on it. Beware: as a node with 2 results, it cannot
be selected from TableGen.
Currently, no use is made of the extra information provided in this
patch. Test updates are almost entirely adapting the input IR to the
new scheme.
Summary for out of tree users:
------------------------------
+ Legacy Bitcode files are upgraded during read.
+ Legacy assembly IR files will be invalid.
+ Front-ends must adapt to different type for "cmpxchg".
+ Backends should be unaffected by default.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210903 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-13 14:24:07 +00:00
|
|
|
/// getAtomicCmpSwap - Gets a node for an atomic cmpxchg op. There are two
|
2014-08-29 21:53:01 +00:00
|
|
|
/// valid Opcodes. ISD::ATOMIC_CMO_SWAP produces the value loaded and a
|
IR: add "cmpxchg weak" variant to support permitted failure.
This commit adds a weak variant of the cmpxchg operation, as described
in C++11. A cmpxchg instruction with this modifier is permitted to
fail to store, even if the comparison indicated it should.
As a result, cmpxchg instructions must return a flag indicating
success in addition to their original iN value loaded. Thus, for
uniformity *all* cmpxchg instructions now return "{ iN, i1 }". The
second flag is 1 when the store succeeded.
At the DAG level, a new ATOMIC_CMP_SWAP_WITH_SUCCESS node has been
added as the natural representation for the new cmpxchg instructions.
It is a strong cmpxchg.
By default this gets Expanded to the existing ATOMIC_CMP_SWAP during
Legalization, so existing backends should see no change in behaviour.
If they wish to deal with the enhanced node instead, they can call
setOperationAction on it. Beware: as a node with 2 results, it cannot
be selected from TableGen.
Currently, no use is made of the extra information provided in this
patch. Test updates are almost entirely adapting the input IR to the
new scheme.
Summary for out of tree users:
------------------------------
+ Legacy Bitcode files are upgraded during read.
+ Legacy assembly IR files will be invalid.
+ Front-ends must adapt to different type for "cmpxchg".
+ Backends should be unaffected by default.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210903 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-13 14:24:07 +00:00
|
|
|
/// chain result. ISD::ATOMIC_CMP_SWAP_WITH_SUCCESS produces the value loaded,
|
|
|
|
/// a success flag (initially i1), and a chain.
|
|
|
|
SDValue getAtomicCmpSwap(unsigned Opcode, SDLoc dl, EVT MemVT, SDVTList VTs,
|
|
|
|
SDValue Chain, SDValue Ptr, SDValue Cmp, SDValue Swp,
|
|
|
|
MachinePointerInfo PtrInfo, unsigned Alignment,
|
|
|
|
AtomicOrdering SuccessOrdering,
|
|
|
|
AtomicOrdering FailureOrdering,
|
|
|
|
SynchronizationScope SynchScope);
|
|
|
|
SDValue getAtomicCmpSwap(unsigned Opcode, SDLoc dl, EVT MemVT, SDVTList VTs,
|
|
|
|
SDValue Chain, SDValue Ptr, SDValue Cmp, SDValue Swp,
|
|
|
|
MachineMemOperand *MMO,
|
|
|
|
AtomicOrdering SuccessOrdering,
|
|
|
|
AtomicOrdering FailureOrdering,
|
|
|
|
SynchronizationScope SynchScope);
|
2008-02-21 06:45:13 +00:00
|
|
|
|
2011-08-24 20:50:09 +00:00
|
|
|
/// getAtomic - Gets a node for an atomic op, produces result (if relevant)
|
|
|
|
/// and chain and takes 2 operands.
|
2013-05-25 02:42:55 +00:00
|
|
|
SDValue getAtomic(unsigned Opcode, SDLoc dl, EVT MemVT, SDValue Chain,
|
2014-04-15 07:22:52 +00:00
|
|
|
SDValue Ptr, SDValue Val, const Value *PtrVal,
|
2011-08-24 20:50:09 +00:00
|
|
|
unsigned Alignment, AtomicOrdering Ordering,
|
|
|
|
SynchronizationScope SynchScope);
|
2013-05-25 02:42:55 +00:00
|
|
|
SDValue getAtomic(unsigned Opcode, SDLoc dl, EVT MemVT, SDValue Chain,
|
2011-08-24 20:50:09 +00:00
|
|
|
SDValue Ptr, SDValue Val, MachineMemOperand *MMO,
|
|
|
|
AtomicOrdering Ordering,
|
|
|
|
SynchronizationScope SynchScope);
|
|
|
|
|
|
|
|
/// getAtomic - Gets a node for an atomic op, produces result and chain and
|
|
|
|
/// takes 1 operand.
|
2013-05-25 02:42:55 +00:00
|
|
|
SDValue getAtomic(unsigned Opcode, SDLoc dl, EVT MemVT, EVT VT,
|
2011-08-24 20:50:09 +00:00
|
|
|
SDValue Chain, SDValue Ptr, MachineMemOperand *MMO,
|
2011-07-29 03:05:32 +00:00
|
|
|
AtomicOrdering Ordering,
|
|
|
|
SynchronizationScope SynchScope);
|
2008-02-21 06:45:13 +00:00
|
|
|
|
2013-09-26 12:22:36 +00:00
|
|
|
/// getAtomic - Gets a node for an atomic op, produces result and chain and
|
|
|
|
/// takes N operands.
|
|
|
|
SDValue getAtomic(unsigned Opcode, SDLoc dl, EVT MemVT, SDVTList VTList,
|
2014-04-28 05:57:50 +00:00
|
|
|
ArrayRef<SDValue> Ops, MachineMemOperand *MMO,
|
2014-03-11 10:48:52 +00:00
|
|
|
AtomicOrdering SuccessOrdering,
|
|
|
|
AtomicOrdering FailureOrdering,
|
2013-09-26 12:22:36 +00:00
|
|
|
SynchronizationScope SynchScope);
|
2014-03-11 10:48:52 +00:00
|
|
|
SDValue getAtomic(unsigned Opcode, SDLoc dl, EVT MemVT, SDVTList VTList,
|
2014-04-28 05:57:50 +00:00
|
|
|
ArrayRef<SDValue> Ops, MachineMemOperand *MMO,
|
2014-03-11 10:48:52 +00:00
|
|
|
AtomicOrdering Ordering, SynchronizationScope SynchScope);
|
2013-09-26 12:22:36 +00:00
|
|
|
|
2008-10-17 18:22:58 +00:00
|
|
|
/// getMemIntrinsicNode - Creates a MemIntrinsicNode that may produce a
|
2009-09-25 20:36:54 +00:00
|
|
|
/// result and takes a list of operands. Opcode may be INTRINSIC_VOID,
|
|
|
|
/// INTRINSIC_W_CHAIN, or a target-specific opcode with a value not
|
|
|
|
/// less than FIRST_TARGET_MEMORY_OPCODE.
|
2013-05-25 02:42:55 +00:00
|
|
|
SDValue getMemIntrinsicNode(unsigned Opcode, SDLoc dl, SDVTList VTList,
|
2014-04-26 19:29:41 +00:00
|
|
|
ArrayRef<SDValue> Ops,
|
2010-09-21 04:57:15 +00:00
|
|
|
EVT MemVT, MachinePointerInfo PtrInfo,
|
2009-01-29 00:47:48 +00:00
|
|
|
unsigned Align = 0, bool Vol = false,
|
2014-08-13 01:15:40 +00:00
|
|
|
bool ReadMem = true, bool WriteMem = true,
|
|
|
|
unsigned Size = 0);
|
2008-10-17 18:22:58 +00:00
|
|
|
|
2013-05-25 02:42:55 +00:00
|
|
|
SDValue getMemIntrinsicNode(unsigned Opcode, SDLoc dl, SDVTList VTList,
|
2014-04-26 19:29:41 +00:00
|
|
|
ArrayRef<SDValue> Ops,
|
2009-09-25 20:36:54 +00:00
|
|
|
EVT MemVT, MachineMemOperand *MMO);
|
|
|
|
|
2008-07-02 17:40:58 +00:00
|
|
|
/// getMergeValues - Create a MERGE_VALUES node from the given operands.
|
2014-04-27 19:20:57 +00:00
|
|
|
SDValue getMergeValues(ArrayRef<SDValue> Ops, SDLoc dl);
|
2008-06-30 10:19:09 +00:00
|
|
|
|
2005-01-07 07:46:32 +00:00
|
|
|
/// getLoad - Loads are not normal binary operators: their result type is not
|
|
|
|
/// determined by their operands, and they produce a value AND a token chain.
|
2003-08-11 14:56:26 +00:00
|
|
|
///
|
2013-05-25 02:42:55 +00:00
|
|
|
SDValue getLoad(EVT VT, SDLoc dl, SDValue Chain, SDValue Ptr,
|
2010-09-21 05:40:29 +00:00
|
|
|
MachinePointerInfo PtrInfo, bool isVolatile,
|
2011-11-08 18:42:53 +00:00
|
|
|
bool isNonTemporal, bool isInvariant, unsigned Alignment,
|
2014-07-24 12:16:19 +00:00
|
|
|
const AAMDNodes &AAInfo = AAMDNodes(),
|
2014-04-15 06:32:26 +00:00
|
|
|
const MDNode *Ranges = nullptr);
|
2013-10-28 11:17:59 +00:00
|
|
|
SDValue getLoad(EVT VT, SDLoc dl, SDValue Chain, SDValue Ptr,
|
|
|
|
MachineMemOperand *MMO);
|
2013-05-25 02:42:55 +00:00
|
|
|
SDValue getExtLoad(ISD::LoadExtType ExtType, SDLoc dl, EVT VT,
|
2010-09-21 05:40:29 +00:00
|
|
|
SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo,
|
|
|
|
EVT MemVT, bool isVolatile,
|
2014-07-31 21:45:05 +00:00
|
|
|
bool isNonTemporal, bool isInvariant, unsigned Alignment,
|
2014-07-24 12:16:19 +00:00
|
|
|
const AAMDNodes &AAInfo = AAMDNodes());
|
2013-10-28 11:17:59 +00:00
|
|
|
SDValue getExtLoad(ISD::LoadExtType ExtType, SDLoc dl, EVT VT,
|
|
|
|
SDValue Chain, SDValue Ptr, EVT MemVT,
|
|
|
|
MachineMemOperand *MMO);
|
2013-05-25 02:42:55 +00:00
|
|
|
SDValue getIndexedLoad(SDValue OrigLoad, SDLoc dl, SDValue Base,
|
2010-07-07 22:15:37 +00:00
|
|
|
SDValue Offset, ISD::MemIndexedMode AM);
|
2010-09-21 05:10:45 +00:00
|
|
|
SDValue getLoad(ISD::MemIndexedMode AM, ISD::LoadExtType ExtType,
|
2013-05-25 02:42:55 +00:00
|
|
|
EVT VT, SDLoc dl,
|
2010-09-21 05:10:45 +00:00
|
|
|
SDValue Chain, SDValue Ptr, SDValue Offset,
|
|
|
|
MachinePointerInfo PtrInfo, EVT MemVT,
|
2011-11-08 18:42:53 +00:00
|
|
|
bool isVolatile, bool isNonTemporal, bool isInvariant,
|
2014-07-24 12:16:19 +00:00
|
|
|
unsigned Alignment, const AAMDNodes &AAInfo = AAMDNodes(),
|
2014-04-15 06:32:26 +00:00
|
|
|
const MDNode *Ranges = nullptr);
|
2010-07-07 22:15:37 +00:00
|
|
|
SDValue getLoad(ISD::MemIndexedMode AM, ISD::LoadExtType ExtType,
|
2013-05-25 02:42:55 +00:00
|
|
|
EVT VT, SDLoc dl,
|
2010-07-07 22:15:37 +00:00
|
|
|
SDValue Chain, SDValue Ptr, SDValue Offset,
|
2009-09-25 20:36:54 +00:00
|
|
|
EVT MemVT, MachineMemOperand *MMO);
|
2005-04-27 20:10:01 +00:00
|
|
|
|
2006-10-05 22:57:11 +00:00
|
|
|
/// getStore - Helper function to build ISD::STORE nodes.
|
|
|
|
///
|
2013-05-25 02:42:55 +00:00
|
|
|
SDValue getStore(SDValue Chain, SDLoc dl, SDValue Val, SDValue Ptr,
|
2010-09-21 05:10:45 +00:00
|
|
|
MachinePointerInfo PtrInfo, bool isVolatile,
|
2010-10-20 00:31:05 +00:00
|
|
|
bool isNonTemporal, unsigned Alignment,
|
2014-07-24 12:16:19 +00:00
|
|
|
const AAMDNodes &AAInfo = AAMDNodes());
|
2013-05-25 02:42:55 +00:00
|
|
|
SDValue getStore(SDValue Chain, SDLoc dl, SDValue Val, SDValue Ptr,
|
2009-09-25 20:36:54 +00:00
|
|
|
MachineMemOperand *MMO);
|
2013-05-25 02:42:55 +00:00
|
|
|
SDValue getTruncStore(SDValue Chain, SDLoc dl, SDValue Val, SDValue Ptr,
|
2010-09-21 05:10:45 +00:00
|
|
|
MachinePointerInfo PtrInfo, EVT TVT,
|
|
|
|
bool isNonTemporal, bool isVolatile,
|
2010-10-20 00:31:05 +00:00
|
|
|
unsigned Alignment,
|
2014-07-24 12:16:19 +00:00
|
|
|
const AAMDNodes &AAInfo = AAMDNodes());
|
2013-05-25 02:42:55 +00:00
|
|
|
SDValue getTruncStore(SDValue Chain, SDLoc dl, SDValue Val, SDValue Ptr,
|
2009-09-25 20:36:54 +00:00
|
|
|
EVT TVT, MachineMemOperand *MMO);
|
2013-05-25 02:42:55 +00:00
|
|
|
SDValue getIndexedStore(SDValue OrigStoe, SDLoc dl, SDValue Base,
|
2009-01-29 00:47:48 +00:00
|
|
|
SDValue Offset, ISD::MemIndexedMode AM);
|
2006-10-05 22:57:11 +00:00
|
|
|
|
2014-12-04 09:40:44 +00:00
|
|
|
SDValue getMaskedLoad(EVT VT, SDLoc dl, SDValue Chain, SDValue Ptr,
|
2015-01-22 12:07:59 +00:00
|
|
|
SDValue Mask, SDValue Src0, EVT MemVT,
|
|
|
|
MachineMemOperand *MMO, ISD::LoadExtType);
|
2014-12-04 09:40:44 +00:00
|
|
|
SDValue getMaskedStore(SDValue Chain, SDLoc dl, SDValue Val,
|
2015-01-22 12:07:59 +00:00
|
|
|
SDValue Ptr, SDValue Mask, EVT MemVT,
|
|
|
|
MachineMemOperand *MMO, bool IsTrunc);
|
2009-01-27 17:28:23 +00:00
|
|
|
/// getSrcValue - Construct a node to track a Value* through the backend.
|
2008-07-27 21:46:04 +00:00
|
|
|
SDValue getSrcValue(const Value *v);
|
2008-02-06 22:27:42 +00:00
|
|
|
|
2010-04-07 05:20:54 +00:00
|
|
|
/// getMDNode - Return an MDNodeSDNode which holds an MDNode.
|
|
|
|
SDValue getMDNode(const MDNode *MD);
|
2011-03-07 18:29:47 +00:00
|
|
|
|
2013-11-15 01:34:59 +00:00
|
|
|
/// getAddrSpaceCast - Return an AddrSpaceCastSDNode.
|
|
|
|
SDValue getAddrSpaceCast(SDLoc dl, EVT VT, SDValue Ptr,
|
|
|
|
unsigned SrcAS, unsigned DestAS);
|
|
|
|
|
2009-01-31 15:50:11 +00:00
|
|
|
/// getShiftAmountOperand - Return the specified value casted to
|
|
|
|
/// the target's desired shift amount type.
|
2011-03-07 18:29:47 +00:00
|
|
|
SDValue getShiftAmountOperand(EVT LHSTy, SDValue Op);
|
2009-01-31 15:50:11 +00:00
|
|
|
|
2006-01-28 09:32:01 +00:00
|
|
|
/// UpdateNodeOperands - *Mutate* the specified node in-place to have the
|
|
|
|
/// specified operands. If the resultant node already exists in the DAG,
|
|
|
|
/// this does not modify the specified node, instead it returns the node that
|
|
|
|
/// already exists. If the resultant node does not exist in the DAG, the
|
|
|
|
/// input node is returned. As a degenerate case, if you specify the same
|
|
|
|
/// input operands as the node already has, the input node is returned.
|
2010-06-18 15:30:29 +00:00
|
|
|
SDNode *UpdateNodeOperands(SDNode *N, SDValue Op);
|
|
|
|
SDNode *UpdateNodeOperands(SDNode *N, SDValue Op1, SDValue Op2);
|
|
|
|
SDNode *UpdateNodeOperands(SDNode *N, SDValue Op1, SDValue Op2,
|
2008-07-27 21:46:04 +00:00
|
|
|
SDValue Op3);
|
2010-06-18 15:30:29 +00:00
|
|
|
SDNode *UpdateNodeOperands(SDNode *N, SDValue Op1, SDValue Op2,
|
2008-07-27 21:46:04 +00:00
|
|
|
SDValue Op3, SDValue Op4);
|
2010-06-18 15:30:29 +00:00
|
|
|
SDNode *UpdateNodeOperands(SDNode *N, SDValue Op1, SDValue Op2,
|
2008-07-27 21:46:04 +00:00
|
|
|
SDValue Op3, SDValue Op4, SDValue Op5);
|
2014-04-28 05:57:50 +00:00
|
|
|
SDNode *UpdateNodeOperands(SDNode *N, ArrayRef<SDValue> Ops);
|
2009-02-17 22:15:04 +00:00
|
|
|
|
2005-08-16 18:16:24 +00:00
|
|
|
/// SelectNodeTo - These are used for target selectors to *mutate* the
|
|
|
|
/// specified node to have the specified return type, Target opcode, and
|
|
|
|
/// operands. Note that target opcodes are stored as
|
2008-07-17 19:10:17 +00:00
|
|
|
/// ~TargetOpcode in the node opcode field. The resultant node is returned.
|
2009-08-10 22:56:29 +00:00
|
|
|
SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, EVT VT);
|
|
|
|
SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, EVT VT, SDValue Op1);
|
|
|
|
SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, EVT VT,
|
2008-07-27 21:46:04 +00:00
|
|
|
SDValue Op1, SDValue Op2);
|
2009-08-10 22:56:29 +00:00
|
|
|
SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, EVT VT,
|
2008-07-27 21:46:04 +00:00
|
|
|
SDValue Op1, SDValue Op2, SDValue Op3);
|
2009-08-10 22:56:29 +00:00
|
|
|
SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, EVT VT,
|
2014-04-27 19:21:11 +00:00
|
|
|
ArrayRef<SDValue> Ops);
|
2009-08-10 22:56:29 +00:00
|
|
|
SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, EVT VT1, EVT VT2);
|
|
|
|
SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, EVT VT1,
|
2014-04-27 19:21:11 +00:00
|
|
|
EVT VT2, ArrayRef<SDValue> Ops);
|
2009-08-10 22:56:29 +00:00
|
|
|
SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, EVT VT1,
|
2014-04-27 19:21:11 +00:00
|
|
|
EVT VT2, EVT VT3, ArrayRef<SDValue> Ops);
|
2009-08-10 22:56:29 +00:00
|
|
|
SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT1,
|
2014-04-27 19:21:11 +00:00
|
|
|
EVT VT2, EVT VT3, EVT VT4, ArrayRef<SDValue> Ops);
|
2009-08-10 22:56:29 +00:00
|
|
|
SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, EVT VT1,
|
|
|
|
EVT VT2, SDValue Op1);
|
|
|
|
SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, EVT VT1,
|
|
|
|
EVT VT2, SDValue Op1, SDValue Op2);
|
|
|
|
SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, EVT VT1,
|
|
|
|
EVT VT2, SDValue Op1, SDValue Op2, SDValue Op3);
|
|
|
|
SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, EVT VT1,
|
|
|
|
EVT VT2, EVT VT3, SDValue Op1, SDValue Op2, SDValue Op3);
|
2008-07-02 23:23:19 +00:00
|
|
|
SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, SDVTList VTs,
|
2014-04-27 19:21:11 +00:00
|
|
|
ArrayRef<SDValue> Ops);
|
2006-08-27 08:08:54 +00:00
|
|
|
|
2010-03-01 22:20:05 +00:00
|
|
|
/// MorphNodeTo - This *mutates* the specified node to have the specified
|
2008-07-17 19:10:17 +00:00
|
|
|
/// return type, opcode, and operands.
|
|
|
|
SDNode *MorphNodeTo(SDNode *N, unsigned Opc, SDVTList VTs,
|
2014-04-27 19:21:16 +00:00
|
|
|
ArrayRef<SDValue> Ops);
|
2005-10-25 21:02:21 +00:00
|
|
|
|
2009-09-25 18:54:59 +00:00
|
|
|
/// getMachineNode - These are used for target selectors to create a new node
|
|
|
|
/// with specified return type(s), MachineInstr opcode, and operands.
|
2006-02-09 07:15:23 +00:00
|
|
|
///
|
2009-09-25 18:54:59 +00:00
|
|
|
/// Note that getMachineNode returns the resultant node. If there is already
|
|
|
|
/// a node of the specified opcode and operands, it returns that node instead
|
|
|
|
/// of the current one.
|
2013-05-25 02:42:55 +00:00
|
|
|
MachineSDNode *getMachineNode(unsigned Opcode, SDLoc dl, EVT VT);
|
|
|
|
MachineSDNode *getMachineNode(unsigned Opcode, SDLoc dl, EVT VT,
|
2009-10-10 01:29:16 +00:00
|
|
|
SDValue Op1);
|
2013-05-25 02:42:55 +00:00
|
|
|
MachineSDNode *getMachineNode(unsigned Opcode, SDLoc dl, EVT VT,
|
2009-10-10 01:29:16 +00:00
|
|
|
SDValue Op1, SDValue Op2);
|
2013-05-25 02:42:55 +00:00
|
|
|
MachineSDNode *getMachineNode(unsigned Opcode, SDLoc dl, EVT VT,
|
2013-04-19 22:22:57 +00:00
|
|
|
SDValue Op1, SDValue Op2, SDValue Op3);
|
2013-05-25 02:42:55 +00:00
|
|
|
MachineSDNode *getMachineNode(unsigned Opcode, SDLoc dl, EVT VT,
|
2013-04-19 22:22:57 +00:00
|
|
|
ArrayRef<SDValue> Ops);
|
2013-05-25 02:42:55 +00:00
|
|
|
MachineSDNode *getMachineNode(unsigned Opcode, SDLoc dl, EVT VT1, EVT VT2);
|
|
|
|
MachineSDNode *getMachineNode(unsigned Opcode, SDLoc dl, EVT VT1, EVT VT2,
|
2013-04-19 22:22:57 +00:00
|
|
|
SDValue Op1);
|
2013-05-25 02:42:55 +00:00
|
|
|
MachineSDNode *getMachineNode(unsigned Opcode, SDLoc dl, EVT VT1, EVT VT2,
|
2013-04-19 22:22:57 +00:00
|
|
|
SDValue Op1, SDValue Op2);
|
2013-05-25 02:42:55 +00:00
|
|
|
MachineSDNode *getMachineNode(unsigned Opcode, SDLoc dl, EVT VT1, EVT VT2,
|
2013-04-19 22:22:57 +00:00
|
|
|
SDValue Op1, SDValue Op2, SDValue Op3);
|
2013-05-25 02:42:55 +00:00
|
|
|
MachineSDNode *getMachineNode(unsigned Opcode, SDLoc dl, EVT VT1, EVT VT2,
|
2013-04-19 22:22:57 +00:00
|
|
|
ArrayRef<SDValue> Ops);
|
2013-05-25 02:42:55 +00:00
|
|
|
MachineSDNode *getMachineNode(unsigned Opcode, SDLoc dl, EVT VT1, EVT VT2,
|
2013-04-19 22:22:57 +00:00
|
|
|
EVT VT3, SDValue Op1, SDValue Op2);
|
2013-05-25 02:42:55 +00:00
|
|
|
MachineSDNode *getMachineNode(unsigned Opcode, SDLoc dl, EVT VT1, EVT VT2,
|
2013-04-19 22:22:57 +00:00
|
|
|
EVT VT3, SDValue Op1, SDValue Op2,
|
|
|
|
SDValue Op3);
|
2013-05-25 02:42:55 +00:00
|
|
|
MachineSDNode *getMachineNode(unsigned Opcode, SDLoc dl, EVT VT1, EVT VT2,
|
2013-04-19 22:22:57 +00:00
|
|
|
EVT VT3, ArrayRef<SDValue> Ops);
|
2013-05-25 02:42:55 +00:00
|
|
|
MachineSDNode *getMachineNode(unsigned Opcode, SDLoc dl, EVT VT1, EVT VT2,
|
2013-04-19 22:22:57 +00:00
|
|
|
EVT VT3, EVT VT4, ArrayRef<SDValue> Ops);
|
2013-05-25 02:42:55 +00:00
|
|
|
MachineSDNode *getMachineNode(unsigned Opcode, SDLoc dl,
|
2013-04-19 22:22:57 +00:00
|
|
|
ArrayRef<EVT> ResultTys,
|
|
|
|
ArrayRef<SDValue> Ops);
|
2013-05-25 02:42:55 +00:00
|
|
|
MachineSDNode *getMachineNode(unsigned Opcode, SDLoc dl, SDVTList VTs,
|
2013-04-19 22:22:57 +00:00
|
|
|
ArrayRef<SDValue> Ops);
|
2008-03-22 01:55:50 +00:00
|
|
|
|
2009-08-19 18:16:17 +00:00
|
|
|
/// getTargetExtractSubreg - A convenience function for creating
|
|
|
|
/// TargetInstrInfo::EXTRACT_SUBREG nodes.
|
2013-05-25 02:42:55 +00:00
|
|
|
SDValue getTargetExtractSubreg(int SRIdx, SDLoc DL, EVT VT,
|
2009-08-19 18:16:17 +00:00
|
|
|
SDValue Operand);
|
|
|
|
|
2009-10-08 18:49:46 +00:00
|
|
|
/// getTargetInsertSubreg - A convenience function for creating
|
|
|
|
/// TargetInstrInfo::INSERT_SUBREG nodes.
|
2013-05-25 02:42:55 +00:00
|
|
|
SDValue getTargetInsertSubreg(int SRIdx, SDLoc DL, EVT VT,
|
2009-10-08 18:49:46 +00:00
|
|
|
SDValue Operand, SDValue Subreg);
|
|
|
|
|
2008-03-22 01:55:50 +00:00
|
|
|
/// getNodeIfExists - Get the specified node if it's already available, or
|
|
|
|
/// else return NULL.
|
2014-06-09 12:32:53 +00:00
|
|
|
SDNode *getNodeIfExists(unsigned Opcode, SDVTList VTs, ArrayRef<SDValue> Ops,
|
|
|
|
bool nuw = false, bool nsw = false,
|
|
|
|
bool exact = false);
|
2009-02-17 22:15:04 +00:00
|
|
|
|
2010-03-29 20:48:30 +00:00
|
|
|
/// getDbgValue - Creates a SDDbgValue node.
|
|
|
|
///
|
Move the complex address expression out of DIVariable and into an extra
argument of the llvm.dbg.declare/llvm.dbg.value intrinsics.
Previously, DIVariable was a variable-length field that has an optional
reference to a Metadata array consisting of a variable number of
complex address expressions. In the case of OpPiece expressions this is
wasting a lot of storage in IR, because when an aggregate type is, e.g.,
SROA'd into all of its n individual members, the IR will contain n copies
of the DIVariable, all alike, only differing in the complex address
reference at the end.
By making the complex address into an extra argument of the
dbg.value/dbg.declare intrinsics, all of the pieces can reference the
same variable and the complex address expressions can be uniqued across
the CU, too.
Down the road, this will allow us to move other flags, such as
"indirection" out of the DIVariable, too.
The new intrinsics look like this:
declare void @llvm.dbg.declare(metadata %storage, metadata %var, metadata %expr)
declare void @llvm.dbg.value(metadata %storage, i64 %offset, metadata %var, metadata %expr)
This patch adds a new LLVM-local tag to DIExpressions, so we can detect
and pretty-print DIExpression metadata nodes.
What this patch doesn't do:
This patch does not touch the "Indirect" field in DIVariable; but moving
that into the expression would be a natural next step.
http://reviews.llvm.org/D4919
rdar://problem/17994491
Thanks to dblaikie and dexonsmith for reviewing this patch!
Note: I accidentally committed a bogus older version of this patch previously.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218787 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-01 18:55:02 +00:00
|
|
|
/// SDNode
|
|
|
|
SDDbgValue *getDbgValue(MDNode *Var, MDNode *Expr, SDNode *N, unsigned R,
|
|
|
|
bool IsIndirect, uint64_t Off, DebugLoc DL,
|
|
|
|
unsigned O);
|
|
|
|
|
|
|
|
/// Constant
|
|
|
|
SDDbgValue *getConstantDbgValue(MDNode *Var, MDNode *Expr, const Value *C,
|
|
|
|
uint64_t Off, DebugLoc DL, unsigned O);
|
|
|
|
|
|
|
|
/// FrameIndex
|
|
|
|
SDDbgValue *getFrameIndexDbgValue(MDNode *Var, MDNode *Expr, unsigned FI,
|
|
|
|
uint64_t Off, DebugLoc DL, unsigned O);
|
2010-03-29 20:48:30 +00:00
|
|
|
|
2008-02-03 06:49:24 +00:00
|
|
|
/// RemoveDeadNode - Remove the specified node from the system. If any of its
|
|
|
|
/// operands then becomes dead, remove them as well. Inform UpdateListener
|
|
|
|
/// for each node deleted.
|
2012-04-20 22:08:46 +00:00
|
|
|
void RemoveDeadNode(SDNode *N);
|
2009-02-17 22:15:04 +00:00
|
|
|
|
2008-07-07 20:57:48 +00:00
|
|
|
/// RemoveDeadNodes - This method deletes the unreachable nodes in the
|
|
|
|
/// given list, and any nodes that become unreachable as a result.
|
2012-04-20 22:08:46 +00:00
|
|
|
void RemoveDeadNodes(SmallVectorImpl<SDNode *> &DeadNodes);
|
2008-07-07 20:57:48 +00:00
|
|
|
|
2005-08-17 18:59:17 +00:00
|
|
|
/// ReplaceAllUsesWith - Modify anything using 'From' to use 'To' instead.
|
2005-08-26 18:35:58 +00:00
|
|
|
/// This can cause recursive merging of nodes in the DAG. Use the first
|
|
|
|
/// version if 'From' is known to have a single result, use the second
|
2009-04-15 20:06:30 +00:00
|
|
|
/// if you have two nodes with identical results (or if 'To' has a superset
|
|
|
|
/// of the results of 'From'), use the third otherwise.
|
2005-08-17 18:59:17 +00:00
|
|
|
///
|
2009-02-17 22:15:04 +00:00
|
|
|
/// These methods all take an optional UpdateListener, which (if not null) is
|
2008-02-03 06:49:24 +00:00
|
|
|
/// informed about nodes that are deleted and modified due to recursive
|
|
|
|
/// changes in the dag.
|
2005-09-07 05:36:18 +00:00
|
|
|
///
|
2009-01-21 20:50:09 +00:00
|
|
|
/// These functions only replace all existing uses. It's possible that as
|
|
|
|
/// these replacements are being performed, CSE may cause the From node
|
|
|
|
/// to be given new uses. These new uses of From are left in place, and
|
2011-04-15 05:18:47 +00:00
|
|
|
/// not automatically transferred to To.
|
2009-01-21 20:50:09 +00:00
|
|
|
///
|
2012-04-20 22:08:46 +00:00
|
|
|
void ReplaceAllUsesWith(SDValue From, SDValue Op);
|
|
|
|
void ReplaceAllUsesWith(SDNode *From, SDNode *To);
|
|
|
|
void ReplaceAllUsesWith(SDNode *From, const SDValue *To);
|
2006-02-09 22:11:03 +00:00
|
|
|
|
2006-02-17 21:57:00 +00:00
|
|
|
/// ReplaceAllUsesOfValueWith - Replace any uses of From with To, leaving
|
2008-02-03 06:49:24 +00:00
|
|
|
/// uses of other values produced by From.Val alone.
|
2012-04-20 22:08:46 +00:00
|
|
|
void ReplaceAllUsesOfValueWith(SDValue From, SDValue To);
|
2006-02-17 21:57:00 +00:00
|
|
|
|
2008-07-17 19:10:17 +00:00
|
|
|
/// ReplaceAllUsesOfValuesWith - Like ReplaceAllUsesOfValueWith, but
|
|
|
|
/// for multiple values at once. This correctly handles the case where
|
|
|
|
/// there is an overlap between the From values and the To values.
|
2008-07-27 21:46:04 +00:00
|
|
|
void ReplaceAllUsesOfValuesWith(const SDValue *From, const SDValue *To,
|
2012-04-20 22:08:46 +00:00
|
|
|
unsigned Num);
|
2008-07-17 19:10:17 +00:00
|
|
|
|
2008-09-30 18:30:35 +00:00
|
|
|
/// AssignTopologicalOrder - Topological-sort the AllNodes list and a
|
|
|
|
/// assign a unique node id for each node in the DAG based on their
|
|
|
|
/// topological order. Returns the number of nodes.
|
|
|
|
unsigned AssignTopologicalOrder();
|
2006-08-01 08:20:41 +00:00
|
|
|
|
Eliminate the ISel priority queue, which used the topological order for a
priority function. Instead, just iterate over the AllNodes list, which is
already in topological order. This eliminates a fair amount of bookkeeping,
and speeds up the isel phase by about 15% on many testcases.
The impact on most targets is that AddToISelQueue calls can be simply removed.
In the x86 target, there are two additional notable changes.
The rule-bending AND+SHIFT optimization in MatchAddress that creates new
pre-isel nodes during isel is now a little more verbose, but more robust.
Instead of either creating an invalid DAG or creating an invalid topological
sort, as it has historically done, it can now just insert the new nodes into
the node list at a position where they will be consistent with the topological
ordering.
Also, the address-matching code has logic that checked to see if a node was
"already selected". However, when a node is selected, it has all its uses
taken away via ReplaceAllUsesWith or equivalent, so it won't recieve any
further visits from MatchAddress. This code is now removed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58748 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-05 04:14:16 +00:00
|
|
|
/// RepositionNode - Move node N in the AllNodes list to be immediately
|
|
|
|
/// before the given iterator Position. This may be used to update the
|
|
|
|
/// topological ordering when the list of nodes is modified.
|
|
|
|
void RepositionNode(allnodes_iterator Position, SDNode *N) {
|
|
|
|
AllNodes.insert(Position, AllNodes.remove(N));
|
|
|
|
}
|
|
|
|
|
2006-08-29 06:42:35 +00:00
|
|
|
/// isCommutativeBinOp - Returns true if the opcode is a commutative binary
|
|
|
|
/// operation.
|
|
|
|
static bool isCommutativeBinOp(unsigned Opcode) {
|
2008-01-25 06:20:20 +00:00
|
|
|
// FIXME: This should get its info from the td file, so that we can include
|
|
|
|
// target info.
|
2006-08-29 06:42:35 +00:00
|
|
|
switch (Opcode) {
|
|
|
|
case ISD::ADD:
|
|
|
|
case ISD::MUL:
|
|
|
|
case ISD::MULHU:
|
|
|
|
case ISD::MULHS:
|
2007-10-05 14:09:33 +00:00
|
|
|
case ISD::SMUL_LOHI:
|
|
|
|
case ISD::UMUL_LOHI:
|
2006-08-29 06:42:35 +00:00
|
|
|
case ISD::FADD:
|
|
|
|
case ISD::FMUL:
|
|
|
|
case ISD::AND:
|
|
|
|
case ISD::OR:
|
|
|
|
case ISD::XOR:
|
2009-03-19 18:53:45 +00:00
|
|
|
case ISD::SADDO:
|
|
|
|
case ISD::UADDO:
|
2009-02-17 22:15:04 +00:00
|
|
|
case ISD::ADDC:
|
2014-10-21 23:01:01 +00:00
|
|
|
case ISD::ADDE:
|
|
|
|
case ISD::FMINNUM:
|
|
|
|
case ISD::FMAXNUM:
|
|
|
|
return true;
|
2006-08-29 06:42:35 +00:00
|
|
|
default: return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-01-22 09:46:31 +00:00
|
|
|
/// Returns an APFloat semantics tag appropriate for the given type. If VT is
|
|
|
|
/// a vector type, the element semantics are returned.
|
|
|
|
static const fltSemantics &EVTToAPFloatSemantics(EVT VT) {
|
|
|
|
switch (VT.getScalarType().getSimpleVT().SimpleTy) {
|
|
|
|
default: llvm_unreachable("Unknown FP format");
|
|
|
|
case MVT::f16: return APFloat::IEEEhalf;
|
|
|
|
case MVT::f32: return APFloat::IEEEsingle;
|
|
|
|
case MVT::f64: return APFloat::IEEEdouble;
|
|
|
|
case MVT::f80: return APFloat::x87DoubleExtended;
|
|
|
|
case MVT::f128: return APFloat::IEEEquad;
|
|
|
|
case MVT::ppcf128: return APFloat::PPCDoubleDouble;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-03-25 01:38:16 +00:00
|
|
|
/// AddDbgValue - Add a dbg_value SDNode. If SD is non-null that means the
|
|
|
|
/// value is produced by SD.
|
2010-04-26 20:06:49 +00:00
|
|
|
void AddDbgValue(SDDbgValue *DB, SDNode *SD, bool isParameter);
|
2010-03-10 22:13:47 +00:00
|
|
|
|
2010-03-25 01:38:16 +00:00
|
|
|
/// GetDbgValues - Get the debug values which reference the given SDNode.
|
2011-06-18 13:13:44 +00:00
|
|
|
ArrayRef<SDDbgValue*> GetDbgValues(const SDNode* SD) {
|
2010-03-25 01:38:16 +00:00
|
|
|
return DbgInfo->getSDDbgValues(SD);
|
|
|
|
}
|
2011-03-07 18:29:47 +00:00
|
|
|
|
2011-01-25 23:27:42 +00:00
|
|
|
/// TransferDbgValues - Transfer SDDbgValues.
|
|
|
|
void TransferDbgValues(SDValue From, SDValue To);
|
2010-03-10 22:13:47 +00:00
|
|
|
|
2010-03-25 01:38:16 +00:00
|
|
|
/// hasDebugValues - Return true if there are any SDDbgValue nodes associated
|
|
|
|
/// with this SelectionDAG.
|
|
|
|
bool hasDebugValues() const { return !DbgInfo->empty(); }
|
2010-03-10 22:13:47 +00:00
|
|
|
|
2010-03-25 01:38:16 +00:00
|
|
|
SDDbgInfo::DbgIterator DbgBegin() { return DbgInfo->DbgBegin(); }
|
|
|
|
SDDbgInfo::DbgIterator DbgEnd() { return DbgInfo->DbgEnd(); }
|
2011-03-07 18:29:47 +00:00
|
|
|
SDDbgInfo::DbgIterator ByvalParmDbgBegin() {
|
|
|
|
return DbgInfo->ByvalParmDbgBegin();
|
2010-04-26 20:06:49 +00:00
|
|
|
}
|
2011-03-07 18:29:47 +00:00
|
|
|
SDDbgInfo::DbgIterator ByvalParmDbgEnd() {
|
|
|
|
return DbgInfo->ByvalParmDbgEnd();
|
2010-04-26 20:06:49 +00:00
|
|
|
}
|
2010-03-10 22:13:47 +00:00
|
|
|
|
2003-08-11 14:56:26 +00:00
|
|
|
void dump() const;
|
2005-01-07 21:08:55 +00:00
|
|
|
|
2007-10-15 17:47:20 +00:00
|
|
|
/// CreateStackTemporary - Create a stack temporary, suitable for holding the
|
2008-07-05 20:40:31 +00:00
|
|
|
/// specified value type. If minAlign is specified, the slot size will have
|
|
|
|
/// at least that alignment.
|
2009-08-10 22:56:29 +00:00
|
|
|
SDValue CreateStackTemporary(EVT VT, unsigned minAlign = 1);
|
2008-12-09 21:33:20 +00:00
|
|
|
|
|
|
|
/// CreateStackTemporary - Create a stack temporary suitable for holding
|
|
|
|
/// either of the specified value types.
|
2009-08-10 22:56:29 +00:00
|
|
|
SDValue CreateStackTemporary(EVT VT1, EVT VT2);
|
2008-12-09 21:33:20 +00:00
|
|
|
|
2009-02-17 22:15:04 +00:00
|
|
|
/// FoldConstantArithmetic -
|
2013-02-04 15:19:18 +00:00
|
|
|
SDValue FoldConstantArithmetic(unsigned Opcode, EVT VT,
|
|
|
|
SDNode *Cst1, SDNode *Cst2);
|
2008-09-24 10:25:02 +00:00
|
|
|
|
2006-10-14 00:41:01 +00:00
|
|
|
/// FoldSetCC - Constant fold a setcc to true or false.
|
2009-08-10 22:56:29 +00:00
|
|
|
SDValue FoldSetCC(EVT VT, SDValue N1,
|
2013-05-25 02:42:55 +00:00
|
|
|
SDValue N2, ISD::CondCode Cond, SDLoc dl);
|
2009-02-17 22:15:04 +00:00
|
|
|
|
2008-02-25 21:11:39 +00:00
|
|
|
/// SignBitIsZero - Return true if the sign bit of Op is known to be zero. We
|
|
|
|
/// use this predicate to simplify operations downstream.
|
2008-07-27 21:46:04 +00:00
|
|
|
bool SignBitIsZero(SDValue Op, unsigned Depth = 0) const;
|
2008-02-25 21:11:39 +00:00
|
|
|
|
2007-06-22 14:59:07 +00:00
|
|
|
/// MaskedValueIsZero - Return true if 'Op & Mask' is known to be zero. We
|
|
|
|
/// use this predicate to simplify operations downstream. Op and Mask are
|
|
|
|
/// known to be the same type.
|
2008-07-27 21:46:04 +00:00
|
|
|
bool MaskedValueIsZero(SDValue Op, const APInt &Mask, unsigned Depth = 0)
|
2007-06-22 14:59:07 +00:00
|
|
|
const;
|
2009-02-17 22:15:04 +00:00
|
|
|
|
2014-05-14 21:14:37 +00:00
|
|
|
/// Determine which bits of Op are known to be either zero or one and return
|
|
|
|
/// them in the KnownZero/KnownOne bitsets. Targets can implement the
|
|
|
|
/// computeKnownBitsForTargetNode method in the TargetLowering class to allow
|
|
|
|
/// target nodes to be understood.
|
|
|
|
void computeKnownBits(SDValue Op, APInt &KnownZero, APInt &KnownOne,
|
|
|
|
unsigned Depth = 0) const;
|
2008-02-13 00:35:47 +00:00
|
|
|
|
2007-06-22 14:59:07 +00:00
|
|
|
/// ComputeNumSignBits - Return the number of times the sign bit of the
|
|
|
|
/// register is replicated into the other bits. We know that at least 1 bit
|
|
|
|
/// is always equal to the sign bit (itself), but other cases can give us
|
|
|
|
/// information. For example, immediately after an "SRA X, 2", we know that
|
|
|
|
/// the top 3 bits are all equal to each other, so we return 3. Targets can
|
|
|
|
/// implement the ComputeNumSignBitsForTarget method in the TargetLowering
|
|
|
|
/// class to allow target nodes to be understood.
|
2008-07-27 21:46:04 +00:00
|
|
|
unsigned ComputeNumSignBits(SDValue Op, unsigned Depth = 0) const;
|
2008-02-02 04:07:54 +00:00
|
|
|
|
2011-02-13 22:30:09 +00:00
|
|
|
/// isBaseWithConstantOffset - Return true if the specified operand is an
|
|
|
|
/// ISD::ADD with a ConstantSDNode on the right-hand side, or if it is an
|
|
|
|
/// ISD::OR with a ConstantSDNode that is guaranteed to have the same
|
|
|
|
/// semantics as an ADD. This handles the equivalence:
|
2012-09-27 10:14:43 +00:00
|
|
|
/// X|Cst == X+Cst iff X&Cst = 0.
|
2011-02-13 22:30:09 +00:00
|
|
|
bool isBaseWithConstantOffset(SDValue Op) const;
|
2011-03-07 18:29:47 +00:00
|
|
|
|
2009-09-03 20:34:31 +00:00
|
|
|
/// isKnownNeverNan - Test whether the given SDValue is known to never be NaN.
|
|
|
|
bool isKnownNeverNaN(SDValue Op) const;
|
|
|
|
|
2010-02-24 06:52:40 +00:00
|
|
|
/// isKnownNeverZero - Test whether the given SDValue is known to never be
|
|
|
|
/// positive or negative Zero.
|
|
|
|
bool isKnownNeverZero(SDValue Op) const;
|
|
|
|
|
|
|
|
/// isEqualTo - Test whether two SDValues are known to compare equal. This
|
|
|
|
/// is true if they are the same value, or if one is negative zero and the
|
|
|
|
/// other positive zero.
|
|
|
|
bool isEqualTo(SDValue A, SDValue B) const;
|
|
|
|
|
2009-11-30 02:42:02 +00:00
|
|
|
/// UnrollVectorOp - Utility function used by legalize and lowering to
|
|
|
|
/// "unroll" a vector operation by splitting out the scalars and operating
|
|
|
|
/// on each element individually. If the ResNE is 0, fully unroll the vector
|
|
|
|
/// op. If ResNE is less than the width of the vector op, unroll up to ResNE.
|
|
|
|
/// If the ResNE is greater than the width of the vector op, unroll the
|
|
|
|
/// vector op and fill the end of the resulting vector with UNDEFS.
|
|
|
|
SDValue UnrollVectorOp(SDNode *N, unsigned ResNE = 0);
|
|
|
|
|
2011-03-07 18:29:47 +00:00
|
|
|
/// isConsecutiveLoad - Return true if LD is loading 'Bytes' bytes from a
|
|
|
|
/// location that is 'Dist' units away from the location that the 'Base' load
|
2009-12-09 01:36:00 +00:00
|
|
|
/// is loading from.
|
|
|
|
bool isConsecutiveLoad(LoadSDNode *LD, LoadSDNode *Base,
|
|
|
|
unsigned Bytes, int Dist) const;
|
|
|
|
|
2009-12-09 01:04:59 +00:00
|
|
|
/// InferPtrAlignment - Infer alignment of a load / store address. Return 0 if
|
|
|
|
/// it cannot be inferred.
|
2009-12-09 01:10:37 +00:00
|
|
|
unsigned InferPtrAlignment(SDValue Ptr) const;
|
2009-12-09 01:04:59 +00:00
|
|
|
|
2013-11-19 21:20:17 +00:00
|
|
|
/// GetSplitDestVTs - Compute the VTs needed for the low/hi parts of a type
|
|
|
|
/// which is split (or expanded) into two not necessarily identical pieces.
|
|
|
|
std::pair<EVT, EVT> GetSplitDestVTs(const EVT &VT) const;
|
|
|
|
|
|
|
|
/// SplitVector - Split the vector with EXTRACT_SUBVECTOR using the provides
|
|
|
|
/// VTs and return the low/high part.
|
|
|
|
std::pair<SDValue, SDValue> SplitVector(const SDValue &N, const SDLoc &DL,
|
|
|
|
const EVT &LoVT, const EVT &HiVT);
|
|
|
|
|
|
|
|
/// SplitVector - Split the vector with EXTRACT_SUBVECTOR and return the
|
|
|
|
/// low/high part.
|
|
|
|
std::pair<SDValue, SDValue> SplitVector(const SDValue &N, const SDLoc &DL) {
|
|
|
|
EVT LoVT, HiVT;
|
2014-03-02 13:30:33 +00:00
|
|
|
std::tie(LoVT, HiVT) = GetSplitDestVTs(N.getValueType());
|
2013-11-19 21:20:17 +00:00
|
|
|
return SplitVector(N, DL, LoVT, HiVT);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// SplitVectorOperand - Split the node's operand with EXTRACT_SUBVECTOR and
|
|
|
|
/// return the low/high part.
|
2013-11-22 00:39:23 +00:00
|
|
|
std::pair<SDValue, SDValue> SplitVectorOperand(const SDNode *N, unsigned OpNo)
|
|
|
|
{
|
2013-11-19 21:20:17 +00:00
|
|
|
return SplitVector(N->getOperand(OpNo), SDLoc(N));
|
|
|
|
}
|
|
|
|
|
2014-04-11 17:47:30 +00:00
|
|
|
/// ExtractVectorElements - Append the extracted elements from Start to Count
|
|
|
|
/// out of the vector Op in Args. If Count is 0, all of the elements will be
|
|
|
|
/// extracted.
|
|
|
|
void ExtractVectorElements(SDValue Op, SmallVectorImpl<SDValue> &Args,
|
|
|
|
unsigned Start = 0, unsigned Count = 0);
|
|
|
|
|
2014-04-15 07:22:52 +00:00
|
|
|
unsigned getEVTAlignment(EVT MemoryVT) const;
|
|
|
|
|
2005-01-07 21:08:55 +00:00
|
|
|
private:
|
2014-07-22 04:07:55 +00:00
|
|
|
void InsertNode(SDNode *N);
|
2008-09-13 01:54:27 +00:00
|
|
|
bool RemoveNodeFromCSEMaps(SDNode *N);
|
2012-04-20 22:08:46 +00:00
|
|
|
void AddModifiedNodeToCSEMaps(SDNode *N);
|
2008-07-27 21:46:04 +00:00
|
|
|
SDNode *FindModifiedNodeSlot(SDNode *N, SDValue Op, void *&InsertPos);
|
|
|
|
SDNode *FindModifiedNodeSlot(SDNode *N, SDValue Op1, SDValue Op2,
|
2006-08-07 23:03:03 +00:00
|
|
|
void *&InsertPos);
|
2014-04-28 05:57:50 +00:00
|
|
|
SDNode *FindModifiedNodeSlot(SDNode *N, ArrayRef<SDValue> Ops,
|
2006-08-07 23:03:03 +00:00
|
|
|
void *&InsertPos);
|
2013-05-25 02:42:55 +00:00
|
|
|
SDNode *UpdadeSDLocOnMergedSDNode(SDNode *N, SDLoc loc);
|
2006-01-28 09:32:01 +00:00
|
|
|
|
2005-09-07 05:36:18 +00:00
|
|
|
void DeleteNodeNotInCSEMaps(SDNode *N);
|
2009-01-19 22:39:36 +00:00
|
|
|
void DeallocateNode(SDNode *N);
|
2008-07-08 23:46:32 +00:00
|
|
|
|
2008-08-23 02:25:05 +00:00
|
|
|
void allnodes_clear();
|
2009-02-17 22:15:04 +00:00
|
|
|
|
2014-06-09 12:32:53 +00:00
|
|
|
BinarySDNode *GetBinarySDNode(unsigned Opcode, SDLoc DL, SDVTList VTs,
|
|
|
|
SDValue N1, SDValue N2, bool nuw, bool nsw,
|
|
|
|
bool exact);
|
|
|
|
|
2009-01-27 17:28:23 +00:00
|
|
|
/// VTList - List of non-single value types.
|
2013-10-22 08:02:02 +00:00
|
|
|
FoldingSet<SDVTListNode> VTListMap;
|
2009-02-17 22:15:04 +00:00
|
|
|
|
2009-01-27 17:28:23 +00:00
|
|
|
/// CondCodeNodes - Maps to auto-CSE operations.
|
2005-08-09 20:20:18 +00:00
|
|
|
std::vector<CondCodeSDNode*> CondCodeNodes;
|
2005-01-14 22:07:46 +00:00
|
|
|
|
2005-07-10 00:07:11 +00:00
|
|
|
std::vector<SDNode*> ValueTypeNodes;
|
2009-08-10 22:56:29 +00:00
|
|
|
std::map<EVT, SDNode*, EVT::compareRawBits> ExtendedValueTypeNodes;
|
2008-09-16 21:48:12 +00:00
|
|
|
StringMap<SDNode*> ExternalSymbols;
|
2011-03-07 18:29:47 +00:00
|
|
|
|
2009-06-25 18:45:50 +00:00
|
|
|
std::map<std::pair<std::string, unsigned char>,SDNode*> TargetExternalSymbols;
|
2003-08-11 14:56:26 +00:00
|
|
|
};
|
|
|
|
|
2005-01-10 23:05:53 +00:00
|
|
|
template <> struct GraphTraits<SelectionDAG*> : public GraphTraits<SDNode*> {
|
|
|
|
typedef SelectionDAG::allnodes_iterator nodes_iterator;
|
|
|
|
static nodes_iterator nodes_begin(SelectionDAG *G) {
|
|
|
|
return G->allnodes_begin();
|
|
|
|
}
|
|
|
|
static nodes_iterator nodes_end(SelectionDAG *G) {
|
|
|
|
return G->allnodes_end();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2005-11-09 23:46:43 +00:00
|
|
|
} // end namespace llvm
|
2003-08-11 14:56:26 +00:00
|
|
|
|
|
|
|
#endif
|