mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-15 00:38:42 +00:00
Access the TargetLoweringInfo from the TargetMachine object instead of caching it. The TLI may change between functions. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184360 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ce1164be37
commit
ba54bca472
@ -129,7 +129,6 @@ void checkForCycles(const SelectionDAG *DAG);
|
|||||||
///
|
///
|
||||||
class SelectionDAG {
|
class SelectionDAG {
|
||||||
const TargetMachine &TM;
|
const TargetMachine &TM;
|
||||||
const TargetLowering &TLI;
|
|
||||||
const TargetSelectionDAGInfo &TSI;
|
const TargetSelectionDAGInfo &TSI;
|
||||||
const TargetTransformInfo *TTI;
|
const TargetTransformInfo *TTI;
|
||||||
MachineFunction *MF;
|
MachineFunction *MF;
|
||||||
@ -232,7 +231,9 @@ public:
|
|||||||
|
|
||||||
MachineFunction &getMachineFunction() const { return *MF; }
|
MachineFunction &getMachineFunction() const { return *MF; }
|
||||||
const TargetMachine &getTarget() const { return TM; }
|
const TargetMachine &getTarget() const { return TM; }
|
||||||
const TargetLowering &getTargetLoweringInfo() const { return TLI; }
|
const TargetLowering &getTargetLoweringInfo() const {
|
||||||
|
return *TM.getTargetLowering();
|
||||||
|
}
|
||||||
const TargetSelectionDAGInfo &getSelectionDAGInfo() const { return TSI; }
|
const TargetSelectionDAGInfo &getSelectionDAGInfo() const { return TSI; }
|
||||||
const TargetTransformInfo *getTargetTransformInfo() const { return TTI; }
|
const TargetTransformInfo *getTargetTransformInfo() const { return TTI; }
|
||||||
LLVMContext *getContext() const {return Context; }
|
LLVMContext *getContext() const {return Context; }
|
||||||
|
@ -30,7 +30,6 @@ namespace llvm {
|
|||||||
class MachineInstr;
|
class MachineInstr;
|
||||||
class TargetLowering;
|
class TargetLowering;
|
||||||
class TargetLibraryInfo;
|
class TargetLibraryInfo;
|
||||||
class TargetInstrInfo;
|
|
||||||
class TargetTransformInfo;
|
class TargetTransformInfo;
|
||||||
class FunctionLoweringInfo;
|
class FunctionLoweringInfo;
|
||||||
class ScheduleHazardRecognizer;
|
class ScheduleHazardRecognizer;
|
||||||
@ -42,8 +41,7 @@ namespace llvm {
|
|||||||
/// pattern-matching instruction selectors.
|
/// pattern-matching instruction selectors.
|
||||||
class SelectionDAGISel : public MachineFunctionPass {
|
class SelectionDAGISel : public MachineFunctionPass {
|
||||||
public:
|
public:
|
||||||
const TargetMachine &TM;
|
TargetMachine &TM;
|
||||||
const TargetLowering *TLI;
|
|
||||||
const TargetLibraryInfo *LibInfo;
|
const TargetLibraryInfo *LibInfo;
|
||||||
const TargetTransformInfo *TTI;
|
const TargetTransformInfo *TTI;
|
||||||
FunctionLoweringInfo *FuncInfo;
|
FunctionLoweringInfo *FuncInfo;
|
||||||
@ -56,11 +54,13 @@ public:
|
|||||||
CodeGenOpt::Level OptLevel;
|
CodeGenOpt::Level OptLevel;
|
||||||
static char ID;
|
static char ID;
|
||||||
|
|
||||||
explicit SelectionDAGISel(const TargetMachine &tm,
|
explicit SelectionDAGISel(TargetMachine &tm,
|
||||||
CodeGenOpt::Level OL = CodeGenOpt::Default);
|
CodeGenOpt::Level OL = CodeGenOpt::Default);
|
||||||
virtual ~SelectionDAGISel();
|
virtual ~SelectionDAGISel();
|
||||||
|
|
||||||
const TargetLowering *getTargetLowering() { return TLI; }
|
const TargetLowering *getTargetLowering() const {
|
||||||
|
return TM.getTargetLowering();
|
||||||
|
}
|
||||||
|
|
||||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const;
|
virtual void getAnalysisUsage(AnalysisUsage &AU) const;
|
||||||
|
|
||||||
|
@ -864,14 +864,13 @@ unsigned SelectionDAG::getEVTAlignment(EVT VT) const {
|
|||||||
PointerType::get(Type::getInt8Ty(*getContext()), 0) :
|
PointerType::get(Type::getInt8Ty(*getContext()), 0) :
|
||||||
VT.getTypeForEVT(*getContext());
|
VT.getTypeForEVT(*getContext());
|
||||||
|
|
||||||
return TLI.getDataLayout()->getABITypeAlignment(Ty);
|
return TM.getTargetLowering()->getDataLayout()->getABITypeAlignment(Ty);
|
||||||
}
|
}
|
||||||
|
|
||||||
// EntryNode could meaningfully have debug info if we can find it...
|
// EntryNode could meaningfully have debug info if we can find it...
|
||||||
SelectionDAG::SelectionDAG(const TargetMachine &tm, CodeGenOpt::Level OL)
|
SelectionDAG::SelectionDAG(const TargetMachine &tm, CodeGenOpt::Level OL)
|
||||||
: TM(tm), TLI(*tm.getTargetLowering()), TSI(*tm.getSelectionDAGInfo()),
|
: TM(tm), TSI(*tm.getSelectionDAGInfo()), TTI(0), OptLevel(OL),
|
||||||
TTI(0), OptLevel(OL), EntryNode(ISD::EntryToken, 0, DebugLoc(),
|
EntryNode(ISD::EntryToken, 0, DebugLoc(), getVTList(MVT::Other)),
|
||||||
getVTList(MVT::Other)),
|
|
||||||
Root(getEntryNode()), UpdateListeners(0) {
|
Root(getEntryNode()), UpdateListeners(0) {
|
||||||
AllNodes.push_back(&EntryNode);
|
AllNodes.push_back(&EntryNode);
|
||||||
DbgInfo = new SDDbgInfo();
|
DbgInfo = new SDDbgInfo();
|
||||||
@ -972,13 +971,15 @@ SDValue SelectionDAG::getConstant(const ConstantInt &Val, EVT VT, bool isT) {
|
|||||||
EVT EltVT = VT.getScalarType();
|
EVT EltVT = VT.getScalarType();
|
||||||
const ConstantInt *Elt = &Val;
|
const ConstantInt *Elt = &Val;
|
||||||
|
|
||||||
|
const TargetLowering *TLI = TM.getTargetLowering();
|
||||||
|
|
||||||
// In some cases the vector type is legal but the element type is illegal and
|
// In some cases the vector type is legal but the element type is illegal and
|
||||||
// needs to be promoted, for example v8i8 on ARM. In this case, promote the
|
// needs to be promoted, for example v8i8 on ARM. In this case, promote the
|
||||||
// inserted value (the type does not need to match the vector element type).
|
// inserted value (the type does not need to match the vector element type).
|
||||||
// Any extra bits introduced will be truncated away.
|
// Any extra bits introduced will be truncated away.
|
||||||
if (VT.isVector() && TLI.getTypeAction(*getContext(), EltVT) ==
|
if (VT.isVector() && TLI->getTypeAction(*getContext(), EltVT) ==
|
||||||
TargetLowering::TypePromoteInteger) {
|
TargetLowering::TypePromoteInteger) {
|
||||||
EltVT = TLI.getTypeToTransformTo(*getContext(), EltVT);
|
EltVT = TLI->getTypeToTransformTo(*getContext(), EltVT);
|
||||||
APInt NewVal = Elt->getValue().zext(EltVT.getSizeInBits());
|
APInt NewVal = Elt->getValue().zext(EltVT.getSizeInBits());
|
||||||
Elt = ConstantInt::get(*getContext(), NewVal);
|
Elt = ConstantInt::get(*getContext(), NewVal);
|
||||||
}
|
}
|
||||||
@ -1011,7 +1012,7 @@ SDValue SelectionDAG::getConstant(const ConstantInt &Val, EVT VT, bool isT) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SDValue SelectionDAG::getIntPtrConstant(uint64_t Val, bool isTarget) {
|
SDValue SelectionDAG::getIntPtrConstant(uint64_t Val, bool isTarget) {
|
||||||
return getConstant(Val, TLI.getPointerTy(), isTarget);
|
return getConstant(Val, TM.getTargetLowering()->getPointerTy(), isTarget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1078,7 +1079,7 @@ SDValue SelectionDAG::getGlobalAddress(const GlobalValue *GV, SDLoc DL,
|
|||||||
"Cannot set target flags on target-independent globals");
|
"Cannot set target flags on target-independent globals");
|
||||||
|
|
||||||
// Truncate (with sign-extension) the offset value to the pointer size.
|
// Truncate (with sign-extension) the offset value to the pointer size.
|
||||||
unsigned BitWidth = TLI.getPointerTy().getSizeInBits();
|
unsigned BitWidth = TM.getTargetLowering()->getPointerTy().getSizeInBits();
|
||||||
if (BitWidth < 64)
|
if (BitWidth < 64)
|
||||||
Offset = SignExtend64(Offset, BitWidth);
|
Offset = SignExtend64(Offset, BitWidth);
|
||||||
|
|
||||||
@ -1155,7 +1156,8 @@ SDValue SelectionDAG::getConstantPool(const Constant *C, EVT VT,
|
|||||||
assert((TargetFlags == 0 || isTarget) &&
|
assert((TargetFlags == 0 || isTarget) &&
|
||||||
"Cannot set target flags on target-independent globals");
|
"Cannot set target flags on target-independent globals");
|
||||||
if (Alignment == 0)
|
if (Alignment == 0)
|
||||||
Alignment = TLI.getDataLayout()->getPrefTypeAlignment(C->getType());
|
Alignment =
|
||||||
|
TM.getTargetLowering()->getDataLayout()->getPrefTypeAlignment(C->getType());
|
||||||
unsigned Opc = isTarget ? ISD::TargetConstantPool : ISD::ConstantPool;
|
unsigned Opc = isTarget ? ISD::TargetConstantPool : ISD::ConstantPool;
|
||||||
FoldingSetNodeID ID;
|
FoldingSetNodeID ID;
|
||||||
AddNodeIDNode(ID, Opc, getVTList(VT), 0, 0);
|
AddNodeIDNode(ID, Opc, getVTList(VT), 0, 0);
|
||||||
@ -1182,7 +1184,8 @@ SDValue SelectionDAG::getConstantPool(MachineConstantPoolValue *C, EVT VT,
|
|||||||
assert((TargetFlags == 0 || isTarget) &&
|
assert((TargetFlags == 0 || isTarget) &&
|
||||||
"Cannot set target flags on target-independent globals");
|
"Cannot set target flags on target-independent globals");
|
||||||
if (Alignment == 0)
|
if (Alignment == 0)
|
||||||
Alignment = TLI.getDataLayout()->getPrefTypeAlignment(C->getType());
|
Alignment =
|
||||||
|
TM.getTargetLowering()->getDataLayout()->getPrefTypeAlignment(C->getType());
|
||||||
unsigned Opc = isTarget ? ISD::TargetConstantPool : ISD::ConstantPool;
|
unsigned Opc = isTarget ? ISD::TargetConstantPool : ISD::ConstantPool;
|
||||||
FoldingSetNodeID ID;
|
FoldingSetNodeID ID;
|
||||||
AddNodeIDNode(ID, Opc, getVTList(VT), 0, 0);
|
AddNodeIDNode(ID, Opc, getVTList(VT), 0, 0);
|
||||||
@ -1512,7 +1515,7 @@ SDValue SelectionDAG::getMDNode(const MDNode *MD) {
|
|||||||
/// the target's desired shift amount type.
|
/// the target's desired shift amount type.
|
||||||
SDValue SelectionDAG::getShiftAmountOperand(EVT LHSTy, SDValue Op) {
|
SDValue SelectionDAG::getShiftAmountOperand(EVT LHSTy, SDValue Op) {
|
||||||
EVT OpTy = Op.getValueType();
|
EVT OpTy = Op.getValueType();
|
||||||
EVT ShTy = TLI.getShiftAmountTy(LHSTy);
|
EVT ShTy = TM.getTargetLowering()->getShiftAmountTy(LHSTy);
|
||||||
if (OpTy == ShTy || OpTy.isVector()) return Op;
|
if (OpTy == ShTy || OpTy.isVector()) return Op;
|
||||||
|
|
||||||
ISD::NodeType Opcode = OpTy.bitsGT(ShTy) ? ISD::TRUNCATE : ISD::ZERO_EXTEND;
|
ISD::NodeType Opcode = OpTy.bitsGT(ShTy) ? ISD::TRUNCATE : ISD::ZERO_EXTEND;
|
||||||
@ -1525,11 +1528,12 @@ SDValue SelectionDAG::CreateStackTemporary(EVT VT, unsigned minAlign) {
|
|||||||
MachineFrameInfo *FrameInfo = getMachineFunction().getFrameInfo();
|
MachineFrameInfo *FrameInfo = getMachineFunction().getFrameInfo();
|
||||||
unsigned ByteSize = VT.getStoreSize();
|
unsigned ByteSize = VT.getStoreSize();
|
||||||
Type *Ty = VT.getTypeForEVT(*getContext());
|
Type *Ty = VT.getTypeForEVT(*getContext());
|
||||||
|
const TargetLowering *TLI = TM.getTargetLowering();
|
||||||
unsigned StackAlign =
|
unsigned StackAlign =
|
||||||
std::max((unsigned)TLI.getDataLayout()->getPrefTypeAlignment(Ty), minAlign);
|
std::max((unsigned)TLI->getDataLayout()->getPrefTypeAlignment(Ty), minAlign);
|
||||||
|
|
||||||
int FrameIdx = FrameInfo->CreateStackObject(ByteSize, StackAlign, false);
|
int FrameIdx = FrameInfo->CreateStackObject(ByteSize, StackAlign, false);
|
||||||
return getFrameIndex(FrameIdx, TLI.getPointerTy());
|
return getFrameIndex(FrameIdx, TLI->getPointerTy());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// CreateStackTemporary - Create a stack temporary suitable for holding
|
/// CreateStackTemporary - Create a stack temporary suitable for holding
|
||||||
@ -1539,13 +1543,14 @@ SDValue SelectionDAG::CreateStackTemporary(EVT VT1, EVT VT2) {
|
|||||||
VT2.getStoreSizeInBits())/8;
|
VT2.getStoreSizeInBits())/8;
|
||||||
Type *Ty1 = VT1.getTypeForEVT(*getContext());
|
Type *Ty1 = VT1.getTypeForEVT(*getContext());
|
||||||
Type *Ty2 = VT2.getTypeForEVT(*getContext());
|
Type *Ty2 = VT2.getTypeForEVT(*getContext());
|
||||||
const DataLayout *TD = TLI.getDataLayout();
|
const TargetLowering *TLI = TM.getTargetLowering();
|
||||||
|
const DataLayout *TD = TLI->getDataLayout();
|
||||||
unsigned Align = std::max(TD->getPrefTypeAlignment(Ty1),
|
unsigned Align = std::max(TD->getPrefTypeAlignment(Ty1),
|
||||||
TD->getPrefTypeAlignment(Ty2));
|
TD->getPrefTypeAlignment(Ty2));
|
||||||
|
|
||||||
MachineFrameInfo *FrameInfo = getMachineFunction().getFrameInfo();
|
MachineFrameInfo *FrameInfo = getMachineFunction().getFrameInfo();
|
||||||
int FrameIdx = FrameInfo->CreateStackObject(Bytes, Align, false);
|
int FrameIdx = FrameInfo->CreateStackObject(Bytes, Align, false);
|
||||||
return getFrameIndex(FrameIdx, TLI.getPointerTy());
|
return getFrameIndex(FrameIdx, TLI->getPointerTy());
|
||||||
}
|
}
|
||||||
|
|
||||||
SDValue SelectionDAG::FoldSetCC(EVT VT, SDValue N1,
|
SDValue SelectionDAG::FoldSetCC(EVT VT, SDValue N1,
|
||||||
@ -1674,6 +1679,7 @@ bool SelectionDAG::MaskedValueIsZero(SDValue Op, const APInt &Mask,
|
|||||||
/// processing.
|
/// processing.
|
||||||
void SelectionDAG::ComputeMaskedBits(SDValue Op, APInt &KnownZero,
|
void SelectionDAG::ComputeMaskedBits(SDValue Op, APInt &KnownZero,
|
||||||
APInt &KnownOne, unsigned Depth) const {
|
APInt &KnownOne, unsigned Depth) const {
|
||||||
|
const TargetLowering *TLI = TM.getTargetLowering();
|
||||||
unsigned BitWidth = Op.getValueType().getScalarType().getSizeInBits();
|
unsigned BitWidth = Op.getValueType().getScalarType().getSizeInBits();
|
||||||
|
|
||||||
KnownZero = KnownOne = APInt(BitWidth, 0); // Don't know anything.
|
KnownZero = KnownOne = APInt(BitWidth, 0); // Don't know anything.
|
||||||
@ -1796,7 +1802,7 @@ void SelectionDAG::ComputeMaskedBits(SDValue Op, APInt &KnownZero,
|
|||||||
// The boolean result conforms to getBooleanContents. Fall through.
|
// The boolean result conforms to getBooleanContents. Fall through.
|
||||||
case ISD::SETCC:
|
case ISD::SETCC:
|
||||||
// If we know the result of a setcc has the top bits zero, use this info.
|
// If we know the result of a setcc has the top bits zero, use this info.
|
||||||
if (TLI.getBooleanContents(Op.getValueType().isVector()) ==
|
if (TLI->getBooleanContents(Op.getValueType().isVector()) ==
|
||||||
TargetLowering::ZeroOrOneBooleanContent && BitWidth > 1)
|
TargetLowering::ZeroOrOneBooleanContent && BitWidth > 1)
|
||||||
KnownZero |= APInt::getHighBitsSet(BitWidth, BitWidth - 1);
|
KnownZero |= APInt::getHighBitsSet(BitWidth, BitWidth - 1);
|
||||||
return;
|
return;
|
||||||
@ -2108,7 +2114,7 @@ void SelectionDAG::ComputeMaskedBits(SDValue Op, APInt &KnownZero,
|
|||||||
case ISD::INTRINSIC_W_CHAIN:
|
case ISD::INTRINSIC_W_CHAIN:
|
||||||
case ISD::INTRINSIC_VOID:
|
case ISD::INTRINSIC_VOID:
|
||||||
// Allow the target to implement this method for its nodes.
|
// Allow the target to implement this method for its nodes.
|
||||||
TLI.computeMaskedBitsForTargetNode(Op, KnownZero, KnownOne, *this, Depth);
|
TLI->computeMaskedBitsForTargetNode(Op, KnownZero, KnownOne, *this, Depth);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2119,6 +2125,7 @@ void SelectionDAG::ComputeMaskedBits(SDValue Op, APInt &KnownZero,
|
|||||||
/// information. For example, immediately after an "SRA X, 2", we know that
|
/// 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.
|
/// the top 3 bits are all equal to each other, so we return 3.
|
||||||
unsigned SelectionDAG::ComputeNumSignBits(SDValue Op, unsigned Depth) const{
|
unsigned SelectionDAG::ComputeNumSignBits(SDValue Op, unsigned Depth) const{
|
||||||
|
const TargetLowering *TLI = TM.getTargetLowering();
|
||||||
EVT VT = Op.getValueType();
|
EVT VT = Op.getValueType();
|
||||||
assert(VT.isInteger() && "Invalid VT!");
|
assert(VT.isInteger() && "Invalid VT!");
|
||||||
unsigned VTBits = VT.getScalarType().getSizeInBits();
|
unsigned VTBits = VT.getScalarType().getSizeInBits();
|
||||||
@ -2203,7 +2210,7 @@ unsigned SelectionDAG::ComputeNumSignBits(SDValue Op, unsigned Depth) const{
|
|||||||
// The boolean result conforms to getBooleanContents. Fall through.
|
// The boolean result conforms to getBooleanContents. Fall through.
|
||||||
case ISD::SETCC:
|
case ISD::SETCC:
|
||||||
// If setcc returns 0/-1, all bits are sign bits.
|
// If setcc returns 0/-1, all bits are sign bits.
|
||||||
if (TLI.getBooleanContents(Op.getValueType().isVector()) ==
|
if (TLI->getBooleanContents(Op.getValueType().isVector()) ==
|
||||||
TargetLowering::ZeroOrNegativeOneBooleanContent)
|
TargetLowering::ZeroOrNegativeOneBooleanContent)
|
||||||
return VTBits;
|
return VTBits;
|
||||||
break;
|
break;
|
||||||
@ -2304,7 +2311,7 @@ unsigned SelectionDAG::ComputeNumSignBits(SDValue Op, unsigned Depth) const{
|
|||||||
Op.getOpcode() == ISD::INTRINSIC_WO_CHAIN ||
|
Op.getOpcode() == ISD::INTRINSIC_WO_CHAIN ||
|
||||||
Op.getOpcode() == ISD::INTRINSIC_W_CHAIN ||
|
Op.getOpcode() == ISD::INTRINSIC_W_CHAIN ||
|
||||||
Op.getOpcode() == ISD::INTRINSIC_VOID) {
|
Op.getOpcode() == ISD::INTRINSIC_VOID) {
|
||||||
unsigned NumBits = TLI.ComputeNumSignBitsForTargetNode(Op, Depth);
|
unsigned NumBits = TLI->ComputeNumSignBitsForTargetNode(Op, Depth);
|
||||||
if (NumBits > 1) FirstAnswer = std::max(FirstAnswer, NumBits);
|
if (NumBits > 1) FirstAnswer = std::max(FirstAnswer, NumBits);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3923,10 +3930,12 @@ SDValue SelectionDAG::getMemcpy(SDValue Chain, SDLoc dl, SDValue Dst,
|
|||||||
// beyond the given memory regions. But fixing this isn't easy, and most
|
// beyond the given memory regions. But fixing this isn't easy, and most
|
||||||
// people don't care.
|
// people don't care.
|
||||||
|
|
||||||
|
const TargetLowering *TLI = TM.getTargetLowering();
|
||||||
|
|
||||||
// Emit a library call.
|
// Emit a library call.
|
||||||
TargetLowering::ArgListTy Args;
|
TargetLowering::ArgListTy Args;
|
||||||
TargetLowering::ArgListEntry Entry;
|
TargetLowering::ArgListEntry Entry;
|
||||||
Entry.Ty = TLI.getDataLayout()->getIntPtrType(*getContext());
|
Entry.Ty = TLI->getDataLayout()->getIntPtrType(*getContext());
|
||||||
Entry.Node = Dst; Args.push_back(Entry);
|
Entry.Node = Dst; Args.push_back(Entry);
|
||||||
Entry.Node = Src; Args.push_back(Entry);
|
Entry.Node = Src; Args.push_back(Entry);
|
||||||
Entry.Node = Size; Args.push_back(Entry);
|
Entry.Node = Size; Args.push_back(Entry);
|
||||||
@ -3934,13 +3943,13 @@ SDValue SelectionDAG::getMemcpy(SDValue Chain, SDLoc dl, SDValue Dst,
|
|||||||
TargetLowering::
|
TargetLowering::
|
||||||
CallLoweringInfo CLI(Chain, Type::getVoidTy(*getContext()),
|
CallLoweringInfo CLI(Chain, Type::getVoidTy(*getContext()),
|
||||||
false, false, false, false, 0,
|
false, false, false, false, 0,
|
||||||
TLI.getLibcallCallingConv(RTLIB::MEMCPY),
|
TLI->getLibcallCallingConv(RTLIB::MEMCPY),
|
||||||
/*isTailCall=*/false,
|
/*isTailCall=*/false,
|
||||||
/*doesNotReturn=*/false, /*isReturnValueUsed=*/false,
|
/*doesNotReturn=*/false, /*isReturnValueUsed=*/false,
|
||||||
getExternalSymbol(TLI.getLibcallName(RTLIB::MEMCPY),
|
getExternalSymbol(TLI->getLibcallName(RTLIB::MEMCPY),
|
||||||
TLI.getPointerTy()),
|
TLI->getPointerTy()),
|
||||||
Args, *this, dl);
|
Args, *this, dl);
|
||||||
std::pair<SDValue,SDValue> CallResult = TLI.LowerCallTo(CLI);
|
std::pair<SDValue,SDValue> CallResult = TLI->LowerCallTo(CLI);
|
||||||
|
|
||||||
return CallResult.second;
|
return CallResult.second;
|
||||||
}
|
}
|
||||||
@ -3979,10 +3988,12 @@ SDValue SelectionDAG::getMemmove(SDValue Chain, SDLoc dl, SDValue Dst,
|
|||||||
// FIXME: If the memmove is volatile, lowering it to plain libc memmove may
|
// FIXME: If the memmove is volatile, lowering it to plain libc memmove may
|
||||||
// not be safe. See memcpy above for more details.
|
// not be safe. See memcpy above for more details.
|
||||||
|
|
||||||
|
const TargetLowering *TLI = TM.getTargetLowering();
|
||||||
|
|
||||||
// Emit a library call.
|
// Emit a library call.
|
||||||
TargetLowering::ArgListTy Args;
|
TargetLowering::ArgListTy Args;
|
||||||
TargetLowering::ArgListEntry Entry;
|
TargetLowering::ArgListEntry Entry;
|
||||||
Entry.Ty = TLI.getDataLayout()->getIntPtrType(*getContext());
|
Entry.Ty = TLI->getDataLayout()->getIntPtrType(*getContext());
|
||||||
Entry.Node = Dst; Args.push_back(Entry);
|
Entry.Node = Dst; Args.push_back(Entry);
|
||||||
Entry.Node = Src; Args.push_back(Entry);
|
Entry.Node = Src; Args.push_back(Entry);
|
||||||
Entry.Node = Size; Args.push_back(Entry);
|
Entry.Node = Size; Args.push_back(Entry);
|
||||||
@ -3990,13 +4001,13 @@ SDValue SelectionDAG::getMemmove(SDValue Chain, SDLoc dl, SDValue Dst,
|
|||||||
TargetLowering::
|
TargetLowering::
|
||||||
CallLoweringInfo CLI(Chain, Type::getVoidTy(*getContext()),
|
CallLoweringInfo CLI(Chain, Type::getVoidTy(*getContext()),
|
||||||
false, false, false, false, 0,
|
false, false, false, false, 0,
|
||||||
TLI.getLibcallCallingConv(RTLIB::MEMMOVE),
|
TLI->getLibcallCallingConv(RTLIB::MEMMOVE),
|
||||||
/*isTailCall=*/false,
|
/*isTailCall=*/false,
|
||||||
/*doesNotReturn=*/false, /*isReturnValueUsed=*/false,
|
/*doesNotReturn=*/false, /*isReturnValueUsed=*/false,
|
||||||
getExternalSymbol(TLI.getLibcallName(RTLIB::MEMMOVE),
|
getExternalSymbol(TLI->getLibcallName(RTLIB::MEMMOVE),
|
||||||
TLI.getPointerTy()),
|
TLI->getPointerTy()),
|
||||||
Args, *this, dl);
|
Args, *this, dl);
|
||||||
std::pair<SDValue,SDValue> CallResult = TLI.LowerCallTo(CLI);
|
std::pair<SDValue,SDValue> CallResult = TLI->LowerCallTo(CLI);
|
||||||
|
|
||||||
return CallResult.second;
|
return CallResult.second;
|
||||||
}
|
}
|
||||||
@ -4032,7 +4043,8 @@ SDValue SelectionDAG::getMemset(SDValue Chain, SDLoc dl, SDValue Dst,
|
|||||||
return Result;
|
return Result;
|
||||||
|
|
||||||
// Emit a library call.
|
// Emit a library call.
|
||||||
Type *IntPtrTy = TLI.getDataLayout()->getIntPtrType(*getContext());
|
const TargetLowering *TLI = TM.getTargetLowering();
|
||||||
|
Type *IntPtrTy = TLI->getDataLayout()->getIntPtrType(*getContext());
|
||||||
TargetLowering::ArgListTy Args;
|
TargetLowering::ArgListTy Args;
|
||||||
TargetLowering::ArgListEntry Entry;
|
TargetLowering::ArgListEntry Entry;
|
||||||
Entry.Node = Dst; Entry.Ty = IntPtrTy;
|
Entry.Node = Dst; Entry.Ty = IntPtrTy;
|
||||||
@ -4054,13 +4066,13 @@ SDValue SelectionDAG::getMemset(SDValue Chain, SDLoc dl, SDValue Dst,
|
|||||||
TargetLowering::
|
TargetLowering::
|
||||||
CallLoweringInfo CLI(Chain, Type::getVoidTy(*getContext()),
|
CallLoweringInfo CLI(Chain, Type::getVoidTy(*getContext()),
|
||||||
false, false, false, false, 0,
|
false, false, false, false, 0,
|
||||||
TLI.getLibcallCallingConv(RTLIB::MEMSET),
|
TLI->getLibcallCallingConv(RTLIB::MEMSET),
|
||||||
/*isTailCall=*/false,
|
/*isTailCall=*/false,
|
||||||
/*doesNotReturn*/false, /*isReturnValueUsed=*/false,
|
/*doesNotReturn*/false, /*isReturnValueUsed=*/false,
|
||||||
getExternalSymbol(TLI.getLibcallName(RTLIB::MEMSET),
|
getExternalSymbol(TLI->getLibcallName(RTLIB::MEMSET),
|
||||||
TLI.getPointerTy()),
|
TLI->getPointerTy()),
|
||||||
Args, *this, dl);
|
Args, *this, dl);
|
||||||
std::pair<SDValue,SDValue> CallResult = TLI.LowerCallTo(CLI);
|
std::pair<SDValue,SDValue> CallResult = TLI->LowerCallTo(CLI);
|
||||||
|
|
||||||
return CallResult.second;
|
return CallResult.second;
|
||||||
}
|
}
|
||||||
@ -6122,11 +6134,12 @@ SDValue SelectionDAG::UnrollVectorOp(SDNode *N, unsigned ResNE) {
|
|||||||
EVT OperandVT = Operand.getValueType();
|
EVT OperandVT = Operand.getValueType();
|
||||||
if (OperandVT.isVector()) {
|
if (OperandVT.isVector()) {
|
||||||
// A vector operand; extract a single element.
|
// A vector operand; extract a single element.
|
||||||
|
const TargetLowering *TLI = TM.getTargetLowering();
|
||||||
EVT OperandEltVT = OperandVT.getVectorElementType();
|
EVT OperandEltVT = OperandVT.getVectorElementType();
|
||||||
Operands[j] = getNode(ISD::EXTRACT_VECTOR_ELT, dl,
|
Operands[j] = getNode(ISD::EXTRACT_VECTOR_ELT, dl,
|
||||||
OperandEltVT,
|
OperandEltVT,
|
||||||
Operand,
|
Operand,
|
||||||
getConstant(i, TLI.getPointerTy()));
|
getConstant(i, TLI->getPointerTy()));
|
||||||
} else {
|
} else {
|
||||||
// A scalar operand; just use it as is.
|
// A scalar operand; just use it as is.
|
||||||
Operands[j] = Operand;
|
Operands[j] = Operand;
|
||||||
@ -6204,8 +6217,9 @@ bool SelectionDAG::isConsecutiveLoad(LoadSDNode *LD, LoadSDNode *Base,
|
|||||||
const GlobalValue *GV2 = NULL;
|
const GlobalValue *GV2 = NULL;
|
||||||
int64_t Offset1 = 0;
|
int64_t Offset1 = 0;
|
||||||
int64_t Offset2 = 0;
|
int64_t Offset2 = 0;
|
||||||
bool isGA1 = TLI.isGAPlusOffset(Loc.getNode(), GV1, Offset1);
|
const TargetLowering *TLI = TM.getTargetLowering();
|
||||||
bool isGA2 = TLI.isGAPlusOffset(BaseLoc.getNode(), GV2, Offset2);
|
bool isGA1 = TLI->isGAPlusOffset(Loc.getNode(), GV1, Offset1);
|
||||||
|
bool isGA2 = TLI->isGAPlusOffset(BaseLoc.getNode(), GV2, Offset2);
|
||||||
if (isGA1 && isGA2 && GV1 == GV2)
|
if (isGA1 && isGA2 && GV1 == GV2)
|
||||||
return Offset1 == (Offset2 + Dist*Bytes);
|
return Offset1 == (Offset2 + Dist*Bytes);
|
||||||
return false;
|
return false;
|
||||||
@ -6218,11 +6232,12 @@ unsigned SelectionDAG::InferPtrAlignment(SDValue Ptr) const {
|
|||||||
// If this is a GlobalAddress + cst, return the alignment.
|
// If this is a GlobalAddress + cst, return the alignment.
|
||||||
const GlobalValue *GV;
|
const GlobalValue *GV;
|
||||||
int64_t GVOffset = 0;
|
int64_t GVOffset = 0;
|
||||||
if (TLI.isGAPlusOffset(Ptr.getNode(), GV, GVOffset)) {
|
const TargetLowering *TLI = TM.getTargetLowering();
|
||||||
unsigned PtrWidth = TLI.getPointerTy().getSizeInBits();
|
if (TLI->isGAPlusOffset(Ptr.getNode(), GV, GVOffset)) {
|
||||||
|
unsigned PtrWidth = TLI->getPointerTy().getSizeInBits();
|
||||||
APInt KnownZero(PtrWidth, 0), KnownOne(PtrWidth, 0);
|
APInt KnownZero(PtrWidth, 0), KnownOne(PtrWidth, 0);
|
||||||
llvm::ComputeMaskedBits(const_cast<GlobalValue*>(GV), KnownZero, KnownOne,
|
llvm::ComputeMaskedBits(const_cast<GlobalValue*>(GV), KnownZero, KnownOne,
|
||||||
TLI.getDataLayout());
|
TLI->getDataLayout());
|
||||||
unsigned AlignBits = KnownZero.countTrailingOnes();
|
unsigned AlignBits = KnownZero.countTrailingOnes();
|
||||||
unsigned Align = AlignBits ? 1 << std::min(31U, AlignBits) : 0;
|
unsigned Align = AlignBits ? 1 << std::min(31U, AlignBits) : 0;
|
||||||
if (Align)
|
if (Align)
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -278,12 +278,9 @@ private:
|
|||||||
BitTestInfo Cases;
|
BitTestInfo Cases;
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
private:
|
||||||
// TLI - This is information that describes the available target features we
|
|
||||||
// need for lowering. This indicates when operations are unavailable,
|
|
||||||
// implemented with a libcall, etc.
|
|
||||||
const TargetMachine &TM;
|
const TargetMachine &TM;
|
||||||
const TargetLowering &TLI;
|
public:
|
||||||
SelectionDAG &DAG;
|
SelectionDAG &DAG;
|
||||||
const DataLayout *TD;
|
const DataLayout *TD;
|
||||||
AliasAnalysis *AA;
|
AliasAnalysis *AA;
|
||||||
@ -328,7 +325,6 @@ public:
|
|||||||
SelectionDAGBuilder(SelectionDAG &dag, FunctionLoweringInfo &funcinfo,
|
SelectionDAGBuilder(SelectionDAG &dag, FunctionLoweringInfo &funcinfo,
|
||||||
CodeGenOpt::Level ol)
|
CodeGenOpt::Level ol)
|
||||||
: CurInst(NULL), SDNodeOrder(0), TM(dag.getTarget()),
|
: CurInst(NULL), SDNodeOrder(0), TM(dag.getTarget()),
|
||||||
TLI(dag.getTargetLoweringInfo()),
|
|
||||||
DAG(dag), FuncInfo(funcinfo), OptLevel(ol),
|
DAG(dag), FuncInfo(funcinfo), OptLevel(ol),
|
||||||
HasTailCall(false) {
|
HasTailCall(false) {
|
||||||
}
|
}
|
||||||
|
@ -275,9 +275,9 @@ void TargetLowering::AdjustInstrPostInstrSelection(MachineInstr *MI,
|
|||||||
// SelectionDAGISel code
|
// SelectionDAGISel code
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
SelectionDAGISel::SelectionDAGISel(const TargetMachine &tm,
|
SelectionDAGISel::SelectionDAGISel(TargetMachine &tm,
|
||||||
CodeGenOpt::Level OL) :
|
CodeGenOpt::Level OL) :
|
||||||
MachineFunctionPass(ID), TM(tm), TLI(tm.getTargetLowering()),
|
MachineFunctionPass(ID), TM(tm),
|
||||||
FuncInfo(new FunctionLoweringInfo(TM)),
|
FuncInfo(new FunctionLoweringInfo(TM)),
|
||||||
CurDAG(new SelectionDAG(tm, OL)),
|
CurDAG(new SelectionDAG(tm, OL)),
|
||||||
SDB(new SelectionDAGBuilder(*CurDAG, *FuncInfo, OL)),
|
SDB(new SelectionDAGBuilder(*CurDAG, *FuncInfo, OL)),
|
||||||
@ -828,6 +828,7 @@ void SelectionDAGISel::PrepareEHLandingPad() {
|
|||||||
.addSym(Label);
|
.addSym(Label);
|
||||||
|
|
||||||
// Mark exception register as live in.
|
// Mark exception register as live in.
|
||||||
|
const TargetLowering *TLI = getTargetLowering();
|
||||||
unsigned Reg = TLI->getExceptionPointerRegister();
|
unsigned Reg = TLI->getExceptionPointerRegister();
|
||||||
if (Reg) MBB->addLiveIn(Reg);
|
if (Reg) MBB->addLiveIn(Reg);
|
||||||
|
|
||||||
@ -932,7 +933,7 @@ void SelectionDAGISel::SelectAllBasicBlocks(const Function &Fn) {
|
|||||||
// Initialize the Fast-ISel state, if needed.
|
// Initialize the Fast-ISel state, if needed.
|
||||||
FastISel *FastIS = 0;
|
FastISel *FastIS = 0;
|
||||||
if (TM.Options.EnableFastISel)
|
if (TM.Options.EnableFastISel)
|
||||||
FastIS = TLI->createFastISel(*FuncInfo, LibInfo);
|
FastIS = getTargetLowering()->createFastISel(*FuncInfo, LibInfo);
|
||||||
|
|
||||||
// Iterate over all basic blocks in the function.
|
// Iterate over all basic blocks in the function.
|
||||||
ReversePostOrderTraversal<const Function*> RPOT(&Fn);
|
ReversePostOrderTraversal<const Function*> RPOT(&Fn);
|
||||||
@ -2079,7 +2080,7 @@ static unsigned IsPredicateKnownToFail(const unsigned char *Table,
|
|||||||
Result = !::CheckOpcode(Table, Index, N.getNode());
|
Result = !::CheckOpcode(Table, Index, N.getNode());
|
||||||
return Index;
|
return Index;
|
||||||
case SelectionDAGISel::OPC_CheckType:
|
case SelectionDAGISel::OPC_CheckType:
|
||||||
Result = !::CheckType(Table, Index, N, SDISel.TLI);
|
Result = !::CheckType(Table, Index, N, SDISel.getTargetLowering());
|
||||||
return Index;
|
return Index;
|
||||||
case SelectionDAGISel::OPC_CheckChild0Type:
|
case SelectionDAGISel::OPC_CheckChild0Type:
|
||||||
case SelectionDAGISel::OPC_CheckChild1Type:
|
case SelectionDAGISel::OPC_CheckChild1Type:
|
||||||
@ -2089,14 +2090,14 @@ static unsigned IsPredicateKnownToFail(const unsigned char *Table,
|
|||||||
case SelectionDAGISel::OPC_CheckChild5Type:
|
case SelectionDAGISel::OPC_CheckChild5Type:
|
||||||
case SelectionDAGISel::OPC_CheckChild6Type:
|
case SelectionDAGISel::OPC_CheckChild6Type:
|
||||||
case SelectionDAGISel::OPC_CheckChild7Type:
|
case SelectionDAGISel::OPC_CheckChild7Type:
|
||||||
Result = !::CheckChildType(Table, Index, N, SDISel.TLI,
|
Result = !::CheckChildType(Table, Index, N, SDISel.getTargetLowering(),
|
||||||
Table[Index-1] - SelectionDAGISel::OPC_CheckChild0Type);
|
Table[Index-1] - SelectionDAGISel::OPC_CheckChild0Type);
|
||||||
return Index;
|
return Index;
|
||||||
case SelectionDAGISel::OPC_CheckCondCode:
|
case SelectionDAGISel::OPC_CheckCondCode:
|
||||||
Result = !::CheckCondCode(Table, Index, N);
|
Result = !::CheckCondCode(Table, Index, N);
|
||||||
return Index;
|
return Index;
|
||||||
case SelectionDAGISel::OPC_CheckValueType:
|
case SelectionDAGISel::OPC_CheckValueType:
|
||||||
Result = !::CheckValueType(Table, Index, N, SDISel.TLI);
|
Result = !::CheckValueType(Table, Index, N, SDISel.getTargetLowering());
|
||||||
return Index;
|
return Index;
|
||||||
case SelectionDAGISel::OPC_CheckInteger:
|
case SelectionDAGISel::OPC_CheckInteger:
|
||||||
Result = !::CheckInteger(Table, Index, N);
|
Result = !::CheckInteger(Table, Index, N);
|
||||||
@ -2389,7 +2390,8 @@ SelectCodeCommon(SDNode *NodeToMatch, const unsigned char *MatcherTable,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
case OPC_CheckType:
|
case OPC_CheckType:
|
||||||
if (!::CheckType(MatcherTable, MatcherIndex, N, TLI)) break;
|
if (!::CheckType(MatcherTable, MatcherIndex, N, getTargetLowering()))
|
||||||
|
break;
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
case OPC_SwitchOpcode: {
|
case OPC_SwitchOpcode: {
|
||||||
@ -2436,7 +2438,7 @@ SelectCodeCommon(SDNode *NodeToMatch, const unsigned char *MatcherTable,
|
|||||||
|
|
||||||
MVT CaseVT = (MVT::SimpleValueType)MatcherTable[MatcherIndex++];
|
MVT CaseVT = (MVT::SimpleValueType)MatcherTable[MatcherIndex++];
|
||||||
if (CaseVT == MVT::iPTR)
|
if (CaseVT == MVT::iPTR)
|
||||||
CaseVT = TLI->getPointerTy();
|
CaseVT = getTargetLowering()->getPointerTy();
|
||||||
|
|
||||||
// If the VT matches, then we will execute this case.
|
// If the VT matches, then we will execute this case.
|
||||||
if (CurNodeVT == CaseVT)
|
if (CurNodeVT == CaseVT)
|
||||||
@ -2458,7 +2460,7 @@ SelectCodeCommon(SDNode *NodeToMatch, const unsigned char *MatcherTable,
|
|||||||
case OPC_CheckChild2Type: case OPC_CheckChild3Type:
|
case OPC_CheckChild2Type: case OPC_CheckChild3Type:
|
||||||
case OPC_CheckChild4Type: case OPC_CheckChild5Type:
|
case OPC_CheckChild4Type: case OPC_CheckChild5Type:
|
||||||
case OPC_CheckChild6Type: case OPC_CheckChild7Type:
|
case OPC_CheckChild6Type: case OPC_CheckChild7Type:
|
||||||
if (!::CheckChildType(MatcherTable, MatcherIndex, N, TLI,
|
if (!::CheckChildType(MatcherTable, MatcherIndex, N, getTargetLowering(),
|
||||||
Opcode-OPC_CheckChild0Type))
|
Opcode-OPC_CheckChild0Type))
|
||||||
break;
|
break;
|
||||||
continue;
|
continue;
|
||||||
@ -2466,7 +2468,8 @@ SelectCodeCommon(SDNode *NodeToMatch, const unsigned char *MatcherTable,
|
|||||||
if (!::CheckCondCode(MatcherTable, MatcherIndex, N)) break;
|
if (!::CheckCondCode(MatcherTable, MatcherIndex, N)) break;
|
||||||
continue;
|
continue;
|
||||||
case OPC_CheckValueType:
|
case OPC_CheckValueType:
|
||||||
if (!::CheckValueType(MatcherTable, MatcherIndex, N, TLI)) break;
|
if (!::CheckValueType(MatcherTable, MatcherIndex, N, getTargetLowering()))
|
||||||
|
break;
|
||||||
continue;
|
continue;
|
||||||
case OPC_CheckInteger:
|
case OPC_CheckInteger:
|
||||||
if (!::CheckInteger(MatcherTable, MatcherIndex, N)) break;
|
if (!::CheckInteger(MatcherTable, MatcherIndex, N)) break;
|
||||||
@ -2658,7 +2661,7 @@ SelectCodeCommon(SDNode *NodeToMatch, const unsigned char *MatcherTable,
|
|||||||
for (unsigned i = 0; i != NumVTs; ++i) {
|
for (unsigned i = 0; i != NumVTs; ++i) {
|
||||||
MVT::SimpleValueType VT =
|
MVT::SimpleValueType VT =
|
||||||
(MVT::SimpleValueType)MatcherTable[MatcherIndex++];
|
(MVT::SimpleValueType)MatcherTable[MatcherIndex++];
|
||||||
if (VT == MVT::iPTR) VT = TLI->getPointerTy().SimpleTy;
|
if (VT == MVT::iPTR) VT = getTargetLowering()->getPointerTy().SimpleTy;
|
||||||
VTs.push_back(VT);
|
VTs.push_back(VT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +61,6 @@ enum AddrMode2Type {
|
|||||||
|
|
||||||
class ARMDAGToDAGISel : public SelectionDAGISel {
|
class ARMDAGToDAGISel : public SelectionDAGISel {
|
||||||
ARMBaseTargetMachine &TM;
|
ARMBaseTargetMachine &TM;
|
||||||
const ARMBaseInstrInfo *TII;
|
|
||||||
|
|
||||||
/// Subtarget - Keep a pointer to the ARMSubtarget around so that we can
|
/// Subtarget - Keep a pointer to the ARMSubtarget around so that we can
|
||||||
/// make the right decision when generating code for different targets.
|
/// make the right decision when generating code for different targets.
|
||||||
@ -71,7 +70,6 @@ public:
|
|||||||
explicit ARMDAGToDAGISel(ARMBaseTargetMachine &tm,
|
explicit ARMDAGToDAGISel(ARMBaseTargetMachine &tm,
|
||||||
CodeGenOpt::Level OptLevel)
|
CodeGenOpt::Level OptLevel)
|
||||||
: SelectionDAGISel(tm, OptLevel), TM(tm),
|
: SelectionDAGISel(tm, OptLevel), TM(tm),
|
||||||
TII(static_cast<const ARMBaseInstrInfo*>(TM.getInstrInfo())),
|
|
||||||
Subtarget(&TM.getSubtarget<ARMSubtarget>()) {
|
Subtarget(&TM.getSubtarget<ARMSubtarget>()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -434,6 +432,9 @@ bool ARMDAGToDAGISel::hasNoVMLxHazardUse(SDNode *N) const {
|
|||||||
if (Use->getOpcode() == ISD::CopyToReg)
|
if (Use->getOpcode() == ISD::CopyToReg)
|
||||||
return true;
|
return true;
|
||||||
if (Use->isMachineOpcode()) {
|
if (Use->isMachineOpcode()) {
|
||||||
|
const ARMBaseInstrInfo *TII =
|
||||||
|
static_cast<const ARMBaseInstrInfo*>(TM.getInstrInfo());
|
||||||
|
|
||||||
const MCInstrDesc &MCID = TII->get(Use->getMachineOpcode());
|
const MCInstrDesc &MCID = TII->get(Use->getMachineOpcode());
|
||||||
if (MCID.mayStore())
|
if (MCID.mayStore())
|
||||||
return true;
|
return true;
|
||||||
@ -533,7 +534,8 @@ bool ARMDAGToDAGISel::SelectAddrModeImm12(SDValue N,
|
|||||||
if (N.getOpcode() == ISD::FrameIndex) {
|
if (N.getOpcode() == ISD::FrameIndex) {
|
||||||
// Match frame index.
|
// Match frame index.
|
||||||
int FI = cast<FrameIndexSDNode>(N)->getIndex();
|
int FI = cast<FrameIndexSDNode>(N)->getIndex();
|
||||||
Base = CurDAG->getTargetFrameIndex(FI, TLI->getPointerTy());
|
Base = CurDAG->getTargetFrameIndex(FI,
|
||||||
|
getTargetLowering()->getPointerTy());
|
||||||
OffImm = CurDAG->getTargetConstant(0, MVT::i32);
|
OffImm = CurDAG->getTargetConstant(0, MVT::i32);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -557,7 +559,8 @@ bool ARMDAGToDAGISel::SelectAddrModeImm12(SDValue N,
|
|||||||
Base = N.getOperand(0);
|
Base = N.getOperand(0);
|
||||||
if (Base.getOpcode() == ISD::FrameIndex) {
|
if (Base.getOpcode() == ISD::FrameIndex) {
|
||||||
int FI = cast<FrameIndexSDNode>(Base)->getIndex();
|
int FI = cast<FrameIndexSDNode>(Base)->getIndex();
|
||||||
Base = CurDAG->getTargetFrameIndex(FI, TLI->getPointerTy());
|
Base = CurDAG->getTargetFrameIndex(FI,
|
||||||
|
getTargetLowering()->getPointerTy());
|
||||||
}
|
}
|
||||||
OffImm = CurDAG->getTargetConstant(RHSC, MVT::i32);
|
OffImm = CurDAG->getTargetConstant(RHSC, MVT::i32);
|
||||||
return true;
|
return true;
|
||||||
@ -703,7 +706,8 @@ AddrMode2Type ARMDAGToDAGISel::SelectAddrMode2Worker(SDValue N,
|
|||||||
Base = N;
|
Base = N;
|
||||||
if (N.getOpcode() == ISD::FrameIndex) {
|
if (N.getOpcode() == ISD::FrameIndex) {
|
||||||
int FI = cast<FrameIndexSDNode>(N)->getIndex();
|
int FI = cast<FrameIndexSDNode>(N)->getIndex();
|
||||||
Base = CurDAG->getTargetFrameIndex(FI, TLI->getPointerTy());
|
Base = CurDAG->getTargetFrameIndex(FI,
|
||||||
|
getTargetLowering()->getPointerTy());
|
||||||
} else if (N.getOpcode() == ARMISD::Wrapper &&
|
} else if (N.getOpcode() == ARMISD::Wrapper &&
|
||||||
!(Subtarget->useMovt() &&
|
!(Subtarget->useMovt() &&
|
||||||
N.getOperand(0).getOpcode() == ISD::TargetGlobalAddress)) {
|
N.getOperand(0).getOpcode() == ISD::TargetGlobalAddress)) {
|
||||||
@ -724,7 +728,8 @@ AddrMode2Type ARMDAGToDAGISel::SelectAddrMode2Worker(SDValue N,
|
|||||||
Base = N.getOperand(0);
|
Base = N.getOperand(0);
|
||||||
if (Base.getOpcode() == ISD::FrameIndex) {
|
if (Base.getOpcode() == ISD::FrameIndex) {
|
||||||
int FI = cast<FrameIndexSDNode>(Base)->getIndex();
|
int FI = cast<FrameIndexSDNode>(Base)->getIndex();
|
||||||
Base = CurDAG->getTargetFrameIndex(FI, TLI->getPointerTy());
|
Base = CurDAG->getTargetFrameIndex(FI,
|
||||||
|
getTargetLowering()->getPointerTy());
|
||||||
}
|
}
|
||||||
Offset = CurDAG->getRegister(0, MVT::i32);
|
Offset = CurDAG->getRegister(0, MVT::i32);
|
||||||
|
|
||||||
@ -901,7 +906,8 @@ bool ARMDAGToDAGISel::SelectAddrMode3(SDValue N,
|
|||||||
Base = N;
|
Base = N;
|
||||||
if (N.getOpcode() == ISD::FrameIndex) {
|
if (N.getOpcode() == ISD::FrameIndex) {
|
||||||
int FI = cast<FrameIndexSDNode>(N)->getIndex();
|
int FI = cast<FrameIndexSDNode>(N)->getIndex();
|
||||||
Base = CurDAG->getTargetFrameIndex(FI, TLI->getPointerTy());
|
Base = CurDAG->getTargetFrameIndex(FI,
|
||||||
|
getTargetLowering()->getPointerTy());
|
||||||
}
|
}
|
||||||
Offset = CurDAG->getRegister(0, MVT::i32);
|
Offset = CurDAG->getRegister(0, MVT::i32);
|
||||||
Opc = CurDAG->getTargetConstant(ARM_AM::getAM3Opc(ARM_AM::add, 0),MVT::i32);
|
Opc = CurDAG->getTargetConstant(ARM_AM::getAM3Opc(ARM_AM::add, 0),MVT::i32);
|
||||||
@ -915,7 +921,8 @@ bool ARMDAGToDAGISel::SelectAddrMode3(SDValue N,
|
|||||||
Base = N.getOperand(0);
|
Base = N.getOperand(0);
|
||||||
if (Base.getOpcode() == ISD::FrameIndex) {
|
if (Base.getOpcode() == ISD::FrameIndex) {
|
||||||
int FI = cast<FrameIndexSDNode>(Base)->getIndex();
|
int FI = cast<FrameIndexSDNode>(Base)->getIndex();
|
||||||
Base = CurDAG->getTargetFrameIndex(FI, TLI->getPointerTy());
|
Base = CurDAG->getTargetFrameIndex(FI,
|
||||||
|
getTargetLowering()->getPointerTy());
|
||||||
}
|
}
|
||||||
Offset = CurDAG->getRegister(0, MVT::i32);
|
Offset = CurDAG->getRegister(0, MVT::i32);
|
||||||
|
|
||||||
@ -960,7 +967,8 @@ bool ARMDAGToDAGISel::SelectAddrMode5(SDValue N,
|
|||||||
Base = N;
|
Base = N;
|
||||||
if (N.getOpcode() == ISD::FrameIndex) {
|
if (N.getOpcode() == ISD::FrameIndex) {
|
||||||
int FI = cast<FrameIndexSDNode>(N)->getIndex();
|
int FI = cast<FrameIndexSDNode>(N)->getIndex();
|
||||||
Base = CurDAG->getTargetFrameIndex(FI, TLI->getPointerTy());
|
Base = CurDAG->getTargetFrameIndex(FI,
|
||||||
|
getTargetLowering()->getPointerTy());
|
||||||
} else if (N.getOpcode() == ARMISD::Wrapper &&
|
} else if (N.getOpcode() == ARMISD::Wrapper &&
|
||||||
!(Subtarget->useMovt() &&
|
!(Subtarget->useMovt() &&
|
||||||
N.getOperand(0).getOpcode() == ISD::TargetGlobalAddress)) {
|
N.getOperand(0).getOpcode() == ISD::TargetGlobalAddress)) {
|
||||||
@ -978,7 +986,8 @@ bool ARMDAGToDAGISel::SelectAddrMode5(SDValue N,
|
|||||||
Base = N.getOperand(0);
|
Base = N.getOperand(0);
|
||||||
if (Base.getOpcode() == ISD::FrameIndex) {
|
if (Base.getOpcode() == ISD::FrameIndex) {
|
||||||
int FI = cast<FrameIndexSDNode>(Base)->getIndex();
|
int FI = cast<FrameIndexSDNode>(Base)->getIndex();
|
||||||
Base = CurDAG->getTargetFrameIndex(FI, TLI->getPointerTy());
|
Base = CurDAG->getTargetFrameIndex(FI,
|
||||||
|
getTargetLowering()->getPointerTy());
|
||||||
}
|
}
|
||||||
|
|
||||||
ARM_AM::AddrOpc AddSub = ARM_AM::add;
|
ARM_AM::AddrOpc AddSub = ARM_AM::add;
|
||||||
@ -1202,7 +1211,8 @@ bool ARMDAGToDAGISel::SelectThumbAddrModeSP(SDValue N,
|
|||||||
SDValue &Base, SDValue &OffImm) {
|
SDValue &Base, SDValue &OffImm) {
|
||||||
if (N.getOpcode() == ISD::FrameIndex) {
|
if (N.getOpcode() == ISD::FrameIndex) {
|
||||||
int FI = cast<FrameIndexSDNode>(N)->getIndex();
|
int FI = cast<FrameIndexSDNode>(N)->getIndex();
|
||||||
Base = CurDAG->getTargetFrameIndex(FI, TLI->getPointerTy());
|
Base = CurDAG->getTargetFrameIndex(FI,
|
||||||
|
getTargetLowering()->getPointerTy());
|
||||||
OffImm = CurDAG->getTargetConstant(0, MVT::i32);
|
OffImm = CurDAG->getTargetConstant(0, MVT::i32);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1219,7 +1229,8 @@ bool ARMDAGToDAGISel::SelectThumbAddrModeSP(SDValue N,
|
|||||||
Base = N.getOperand(0);
|
Base = N.getOperand(0);
|
||||||
if (Base.getOpcode() == ISD::FrameIndex) {
|
if (Base.getOpcode() == ISD::FrameIndex) {
|
||||||
int FI = cast<FrameIndexSDNode>(Base)->getIndex();
|
int FI = cast<FrameIndexSDNode>(Base)->getIndex();
|
||||||
Base = CurDAG->getTargetFrameIndex(FI, TLI->getPointerTy());
|
Base = CurDAG->getTargetFrameIndex(FI,
|
||||||
|
getTargetLowering()->getPointerTy());
|
||||||
}
|
}
|
||||||
OffImm = CurDAG->getTargetConstant(RHSC, MVT::i32);
|
OffImm = CurDAG->getTargetConstant(RHSC, MVT::i32);
|
||||||
return true;
|
return true;
|
||||||
@ -1267,7 +1278,8 @@ bool ARMDAGToDAGISel::SelectT2AddrModeImm12(SDValue N,
|
|||||||
if (N.getOpcode() == ISD::FrameIndex) {
|
if (N.getOpcode() == ISD::FrameIndex) {
|
||||||
// Match frame index.
|
// Match frame index.
|
||||||
int FI = cast<FrameIndexSDNode>(N)->getIndex();
|
int FI = cast<FrameIndexSDNode>(N)->getIndex();
|
||||||
Base = CurDAG->getTargetFrameIndex(FI, TLI->getPointerTy());
|
Base = CurDAG->getTargetFrameIndex(FI,
|
||||||
|
getTargetLowering()->getPointerTy());
|
||||||
OffImm = CurDAG->getTargetConstant(0, MVT::i32);
|
OffImm = CurDAG->getTargetConstant(0, MVT::i32);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1297,7 +1309,8 @@ bool ARMDAGToDAGISel::SelectT2AddrModeImm12(SDValue N,
|
|||||||
Base = N.getOperand(0);
|
Base = N.getOperand(0);
|
||||||
if (Base.getOpcode() == ISD::FrameIndex) {
|
if (Base.getOpcode() == ISD::FrameIndex) {
|
||||||
int FI = cast<FrameIndexSDNode>(Base)->getIndex();
|
int FI = cast<FrameIndexSDNode>(Base)->getIndex();
|
||||||
Base = CurDAG->getTargetFrameIndex(FI, TLI->getPointerTy());
|
Base = CurDAG->getTargetFrameIndex(FI,
|
||||||
|
getTargetLowering()->getPointerTy());
|
||||||
}
|
}
|
||||||
OffImm = CurDAG->getTargetConstant(RHSC, MVT::i32);
|
OffImm = CurDAG->getTargetConstant(RHSC, MVT::i32);
|
||||||
return true;
|
return true;
|
||||||
@ -1326,7 +1339,8 @@ bool ARMDAGToDAGISel::SelectT2AddrModeImm8(SDValue N,
|
|||||||
Base = N.getOperand(0);
|
Base = N.getOperand(0);
|
||||||
if (Base.getOpcode() == ISD::FrameIndex) {
|
if (Base.getOpcode() == ISD::FrameIndex) {
|
||||||
int FI = cast<FrameIndexSDNode>(Base)->getIndex();
|
int FI = cast<FrameIndexSDNode>(Base)->getIndex();
|
||||||
Base = CurDAG->getTargetFrameIndex(FI, TLI->getPointerTy());
|
Base = CurDAG->getTargetFrameIndex(FI,
|
||||||
|
getTargetLowering()->getPointerTy());
|
||||||
}
|
}
|
||||||
OffImm = CurDAG->getTargetConstant(RHSC, MVT::i32);
|
OffImm = CurDAG->getTargetConstant(RHSC, MVT::i32);
|
||||||
return true;
|
return true;
|
||||||
@ -2587,7 +2601,7 @@ SDNode *ARMDAGToDAGISel::Select(SDNode *N) {
|
|||||||
SDValue CPIdx =
|
SDValue CPIdx =
|
||||||
CurDAG->getTargetConstantPool(ConstantInt::get(
|
CurDAG->getTargetConstantPool(ConstantInt::get(
|
||||||
Type::getInt32Ty(*CurDAG->getContext()), Val),
|
Type::getInt32Ty(*CurDAG->getContext()), Val),
|
||||||
TLI->getPointerTy());
|
getTargetLowering()->getPointerTy());
|
||||||
|
|
||||||
SDNode *ResNode;
|
SDNode *ResNode;
|
||||||
if (Subtarget->isThumb1Only()) {
|
if (Subtarget->isThumb1Only()) {
|
||||||
@ -2617,7 +2631,8 @@ SDNode *ARMDAGToDAGISel::Select(SDNode *N) {
|
|||||||
case ISD::FrameIndex: {
|
case ISD::FrameIndex: {
|
||||||
// Selects to ADDri FI, 0 which in turn will become ADDri SP, imm.
|
// Selects to ADDri FI, 0 which in turn will become ADDri SP, imm.
|
||||||
int FI = cast<FrameIndexSDNode>(N)->getIndex();
|
int FI = cast<FrameIndexSDNode>(N)->getIndex();
|
||||||
SDValue TFI = CurDAG->getTargetFrameIndex(FI, TLI->getPointerTy());
|
SDValue TFI = CurDAG->getTargetFrameIndex(FI,
|
||||||
|
getTargetLowering()->getPointerTy());
|
||||||
if (Subtarget->isThumb1Only()) {
|
if (Subtarget->isThumb1Only()) {
|
||||||
SDValue Ops[] = { TFI, CurDAG->getTargetConstant(0, MVT::i32),
|
SDValue Ops[] = { TFI, CurDAG->getTargetConstant(0, MVT::i32),
|
||||||
getAL(CurDAG), CurDAG->getRegister(0, MVT::i32) };
|
getAL(CurDAG), CurDAG->getRegister(0, MVT::i32) };
|
||||||
|
@ -275,8 +275,8 @@ def HasSlowVDUP32 : Predicate<"Subtarget->isSwift()">;
|
|||||||
def UseVMOVSR : Predicate<"Subtarget->isCortexA9() || !Subtarget->useNEONForSinglePrecisionFP()">;
|
def UseVMOVSR : Predicate<"Subtarget->isCortexA9() || !Subtarget->useNEONForSinglePrecisionFP()">;
|
||||||
def DontUseVMOVSR : Predicate<"!Subtarget->isCortexA9() && Subtarget->useNEONForSinglePrecisionFP()">;
|
def DontUseVMOVSR : Predicate<"!Subtarget->isCortexA9() && Subtarget->useNEONForSinglePrecisionFP()">;
|
||||||
|
|
||||||
def IsLE : Predicate<"TLI->isLittleEndian()">;
|
def IsLE : Predicate<"getTargetLowering()->isLittleEndian()">;
|
||||||
def IsBE : Predicate<"TLI->isBigEndian()">;
|
def IsBE : Predicate<"getTargetLowering()->isBigEndian()">;
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// ARM Flag Definitions.
|
// ARM Flag Definitions.
|
||||||
|
@ -29,7 +29,7 @@ namespace llvm {
|
|||||||
class HexagonTargetMachine;
|
class HexagonTargetMachine;
|
||||||
class raw_ostream;
|
class raw_ostream;
|
||||||
|
|
||||||
FunctionPass *createHexagonISelDag(const HexagonTargetMachine &TM,
|
FunctionPass *createHexagonISelDag(HexagonTargetMachine &TM,
|
||||||
CodeGenOpt::Level OptLevel);
|
CodeGenOpt::Level OptLevel);
|
||||||
FunctionPass *createHexagonDelaySlotFillerPass(const TargetMachine &TM);
|
FunctionPass *createHexagonDelaySlotFillerPass(const TargetMachine &TM);
|
||||||
FunctionPass *createHexagonFPMoverPass(const TargetMachine &TM);
|
FunctionPass *createHexagonFPMoverPass(const TargetMachine &TM);
|
||||||
|
@ -52,7 +52,7 @@ class HexagonDAGToDAGISel : public SelectionDAGISel {
|
|||||||
const HexagonTargetMachine& TM;
|
const HexagonTargetMachine& TM;
|
||||||
DenseMap<const GlobalValue *, unsigned> GlobalAddressUseCountMap;
|
DenseMap<const GlobalValue *, unsigned> GlobalAddressUseCountMap;
|
||||||
public:
|
public:
|
||||||
explicit HexagonDAGToDAGISel(const HexagonTargetMachine &targetmachine,
|
explicit HexagonDAGToDAGISel(HexagonTargetMachine &targetmachine,
|
||||||
CodeGenOpt::Level OptLevel)
|
CodeGenOpt::Level OptLevel)
|
||||||
: SelectionDAGISel(targetmachine, OptLevel),
|
: SelectionDAGISel(targetmachine, OptLevel),
|
||||||
Subtarget(targetmachine.getSubtarget<HexagonSubtarget>()),
|
Subtarget(targetmachine.getSubtarget<HexagonSubtarget>()),
|
||||||
@ -178,7 +178,7 @@ inline SDValue XformUToUM1Imm(unsigned Imm) {
|
|||||||
/// createHexagonISelDag - This pass converts a legalized DAG into a
|
/// createHexagonISelDag - This pass converts a legalized DAG into a
|
||||||
/// Hexagon-specific DAG, ready for instruction scheduling.
|
/// Hexagon-specific DAG, ready for instruction scheduling.
|
||||||
///
|
///
|
||||||
FunctionPass *llvm::createHexagonISelDag(const HexagonTargetMachine &TM,
|
FunctionPass *llvm::createHexagonISelDag(HexagonTargetMachine &TM,
|
||||||
CodeGenOpt::Level OptLevel) {
|
CodeGenOpt::Level OptLevel) {
|
||||||
return new HexagonDAGToDAGISel(TM, OptLevel);
|
return new HexagonDAGToDAGISel(TM, OptLevel);
|
||||||
}
|
}
|
||||||
@ -394,7 +394,7 @@ SDNode *HexagonDAGToDAGISel::SelectBaseOffsetLoad(LoadSDNode *LD, SDLoc dl) {
|
|||||||
EVT LoadedVT = LD->getMemoryVT();
|
EVT LoadedVT = LD->getMemoryVT();
|
||||||
int64_t Offset = cast<GlobalAddressSDNode>(Base)->getOffset();
|
int64_t Offset = cast<GlobalAddressSDNode>(Base)->getOffset();
|
||||||
if (Offset != 0 && OffsetFitsS11(LoadedVT, Offset)) {
|
if (Offset != 0 && OffsetFitsS11(LoadedVT, Offset)) {
|
||||||
MVT PointerTy = TLI->getPointerTy();
|
MVT PointerTy = getTargetLowering()->getPointerTy();
|
||||||
const GlobalValue* GV =
|
const GlobalValue* GV =
|
||||||
cast<GlobalAddressSDNode>(Base)->getGlobal();
|
cast<GlobalAddressSDNode>(Base)->getGlobal();
|
||||||
SDValue TargAddr =
|
SDValue TargAddr =
|
||||||
@ -443,10 +443,10 @@ SDNode *HexagonDAGToDAGISel::SelectIndexedLoadSignExtend64(LoadSDNode *LD,
|
|||||||
SDValue CPTmpN1_0;
|
SDValue CPTmpN1_0;
|
||||||
SDValue CPTmpN1_1;
|
SDValue CPTmpN1_1;
|
||||||
|
|
||||||
const HexagonInstrInfo *TII =
|
|
||||||
static_cast<const HexagonInstrInfo*>(TM.getInstrInfo());
|
|
||||||
if (SelectADDRriS11_2(N1, CPTmpN1_0, CPTmpN1_1) &&
|
if (SelectADDRriS11_2(N1, CPTmpN1_0, CPTmpN1_1) &&
|
||||||
N1.getNode()->getValueType(0) == MVT::i32) {
|
N1.getNode()->getValueType(0) == MVT::i32) {
|
||||||
|
const HexagonInstrInfo *TII =
|
||||||
|
static_cast<const HexagonInstrInfo*>(TM.getInstrInfo());
|
||||||
if (TII->isValidAutoIncImm(LoadedVT, Val)) {
|
if (TII->isValidAutoIncImm(LoadedVT, Val)) {
|
||||||
SDValue TargetConst = CurDAG->getTargetConstant(Val, MVT::i32);
|
SDValue TargetConst = CurDAG->getTargetConstant(Val, MVT::i32);
|
||||||
SDNode *Result_1 = CurDAG->getMachineNode(Opcode, dl, MVT::i32, MVT::i32,
|
SDNode *Result_1 = CurDAG->getMachineNode(Opcode, dl, MVT::i32, MVT::i32,
|
||||||
@ -510,10 +510,10 @@ SDNode *HexagonDAGToDAGISel::SelectIndexedLoadZeroExtend64(LoadSDNode *LD,
|
|||||||
SDValue CPTmpN1_0;
|
SDValue CPTmpN1_0;
|
||||||
SDValue CPTmpN1_1;
|
SDValue CPTmpN1_1;
|
||||||
|
|
||||||
const HexagonInstrInfo *TII =
|
|
||||||
static_cast<const HexagonInstrInfo*>(TM.getInstrInfo());
|
|
||||||
if (SelectADDRriS11_2(N1, CPTmpN1_0, CPTmpN1_1) &&
|
if (SelectADDRriS11_2(N1, CPTmpN1_0, CPTmpN1_1) &&
|
||||||
N1.getNode()->getValueType(0) == MVT::i32) {
|
N1.getNode()->getValueType(0) == MVT::i32) {
|
||||||
|
const HexagonInstrInfo *TII =
|
||||||
|
static_cast<const HexagonInstrInfo*>(TM.getInstrInfo());
|
||||||
if (TII->isValidAutoIncImm(LoadedVT, Val)) {
|
if (TII->isValidAutoIncImm(LoadedVT, Val)) {
|
||||||
SDValue TargetConstVal = CurDAG->getTargetConstant(Val, MVT::i32);
|
SDValue TargetConstVal = CurDAG->getTargetConstant(Val, MVT::i32);
|
||||||
SDValue TargetConst0 = CurDAG->getTargetConstant(0, MVT::i32);
|
SDValue TargetConst0 = CurDAG->getTargetConstant(0, MVT::i32);
|
||||||
@ -777,7 +777,7 @@ SDNode *HexagonDAGToDAGISel::SelectBaseOffsetStore(StoreSDNode *ST,
|
|||||||
EVT StoredVT = ST->getMemoryVT();
|
EVT StoredVT = ST->getMemoryVT();
|
||||||
int64_t Offset = cast<GlobalAddressSDNode>(Base)->getOffset();
|
int64_t Offset = cast<GlobalAddressSDNode>(Base)->getOffset();
|
||||||
if (Offset != 0 && OffsetFitsS11(StoredVT, Offset)) {
|
if (Offset != 0 && OffsetFitsS11(StoredVT, Offset)) {
|
||||||
MVT PointerTy = TLI->getPointerTy();
|
MVT PointerTy = getTargetLowering()->getPointerTy();
|
||||||
const GlobalValue* GV =
|
const GlobalValue* GV =
|
||||||
cast<GlobalAddressSDNode>(Base)->getGlobal();
|
cast<GlobalAddressSDNode>(Base)->getGlobal();
|
||||||
SDValue TargAddr =
|
SDValue TargAddr =
|
||||||
@ -1215,10 +1215,10 @@ SDNode *HexagonDAGToDAGISel::SelectIntrinsicWOChain(SDNode *N) {
|
|||||||
|
|
||||||
// We are concerned with only those intrinsics that have predicate registers
|
// We are concerned with only those intrinsics that have predicate registers
|
||||||
// as at least one of the operands.
|
// as at least one of the operands.
|
||||||
const HexagonInstrInfo *TII =
|
|
||||||
static_cast<const HexagonInstrInfo*>(TM.getInstrInfo());
|
|
||||||
if (IntrinsicWithPred) {
|
if (IntrinsicWithPred) {
|
||||||
SmallVector<SDValue, 8> Ops;
|
SmallVector<SDValue, 8> Ops;
|
||||||
|
const HexagonInstrInfo *TII =
|
||||||
|
static_cast<const HexagonInstrInfo*>(TM.getInstrInfo());
|
||||||
const MCInstrDesc &MCID = TII->get(IntrinsicWithPred);
|
const MCInstrDesc &MCID = TII->get(IntrinsicWithPred);
|
||||||
const TargetRegisterInfo *TRI = TM.getRegisterInfo();
|
const TargetRegisterInfo *TRI = TM.getRegisterInfo();
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ TargetPassConfig *HexagonTargetMachine::createPassConfig(PassManagerBase &PM) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool HexagonPassConfig::addInstSelector() {
|
bool HexagonPassConfig::addInstSelector() {
|
||||||
const HexagonTargetMachine &TM = getHexagonTargetMachine();
|
HexagonTargetMachine &TM = getHexagonTargetMachine();
|
||||||
bool NoOpt = (getOptLevel() == CodeGenOpt::None);
|
bool NoOpt = (getOptLevel() == CodeGenOpt::None);
|
||||||
|
|
||||||
if (!NoOpt)
|
if (!NoOpt)
|
||||||
|
@ -181,7 +181,8 @@ SelectAddrRegImm(SDValue N, SDValue &Base, SDValue &Disp) {
|
|||||||
/// GOT address into a register.
|
/// GOT address into a register.
|
||||||
SDNode *MBlazeDAGToDAGISel::getGlobalBaseReg() {
|
SDNode *MBlazeDAGToDAGISel::getGlobalBaseReg() {
|
||||||
unsigned GlobalBaseReg = getInstrInfo()->getGlobalBaseReg(MF);
|
unsigned GlobalBaseReg = getInstrInfo()->getGlobalBaseReg(MF);
|
||||||
return CurDAG->getRegister(GlobalBaseReg, TLI->getPointerTy()).getNode();
|
return CurDAG->getRegister(GlobalBaseReg,
|
||||||
|
getTargetLowering()->getPointerTy()).getNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Select instructions not customized! Used for
|
/// Select instructions not customized! Used for
|
||||||
|
@ -259,7 +259,8 @@ bool MSP430DAGToDAGISel::SelectAddr(SDValue N,
|
|||||||
}
|
}
|
||||||
|
|
||||||
Base = (AM.BaseType == MSP430ISelAddressMode::FrameIndexBase) ?
|
Base = (AM.BaseType == MSP430ISelAddressMode::FrameIndexBase) ?
|
||||||
CurDAG->getTargetFrameIndex(AM.Base.FrameIndex, TLI->getPointerTy()) :
|
CurDAG->getTargetFrameIndex(AM.Base.FrameIndex,
|
||||||
|
getTargetLowering()->getPointerTy()) :
|
||||||
AM.Base.Reg;
|
AM.Base.Reg;
|
||||||
|
|
||||||
if (AM.GV)
|
if (AM.GV)
|
||||||
|
@ -118,11 +118,13 @@ void Mips16DAGToDAGISel::processFunctionAfterISel(MachineFunction &MF) {
|
|||||||
SDValue Mips16DAGToDAGISel::getMips16SPAliasReg() {
|
SDValue Mips16DAGToDAGISel::getMips16SPAliasReg() {
|
||||||
unsigned Mips16SPAliasReg =
|
unsigned Mips16SPAliasReg =
|
||||||
MF->getInfo<MipsFunctionInfo>()->getMips16SPAliasReg();
|
MF->getInfo<MipsFunctionInfo>()->getMips16SPAliasReg();
|
||||||
return CurDAG->getRegister(Mips16SPAliasReg, TLI->getPointerTy());
|
return CurDAG->getRegister(Mips16SPAliasReg,
|
||||||
|
getTargetLowering()->getPointerTy());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mips16DAGToDAGISel::getMips16SPRefReg(SDNode *Parent, SDValue &AliasReg) {
|
void Mips16DAGToDAGISel::getMips16SPRefReg(SDNode *Parent, SDValue &AliasReg) {
|
||||||
SDValue AliasFPReg = CurDAG->getRegister(Mips::S0, TLI->getPointerTy());
|
SDValue AliasFPReg = CurDAG->getRegister(Mips::S0,
|
||||||
|
getTargetLowering()->getPointerTy());
|
||||||
if (Parent) {
|
if (Parent) {
|
||||||
switch (Parent->getOpcode()) {
|
switch (Parent->getOpcode()) {
|
||||||
case ISD::LOAD: {
|
case ISD::LOAD: {
|
||||||
@ -149,7 +151,7 @@ void Mips16DAGToDAGISel::getMips16SPRefReg(SDNode *Parent, SDValue &AliasReg) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AliasReg = CurDAG->getRegister(Mips::SP, TLI->getPointerTy());
|
AliasReg = CurDAG->getRegister(Mips::SP, getTargetLowering()->getPointerTy());
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,8 @@ bool MipsDAGToDAGISel::runOnMachineFunction(MachineFunction &MF) {
|
|||||||
/// GOT address into a register.
|
/// GOT address into a register.
|
||||||
SDNode *MipsDAGToDAGISel::getGlobalBaseReg() {
|
SDNode *MipsDAGToDAGISel::getGlobalBaseReg() {
|
||||||
unsigned GlobalBaseReg = MF->getInfo<MipsFunctionInfo>()->getGlobalBaseReg();
|
unsigned GlobalBaseReg = MF->getInfo<MipsFunctionInfo>()->getGlobalBaseReg();
|
||||||
return CurDAG->getRegister(GlobalBaseReg, TLI->getPointerTy()).getNode();
|
return CurDAG->getRegister(GlobalBaseReg,
|
||||||
|
getTargetLowering()->getPointerTy()).getNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ComplexPattern used on MipsInstrInfo
|
/// ComplexPattern used on MipsInstrInfo
|
||||||
|
@ -402,7 +402,7 @@ std::pair<bool, SDNode*> MipsSEDAGToDAGISel::selectNode(SDNode *Node) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case MipsISD::ThreadPointer: {
|
case MipsISD::ThreadPointer: {
|
||||||
EVT PtrVT = TLI->getPointerTy();
|
EVT PtrVT = getTargetLowering()->getPointerTy();
|
||||||
unsigned RdhwrOpc, SrcReg, DestReg;
|
unsigned RdhwrOpc, SrcReg, DestReg;
|
||||||
|
|
||||||
if (PtrVT == MVT::i32) {
|
if (PtrVT == MVT::i32) {
|
||||||
|
@ -92,8 +92,7 @@ FunctionPass *llvm::createAMDGPUISelDag(TargetMachine &TM
|
|||||||
return new AMDGPUDAGToDAGISel(TM);
|
return new AMDGPUDAGToDAGISel(TM);
|
||||||
}
|
}
|
||||||
|
|
||||||
AMDGPUDAGToDAGISel::AMDGPUDAGToDAGISel(TargetMachine &TM
|
AMDGPUDAGToDAGISel::AMDGPUDAGToDAGISel(TargetMachine &TM)
|
||||||
)
|
|
||||||
: SelectionDAGISel(TM), Subtarget(TM.getSubtarget<AMDGPUSubtarget>()) {
|
: SelectionDAGISel(TM), Subtarget(TM.getSubtarget<AMDGPUSubtarget>()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -712,7 +711,8 @@ void AMDGPUDAGToDAGISel::PostprocessISelDAG() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Go over all selected nodes and try to fold them a bit more
|
// Go over all selected nodes and try to fold them a bit more
|
||||||
const AMDGPUTargetLowering& Lowering = (*(const AMDGPUTargetLowering*)TLI);
|
const AMDGPUTargetLowering& Lowering =
|
||||||
|
(*(const AMDGPUTargetLowering*)getTargetLowering());
|
||||||
for (SelectionDAG::allnodes_iterator I = CurDAG->allnodes_begin(),
|
for (SelectionDAG::allnodes_iterator I = CurDAG->allnodes_begin(),
|
||||||
E = CurDAG->allnodes_end(); I != E; ++I) {
|
E = CurDAG->allnodes_end(); I != E; ++I) {
|
||||||
|
|
||||||
|
@ -44,7 +44,8 @@ def IMM12bit : PatLeaf <(imm),
|
|||||||
>;
|
>;
|
||||||
|
|
||||||
class InlineImm <ValueType vt> : PatLeaf <(vt imm), [{
|
class InlineImm <ValueType vt> : PatLeaf <(vt imm), [{
|
||||||
return (*(const SITargetLowering *)TLI).analyzeImmediate(N) == 0;
|
return
|
||||||
|
(*(const SITargetLowering *)getTargetLowering()).analyzeImmediate(N) == 0;
|
||||||
}]>;
|
}]>;
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
@ -67,13 +67,15 @@ private:
|
|||||||
|
|
||||||
SDNode* SparcDAGToDAGISel::getGlobalBaseReg() {
|
SDNode* SparcDAGToDAGISel::getGlobalBaseReg() {
|
||||||
unsigned GlobalBaseReg = TM.getInstrInfo()->getGlobalBaseReg(MF);
|
unsigned GlobalBaseReg = TM.getInstrInfo()->getGlobalBaseReg(MF);
|
||||||
return CurDAG->getRegister(GlobalBaseReg, TLI->getPointerTy()).getNode();
|
return CurDAG->getRegister(GlobalBaseReg,
|
||||||
|
getTargetLowering()->getPointerTy()).getNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SparcDAGToDAGISel::SelectADDRri(SDValue Addr,
|
bool SparcDAGToDAGISel::SelectADDRri(SDValue Addr,
|
||||||
SDValue &Base, SDValue &Offset) {
|
SDValue &Base, SDValue &Offset) {
|
||||||
if (FrameIndexSDNode *FIN = dyn_cast<FrameIndexSDNode>(Addr)) {
|
if (FrameIndexSDNode *FIN = dyn_cast<FrameIndexSDNode>(Addr)) {
|
||||||
Base = CurDAG->getTargetFrameIndex(FIN->getIndex(), TLI->getPointerTy());
|
Base = CurDAG->getTargetFrameIndex(FIN->getIndex(),
|
||||||
|
getTargetLowering()->getPointerTy());
|
||||||
Offset = CurDAG->getTargetConstant(0, MVT::i32);
|
Offset = CurDAG->getTargetConstant(0, MVT::i32);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -88,7 +90,7 @@ bool SparcDAGToDAGISel::SelectADDRri(SDValue Addr,
|
|||||||
dyn_cast<FrameIndexSDNode>(Addr.getOperand(0))) {
|
dyn_cast<FrameIndexSDNode>(Addr.getOperand(0))) {
|
||||||
// Constant offset from frame ref.
|
// Constant offset from frame ref.
|
||||||
Base = CurDAG->getTargetFrameIndex(FIN->getIndex(),
|
Base = CurDAG->getTargetFrameIndex(FIN->getIndex(),
|
||||||
TLI->getPointerTy());
|
getTargetLowering()->getPointerTy());
|
||||||
} else {
|
} else {
|
||||||
Base = Addr.getOperand(0);
|
Base = Addr.getOperand(0);
|
||||||
}
|
}
|
||||||
@ -131,7 +133,7 @@ bool SparcDAGToDAGISel::SelectADDRrr(SDValue Addr, SDValue &R1, SDValue &R2) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
R1 = Addr;
|
R1 = Addr;
|
||||||
R2 = CurDAG->getRegister(SP::G0, TLI->getPointerTy());
|
R2 = CurDAG->getRegister(SP::G0, getTargetLowering()->getPointerTy());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,10 +141,6 @@ namespace {
|
|||||||
/// SelectionDAG operations.
|
/// SelectionDAG operations.
|
||||||
///
|
///
|
||||||
class X86DAGToDAGISel : public SelectionDAGISel {
|
class X86DAGToDAGISel : public SelectionDAGISel {
|
||||||
/// X86Lowering - This object fully describes how to lower LLVM code to an
|
|
||||||
/// X86-specific SelectionDAG.
|
|
||||||
const X86TargetLowering &X86Lowering;
|
|
||||||
|
|
||||||
/// Subtarget - Keep a pointer to the X86Subtarget around so that we can
|
/// Subtarget - Keep a pointer to the X86Subtarget around so that we can
|
||||||
/// make the right decision when generating code for different targets.
|
/// make the right decision when generating code for different targets.
|
||||||
const X86Subtarget *Subtarget;
|
const X86Subtarget *Subtarget;
|
||||||
@ -156,7 +152,6 @@ namespace {
|
|||||||
public:
|
public:
|
||||||
explicit X86DAGToDAGISel(X86TargetMachine &tm, CodeGenOpt::Level OptLevel)
|
explicit X86DAGToDAGISel(X86TargetMachine &tm, CodeGenOpt::Level OptLevel)
|
||||||
: SelectionDAGISel(tm, OptLevel),
|
: SelectionDAGISel(tm, OptLevel),
|
||||||
X86Lowering(*tm.getTargetLowering()),
|
|
||||||
Subtarget(&tm.getSubtarget<X86Subtarget>()),
|
Subtarget(&tm.getSubtarget<X86Subtarget>()),
|
||||||
OptForSize(false) {}
|
OptForSize(false) {}
|
||||||
|
|
||||||
@ -233,7 +228,8 @@ namespace {
|
|||||||
SDValue &Scale, SDValue &Index,
|
SDValue &Scale, SDValue &Index,
|
||||||
SDValue &Disp, SDValue &Segment) {
|
SDValue &Disp, SDValue &Segment) {
|
||||||
Base = (AM.BaseType == X86ISelAddressMode::FrameIndexBase) ?
|
Base = (AM.BaseType == X86ISelAddressMode::FrameIndexBase) ?
|
||||||
CurDAG->getTargetFrameIndex(AM.Base_FrameIndex, TLI->getPointerTy()) :
|
CurDAG->getTargetFrameIndex(AM.Base_FrameIndex,
|
||||||
|
getTargetLowering()->getPointerTy()) :
|
||||||
AM.Base_Reg;
|
AM.Base_Reg;
|
||||||
Scale = getI8Imm(AM.Scale);
|
Scale = getI8Imm(AM.Scale);
|
||||||
Index = AM.IndexReg;
|
Index = AM.IndexReg;
|
||||||
@ -504,8 +500,9 @@ void X86DAGToDAGISel::PreprocessISelDAG() {
|
|||||||
|
|
||||||
// If the source and destination are SSE registers, then this is a legal
|
// If the source and destination are SSE registers, then this is a legal
|
||||||
// conversion that should not be lowered.
|
// conversion that should not be lowered.
|
||||||
bool SrcIsSSE = X86Lowering.isScalarFPTypeInSSEReg(SrcVT);
|
X86TargetLowering *X86Lowering = (X86TargetLowering*)getTargetLowering();
|
||||||
bool DstIsSSE = X86Lowering.isScalarFPTypeInSSEReg(DstVT);
|
bool SrcIsSSE = X86Lowering->isScalarFPTypeInSSEReg(SrcVT);
|
||||||
|
bool DstIsSSE = X86Lowering->isScalarFPTypeInSSEReg(DstVT);
|
||||||
if (SrcIsSSE && DstIsSSE)
|
if (SrcIsSSE && DstIsSSE)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -1556,7 +1553,8 @@ bool X86DAGToDAGISel::TryFoldLoad(SDNode *P, SDValue N,
|
|||||||
///
|
///
|
||||||
SDNode *X86DAGToDAGISel::getGlobalBaseReg() {
|
SDNode *X86DAGToDAGISel::getGlobalBaseReg() {
|
||||||
unsigned GlobalBaseReg = getInstrInfo()->getGlobalBaseReg(MF);
|
unsigned GlobalBaseReg = getInstrInfo()->getGlobalBaseReg(MF);
|
||||||
return CurDAG->getRegister(GlobalBaseReg, TLI->getPointerTy()).getNode();
|
return CurDAG->getRegister(GlobalBaseReg,
|
||||||
|
getTargetLowering()->getPointerTy()).getNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
SDNode *X86DAGToDAGISel::SelectAtomic64(SDNode *Node, unsigned Opc) {
|
SDNode *X86DAGToDAGISel::SelectAtomic64(SDNode *Node, unsigned Opc) {
|
||||||
|
@ -37,13 +37,11 @@ using namespace llvm;
|
|||||||
///
|
///
|
||||||
namespace {
|
namespace {
|
||||||
class XCoreDAGToDAGISel : public SelectionDAGISel {
|
class XCoreDAGToDAGISel : public SelectionDAGISel {
|
||||||
const XCoreTargetLowering &Lowering;
|
|
||||||
const XCoreSubtarget &Subtarget;
|
const XCoreSubtarget &Subtarget;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
XCoreDAGToDAGISel(XCoreTargetMachine &TM, CodeGenOpt::Level OptLevel)
|
XCoreDAGToDAGISel(XCoreTargetMachine &TM, CodeGenOpt::Level OptLevel)
|
||||||
: SelectionDAGISel(TM, OptLevel),
|
: SelectionDAGISel(TM, OptLevel),
|
||||||
Lowering(*TM.getTargetLowering()),
|
|
||||||
Subtarget(*TM.getSubtargetImpl()) { }
|
Subtarget(*TM.getSubtargetImpl()) { }
|
||||||
|
|
||||||
SDNode *Select(SDNode *N);
|
SDNode *Select(SDNode *N);
|
||||||
@ -125,7 +123,7 @@ SDNode *XCoreDAGToDAGISel::Select(SDNode *N) {
|
|||||||
SDValue CPIdx =
|
SDValue CPIdx =
|
||||||
CurDAG->getTargetConstantPool(ConstantInt::get(
|
CurDAG->getTargetConstantPool(ConstantInt::get(
|
||||||
Type::getInt32Ty(*CurDAG->getContext()), Val),
|
Type::getInt32Ty(*CurDAG->getContext()), Val),
|
||||||
TLI->getPointerTy());
|
getTargetLowering()->getPointerTy());
|
||||||
SDNode *node = CurDAG->getMachineNode(XCore::LDWCP_lru6, dl, MVT::i32,
|
SDNode *node = CurDAG->getMachineNode(XCore::LDWCP_lru6, dl, MVT::i32,
|
||||||
MVT::Other, CPIdx,
|
MVT::Other, CPIdx,
|
||||||
CurDAG->getEntryNode());
|
CurDAG->getEntryNode());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user