mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-10-20 09:24:58 +00:00
- Change "ExternalSymbolSDNode" to "SymbolSDNode".
- Add linkage to SymbolSDNode (default to external). - Change ISD::ExternalSymbol to ISD::Symbol. - Change ISD::TargetExternalSymbol to ISD::TargetSymbol These changes pave the way to allowing SymbolSDNodes with non-external linkage. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56249 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
05ae98346a
commit
9468a9b6be
@ -278,7 +278,7 @@ namespace llvm {
|
|||||||
if (isa<FrameIndexSDNode>(Node)) return true;
|
if (isa<FrameIndexSDNode>(Node)) return true;
|
||||||
if (isa<ConstantPoolSDNode>(Node)) return true;
|
if (isa<ConstantPoolSDNode>(Node)) return true;
|
||||||
if (isa<JumpTableSDNode>(Node)) return true;
|
if (isa<JumpTableSDNode>(Node)) return true;
|
||||||
if (isa<ExternalSymbolSDNode>(Node)) return true;
|
if (isa<SymbolSDNode>(Node)) return true;
|
||||||
if (isa<MemOperandSDNode>(Node)) return true;
|
if (isa<MemOperandSDNode>(Node)) return true;
|
||||||
if (Node->getOpcode() == ISD::EntryToken) return true;
|
if (Node->getOpcode() == ISD::EntryToken) return true;
|
||||||
return false;
|
return false;
|
||||||
|
@ -282,8 +282,11 @@ public:
|
|||||||
return getConstantPool(C, VT, Align, Offset, true);
|
return getConstantPool(C, VT, Align, Offset, true);
|
||||||
}
|
}
|
||||||
SDValue getBasicBlock(MachineBasicBlock *MBB);
|
SDValue getBasicBlock(MachineBasicBlock *MBB);
|
||||||
SDValue getExternalSymbol(const char *Sym, MVT VT);
|
SDValue getSymbol(const char *Sym, MVT VT,
|
||||||
SDValue getTargetExternalSymbol(const char *Sym, MVT VT);
|
GlobalValue::LinkageTypes LT = GlobalValue::ExternalLinkage);
|
||||||
|
SDValue getTargetSymbol(const char *Sym, MVT VT,
|
||||||
|
GlobalValue::LinkageTypes LT =
|
||||||
|
GlobalValue::ExternalLinkage);
|
||||||
SDValue getArgFlags(ISD::ArgFlagsTy Flags);
|
SDValue getArgFlags(ISD::ArgFlagsTy Flags);
|
||||||
SDValue getValueType(MVT);
|
SDValue getValueType(MVT);
|
||||||
SDValue getRegister(unsigned Reg, MVT VT);
|
SDValue getRegister(unsigned Reg, MVT VT);
|
||||||
@ -758,8 +761,8 @@ private:
|
|||||||
|
|
||||||
std::vector<SDNode*> ValueTypeNodes;
|
std::vector<SDNode*> ValueTypeNodes;
|
||||||
std::map<MVT, SDNode*, MVT::compareRawBits> ExtendedValueTypeNodes;
|
std::map<MVT, SDNode*, MVT::compareRawBits> ExtendedValueTypeNodes;
|
||||||
StringMap<SDNode*> ExternalSymbols;
|
StringMap<SDNode*> Symbols;
|
||||||
StringMap<SDNode*> TargetExternalSymbols;
|
StringMap<SDNode*> TargetSymbols;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <> struct GraphTraits<SelectionDAG*> : public GraphTraits<SDNode*> {
|
template <> struct GraphTraits<SelectionDAG*> : public GraphTraits<SDNode*> {
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#include "llvm/Value.h"
|
#include "llvm/Value.h"
|
||||||
#include "llvm/Constants.h"
|
#include "llvm/Constants.h"
|
||||||
|
#include "llvm/GlobalValue.h"
|
||||||
#include "llvm/ADT/FoldingSet.h"
|
#include "llvm/ADT/FoldingSet.h"
|
||||||
#include "llvm/ADT/GraphTraits.h"
|
#include "llvm/ADT/GraphTraits.h"
|
||||||
#include "llvm/ADT/iterator.h"
|
#include "llvm/ADT/iterator.h"
|
||||||
@ -89,7 +90,7 @@ namespace ISD {
|
|||||||
BasicBlock, VALUETYPE, ARG_FLAGS, CONDCODE, Register,
|
BasicBlock, VALUETYPE, ARG_FLAGS, CONDCODE, Register,
|
||||||
Constant, ConstantFP,
|
Constant, ConstantFP,
|
||||||
GlobalAddress, GlobalTLSAddress, FrameIndex,
|
GlobalAddress, GlobalTLSAddress, FrameIndex,
|
||||||
JumpTable, ConstantPool, ExternalSymbol,
|
JumpTable, ConstantPool, Symbol,
|
||||||
|
|
||||||
// The address of the GOT
|
// The address of the GOT
|
||||||
GLOBAL_OFFSET_TABLE,
|
GLOBAL_OFFSET_TABLE,
|
||||||
@ -133,7 +134,7 @@ namespace ISD {
|
|||||||
TargetFrameIndex,
|
TargetFrameIndex,
|
||||||
TargetJumpTable,
|
TargetJumpTable,
|
||||||
TargetConstantPool,
|
TargetConstantPool,
|
||||||
TargetExternalSymbol,
|
TargetSymbol,
|
||||||
|
|
||||||
/// RESULT = INTRINSIC_WO_CHAIN(INTRINSICID, arg1, arg2, ...)
|
/// RESULT = INTRINSIC_WO_CHAIN(INTRINSICID, arg1, arg2, ...)
|
||||||
/// This node represents a target intrinsic function with no side effects.
|
/// This node represents a target intrinsic function with no side effects.
|
||||||
@ -487,7 +488,7 @@ namespace ISD {
|
|||||||
// INLINEASM - Represents an inline asm block. This node always has two
|
// INLINEASM - Represents an inline asm block. This node always has two
|
||||||
// return values: a chain and a flag result. The inputs are as follows:
|
// return values: a chain and a flag result. The inputs are as follows:
|
||||||
// Operand #0 : Input chain.
|
// Operand #0 : Input chain.
|
||||||
// Operand #1 : a ExternalSymbolSDNode with a pointer to the asm string.
|
// Operand #1 : A SymbolSDNode with a pointer to the asm string.
|
||||||
// Operand #2n+2: A RegisterNode.
|
// Operand #2n+2: A RegisterNode.
|
||||||
// Operand #2n+3: A TargetConstant, indicating if the reg is a use/def
|
// Operand #2n+3: A TargetConstant, indicating if the reg is a use/def
|
||||||
// Operand #last: Optional, an incoming flag.
|
// Operand #last: Optional, an incoming flag.
|
||||||
@ -2045,23 +2046,24 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class ExternalSymbolSDNode : public SDNode {
|
class SymbolSDNode : public SDNode {
|
||||||
const char *Symbol;
|
const char *Symbol;
|
||||||
|
GlobalValue::LinkageTypes Linkage;
|
||||||
virtual void ANCHOR(); // Out-of-line virtual method to give class a home.
|
virtual void ANCHOR(); // Out-of-line virtual method to give class a home.
|
||||||
protected:
|
protected:
|
||||||
friend class SelectionDAG;
|
friend class SelectionDAG;
|
||||||
ExternalSymbolSDNode(bool isTarget, const char *Sym, MVT VT)
|
SymbolSDNode(bool isTarget, const char *Sym, MVT VT,
|
||||||
: SDNode(isTarget ? ISD::TargetExternalSymbol : ISD::ExternalSymbol,
|
GlobalValue::LinkageTypes L)
|
||||||
getSDVTList(VT)), Symbol(Sym) {
|
: SDNode(isTarget ? ISD::TargetSymbol : ISD::Symbol,
|
||||||
}
|
getSDVTList(VT)), Symbol(Sym), Linkage(L) {}
|
||||||
public:
|
public:
|
||||||
|
|
||||||
const char *getSymbol() const { return Symbol; }
|
const char *getSymbol() const { return Symbol; }
|
||||||
|
GlobalValue::LinkageTypes getLinkage() const { return Linkage; }
|
||||||
|
|
||||||
static bool classof(const ExternalSymbolSDNode *) { return true; }
|
static bool classof(const SymbolSDNode *) { return true; }
|
||||||
static bool classof(const SDNode *N) {
|
static bool classof(const SDNode *N) {
|
||||||
return N->getOpcode() == ISD::ExternalSymbol ||
|
return N->getOpcode() == ISD::Symbol ||
|
||||||
N->getOpcode() == ISD::TargetExternalSymbol;
|
N->getOpcode() == ISD::TargetSymbol;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -799,7 +799,7 @@ SDValue SelectionDAGLegalize::LegalizeOp(SDValue Op) {
|
|||||||
case ISD::TargetConstantPool:
|
case ISD::TargetConstantPool:
|
||||||
case ISD::TargetGlobalAddress:
|
case ISD::TargetGlobalAddress:
|
||||||
case ISD::TargetGlobalTLSAddress:
|
case ISD::TargetGlobalTLSAddress:
|
||||||
case ISD::TargetExternalSymbol:
|
case ISD::TargetSymbol:
|
||||||
case ISD::VALUETYPE:
|
case ISD::VALUETYPE:
|
||||||
case ISD::SRCVALUE:
|
case ISD::SRCVALUE:
|
||||||
case ISD::MEMOPERAND:
|
case ISD::MEMOPERAND:
|
||||||
@ -832,7 +832,7 @@ SDValue SelectionDAGLegalize::LegalizeOp(SDValue Op) {
|
|||||||
case ISD::GLOBAL_OFFSET_TABLE:
|
case ISD::GLOBAL_OFFSET_TABLE:
|
||||||
case ISD::GlobalAddress:
|
case ISD::GlobalAddress:
|
||||||
case ISD::GlobalTLSAddress:
|
case ISD::GlobalTLSAddress:
|
||||||
case ISD::ExternalSymbol:
|
case ISD::Symbol:
|
||||||
case ISD::ConstantPool:
|
case ISD::ConstantPool:
|
||||||
case ISD::JumpTable: // Nothing to do.
|
case ISD::JumpTable: // Nothing to do.
|
||||||
switch (TLI.getOperationAction(Node->getOpcode(), Node->getValueType(0))) {
|
switch (TLI.getOperationAction(Node->getOpcode(), Node->getValueType(0))) {
|
||||||
@ -3979,7 +3979,7 @@ SDValue SelectionDAGLegalize::LegalizeOp(SDValue Op) {
|
|||||||
std::pair<SDValue,SDValue> CallResult =
|
std::pair<SDValue,SDValue> CallResult =
|
||||||
TLI.LowerCallTo(Tmp1, Type::VoidTy,
|
TLI.LowerCallTo(Tmp1, Type::VoidTy,
|
||||||
false, false, false, CallingConv::C, false,
|
false, false, false, CallingConv::C, false,
|
||||||
DAG.getExternalSymbol("abort", TLI.getPointerTy()),
|
DAG.getSymbol("abort", TLI.getPointerTy()),
|
||||||
Args, DAG);
|
Args, DAG);
|
||||||
Result = CallResult.second;
|
Result = CallResult.second;
|
||||||
break;
|
break;
|
||||||
@ -5293,8 +5293,9 @@ SDValue SelectionDAGLegalize::ExpandLibCall(RTLIB::Libcall LC, SDNode *Node,
|
|||||||
Entry.isZExt = !isSigned;
|
Entry.isZExt = !isSigned;
|
||||||
Args.push_back(Entry);
|
Args.push_back(Entry);
|
||||||
}
|
}
|
||||||
SDValue Callee = DAG.getExternalSymbol(TLI.getLibcallName(LC),
|
|
||||||
TLI.getPointerTy());
|
SDValue Callee = DAG.getSymbol(TLI.getLibcallName(LC),
|
||||||
|
TLI.getPointerTy());
|
||||||
|
|
||||||
// Splice the libcall in wherever FindInputOutputChains tells us to.
|
// Splice the libcall in wherever FindInputOutputChains tells us to.
|
||||||
const Type *RetTy = Node->getValueType(0).getTypeForMVT();
|
const Type *RetTy = Node->getValueType(0).getTypeForMVT();
|
||||||
|
@ -623,8 +623,8 @@ SDValue DAGTypeLegalizer::MakeLibCall(RTLIB::Libcall LC, MVT RetVT,
|
|||||||
Entry.isZExt = !isSigned;
|
Entry.isZExt = !isSigned;
|
||||||
Args.push_back(Entry);
|
Args.push_back(Entry);
|
||||||
}
|
}
|
||||||
SDValue Callee = DAG.getExternalSymbol(TLI.getLibcallName(LC),
|
|
||||||
TLI.getPointerTy());
|
SDValue Callee = DAG.getSymbol(TLI.getLibcallName(LC), TLI.getPointerTy());
|
||||||
|
|
||||||
const Type *RetTy = RetVT.getTypeForMVT();
|
const Type *RetTy = RetVT.getTypeForMVT();
|
||||||
std::pair<SDValue,SDValue> CallInfo =
|
std::pair<SDValue,SDValue> CallInfo =
|
||||||
|
@ -288,7 +288,7 @@ void ScheduleDAG::AddOperand(MachineInstr *MI, SDValue Op,
|
|||||||
else
|
else
|
||||||
Idx = ConstPool->getConstantPoolIndex(CP->getConstVal(), Align);
|
Idx = ConstPool->getConstantPoolIndex(CP->getConstVal(), Align);
|
||||||
MI->addOperand(MachineOperand::CreateCPI(Idx, Offset));
|
MI->addOperand(MachineOperand::CreateCPI(Idx, Offset));
|
||||||
} else if (ExternalSymbolSDNode *ES = dyn_cast<ExternalSymbolSDNode>(Op)) {
|
} else if (SymbolSDNode *ES = dyn_cast<SymbolSDNode>(Op)) {
|
||||||
MI->addOperand(MachineOperand::CreateES(ES->getSymbol()));
|
MI->addOperand(MachineOperand::CreateES(ES->getSymbol()));
|
||||||
} else {
|
} else {
|
||||||
assert(Op.getValueType() != MVT::Other &&
|
assert(Op.getValueType() != MVT::Other &&
|
||||||
@ -571,8 +571,7 @@ void ScheduleDAG::EmitNode(SDNode *Node, bool IsClone,
|
|||||||
MachineInstr *MI = BuildMI(*MF, TII->get(TargetInstrInfo::INLINEASM));
|
MachineInstr *MI = BuildMI(*MF, TII->get(TargetInstrInfo::INLINEASM));
|
||||||
|
|
||||||
// Add the asm string as an external symbol operand.
|
// Add the asm string as an external symbol operand.
|
||||||
const char *AsmStr =
|
const char *AsmStr = cast<SymbolSDNode>(Node->getOperand(1))->getSymbol();
|
||||||
cast<ExternalSymbolSDNode>(Node->getOperand(1))->getSymbol();
|
|
||||||
MI->addOperand(MachineOperand::CreateES(AsmStr));
|
MI->addOperand(MachineOperand::CreateES(AsmStr));
|
||||||
|
|
||||||
// Add all of the operand registers to the instruction.
|
// Add all of the operand registers to the instruction.
|
||||||
|
@ -614,12 +614,11 @@ bool SelectionDAG::RemoveNodeFromCSEMaps(SDNode *N) {
|
|||||||
Erased = CondCodeNodes[cast<CondCodeSDNode>(N)->get()] != 0;
|
Erased = CondCodeNodes[cast<CondCodeSDNode>(N)->get()] != 0;
|
||||||
CondCodeNodes[cast<CondCodeSDNode>(N)->get()] = 0;
|
CondCodeNodes[cast<CondCodeSDNode>(N)->get()] = 0;
|
||||||
break;
|
break;
|
||||||
case ISD::ExternalSymbol:
|
case ISD::Symbol:
|
||||||
Erased = ExternalSymbols.erase(cast<ExternalSymbolSDNode>(N)->getSymbol());
|
Erased = Symbols.erase(cast<SymbolSDNode>(N)->getSymbol());
|
||||||
break;
|
break;
|
||||||
case ISD::TargetExternalSymbol:
|
case ISD::TargetSymbol:
|
||||||
Erased =
|
Erased = TargetSymbols.erase(cast<SymbolSDNode>(N)->getSymbol());
|
||||||
TargetExternalSymbols.erase(cast<ExternalSymbolSDNode>(N)->getSymbol());
|
|
||||||
break;
|
break;
|
||||||
case ISD::VALUETYPE: {
|
case ISD::VALUETYPE: {
|
||||||
MVT VT = cast<VTSDNode>(N)->getVT();
|
MVT VT = cast<VTSDNode>(N)->getVT();
|
||||||
@ -842,8 +841,8 @@ void SelectionDAG::clear() {
|
|||||||
CSEMap.clear();
|
CSEMap.clear();
|
||||||
|
|
||||||
ExtendedValueTypeNodes.clear();
|
ExtendedValueTypeNodes.clear();
|
||||||
ExternalSymbols.clear();
|
Symbols.clear();
|
||||||
TargetExternalSymbols.clear();
|
TargetSymbols.clear();
|
||||||
std::fill(CondCodeNodes.begin(), CondCodeNodes.end(),
|
std::fill(CondCodeNodes.begin(), CondCodeNodes.end(),
|
||||||
static_cast<CondCodeSDNode*>(0));
|
static_cast<CondCodeSDNode*>(0));
|
||||||
std::fill(ValueTypeNodes.begin(), ValueTypeNodes.end(),
|
std::fill(ValueTypeNodes.begin(), ValueTypeNodes.end(),
|
||||||
@ -1098,20 +1097,22 @@ SDValue SelectionDAG::getValueType(MVT VT) {
|
|||||||
return SDValue(N, 0);
|
return SDValue(N, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDValue SelectionDAG::getExternalSymbol(const char *Sym, MVT VT) {
|
SDValue SelectionDAG::getSymbol(const char *Sym, MVT VT,
|
||||||
SDNode *&N = ExternalSymbols[Sym];
|
GlobalValue::LinkageTypes LT) {
|
||||||
|
SDNode *&N = Symbols[Sym];
|
||||||
if (N) return SDValue(N, 0);
|
if (N) return SDValue(N, 0);
|
||||||
N = NodeAllocator.Allocate<ExternalSymbolSDNode>();
|
N = NodeAllocator.Allocate<SymbolSDNode>();
|
||||||
new (N) ExternalSymbolSDNode(false, Sym, VT);
|
new (N) SymbolSDNode(false, Sym, VT, LT);
|
||||||
AllNodes.push_back(N);
|
AllNodes.push_back(N);
|
||||||
return SDValue(N, 0);
|
return SDValue(N, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDValue SelectionDAG::getTargetExternalSymbol(const char *Sym, MVT VT) {
|
SDValue SelectionDAG::getTargetSymbol(const char *Sym, MVT VT,
|
||||||
SDNode *&N = TargetExternalSymbols[Sym];
|
GlobalValue::LinkageTypes LT) {
|
||||||
|
SDNode *&N = TargetSymbols[Sym];
|
||||||
if (N) return SDValue(N, 0);
|
if (N) return SDValue(N, 0);
|
||||||
N = NodeAllocator.Allocate<ExternalSymbolSDNode>();
|
N = NodeAllocator.Allocate<SymbolSDNode>();
|
||||||
new (N) ExternalSymbolSDNode(true, Sym, VT);
|
new (N) SymbolSDNode(true, Sym, VT, LT);
|
||||||
AllNodes.push_back(N);
|
AllNodes.push_back(N);
|
||||||
return SDValue(N, 0);
|
return SDValue(N, 0);
|
||||||
}
|
}
|
||||||
@ -3098,7 +3099,7 @@ SDValue SelectionDAG::getMemcpy(SDValue Chain, SDValue Dst,
|
|||||||
std::pair<SDValue,SDValue> CallResult =
|
std::pair<SDValue,SDValue> CallResult =
|
||||||
TLI.LowerCallTo(Chain, Type::VoidTy,
|
TLI.LowerCallTo(Chain, Type::VoidTy,
|
||||||
false, false, false, CallingConv::C, false,
|
false, false, false, CallingConv::C, false,
|
||||||
getExternalSymbol("memcpy", TLI.getPointerTy()),
|
getSymbol("memcpy", TLI.getPointerTy()),
|
||||||
Args, *this);
|
Args, *this);
|
||||||
return CallResult.second;
|
return CallResult.second;
|
||||||
}
|
}
|
||||||
@ -3143,7 +3144,7 @@ SDValue SelectionDAG::getMemmove(SDValue Chain, SDValue Dst,
|
|||||||
std::pair<SDValue,SDValue> CallResult =
|
std::pair<SDValue,SDValue> CallResult =
|
||||||
TLI.LowerCallTo(Chain, Type::VoidTy,
|
TLI.LowerCallTo(Chain, Type::VoidTy,
|
||||||
false, false, false, CallingConv::C, false,
|
false, false, false, CallingConv::C, false,
|
||||||
getExternalSymbol("memmove", TLI.getPointerTy()),
|
getSymbol("memmove", TLI.getPointerTy()),
|
||||||
Args, *this);
|
Args, *this);
|
||||||
return CallResult.second;
|
return CallResult.second;
|
||||||
}
|
}
|
||||||
@ -3194,7 +3195,7 @@ SDValue SelectionDAG::getMemset(SDValue Chain, SDValue Dst,
|
|||||||
std::pair<SDValue,SDValue> CallResult =
|
std::pair<SDValue,SDValue> CallResult =
|
||||||
TLI.LowerCallTo(Chain, Type::VoidTy,
|
TLI.LowerCallTo(Chain, Type::VoidTy,
|
||||||
false, false, false, CallingConv::C, false,
|
false, false, false, CallingConv::C, false,
|
||||||
getExternalSymbol("memset", TLI.getPointerTy()),
|
getSymbol("memset", TLI.getPointerTy()),
|
||||||
Args, *this);
|
Args, *this);
|
||||||
return CallResult.second;
|
return CallResult.second;
|
||||||
}
|
}
|
||||||
@ -4610,7 +4611,7 @@ void MemOperandSDNode::ANCHOR() {}
|
|||||||
void RegisterSDNode::ANCHOR() {}
|
void RegisterSDNode::ANCHOR() {}
|
||||||
void DbgStopPointSDNode::ANCHOR() {}
|
void DbgStopPointSDNode::ANCHOR() {}
|
||||||
void LabelSDNode::ANCHOR() {}
|
void LabelSDNode::ANCHOR() {}
|
||||||
void ExternalSymbolSDNode::ANCHOR() {}
|
void SymbolSDNode::ANCHOR() {}
|
||||||
void CondCodeSDNode::ANCHOR() {}
|
void CondCodeSDNode::ANCHOR() {}
|
||||||
void ARG_FLAGSSDNode::ANCHOR() {}
|
void ARG_FLAGSSDNode::ANCHOR() {}
|
||||||
void VTSDNode::ANCHOR() {}
|
void VTSDNode::ANCHOR() {}
|
||||||
@ -4914,14 +4915,14 @@ std::string SDNode::getOperationName(const SelectionDAG *G) const {
|
|||||||
case ISD::FrameIndex: return "FrameIndex";
|
case ISD::FrameIndex: return "FrameIndex";
|
||||||
case ISD::JumpTable: return "JumpTable";
|
case ISD::JumpTable: return "JumpTable";
|
||||||
case ISD::GLOBAL_OFFSET_TABLE: return "GLOBAL_OFFSET_TABLE";
|
case ISD::GLOBAL_OFFSET_TABLE: return "GLOBAL_OFFSET_TABLE";
|
||||||
case ISD::RETURNADDR: return "RETURNADDR";
|
case ISD::RETURNADDR: return "RETURNADDR";
|
||||||
case ISD::FRAMEADDR: return "FRAMEADDR";
|
case ISD::FRAMEADDR: return "FRAMEADDR";
|
||||||
case ISD::FRAME_TO_ARGS_OFFSET: return "FRAME_TO_ARGS_OFFSET";
|
case ISD::FRAME_TO_ARGS_OFFSET: return "FRAME_TO_ARGS_OFFSET";
|
||||||
case ISD::EXCEPTIONADDR: return "EXCEPTIONADDR";
|
case ISD::EXCEPTIONADDR: return "EXCEPTIONADDR";
|
||||||
case ISD::EHSELECTION: return "EHSELECTION";
|
case ISD::EHSELECTION: return "EHSELECTION";
|
||||||
case ISD::EH_RETURN: return "EH_RETURN";
|
case ISD::EH_RETURN: return "EH_RETURN";
|
||||||
case ISD::ConstantPool: return "ConstantPool";
|
case ISD::ConstantPool: return "ConstantPool";
|
||||||
case ISD::ExternalSymbol: return "ExternalSymbol";
|
case ISD::Symbol: return "Symbol";
|
||||||
case ISD::INTRINSIC_WO_CHAIN: {
|
case ISD::INTRINSIC_WO_CHAIN: {
|
||||||
unsigned IID = cast<ConstantSDNode>(getOperand(0))->getZExtValue();
|
unsigned IID = cast<ConstantSDNode>(getOperand(0))->getZExtValue();
|
||||||
return Intrinsic::getName((Intrinsic::ID)IID);
|
return Intrinsic::getName((Intrinsic::ID)IID);
|
||||||
@ -4940,7 +4941,7 @@ std::string SDNode::getOperationName(const SelectionDAG *G) const {
|
|||||||
case ISD::TargetFrameIndex: return "TargetFrameIndex";
|
case ISD::TargetFrameIndex: return "TargetFrameIndex";
|
||||||
case ISD::TargetJumpTable: return "TargetJumpTable";
|
case ISD::TargetJumpTable: return "TargetJumpTable";
|
||||||
case ISD::TargetConstantPool: return "TargetConstantPool";
|
case ISD::TargetConstantPool: return "TargetConstantPool";
|
||||||
case ISD::TargetExternalSymbol: return "TargetExternalSymbol";
|
case ISD::TargetSymbol: return "TargetSymbol";
|
||||||
|
|
||||||
case ISD::CopyToReg: return "CopyToReg";
|
case ISD::CopyToReg: return "CopyToReg";
|
||||||
case ISD::CopyFromReg: return "CopyFromReg";
|
case ISD::CopyFromReg: return "CopyFromReg";
|
||||||
@ -5230,9 +5231,23 @@ void SDNode::print(raw_ostream &OS, const SelectionDAG *G) const {
|
|||||||
} else {
|
} else {
|
||||||
OS << " #" << R->getReg();
|
OS << " #" << R->getReg();
|
||||||
}
|
}
|
||||||
} else if (const ExternalSymbolSDNode *ES =
|
} else if (const SymbolSDNode *S =
|
||||||
dyn_cast<ExternalSymbolSDNode>(this)) {
|
dyn_cast<SymbolSDNode>(this)) {
|
||||||
OS << "'" << ES->getSymbol() << "'";
|
OS << "'" << S->getSymbol() << "' ";
|
||||||
|
|
||||||
|
switch (S->getLinkage()) {
|
||||||
|
default: assert(0 && "Invalid linkage type!"); break;
|
||||||
|
case GlobalValue::ExternalLinkage: OS << "[external]"; break;
|
||||||
|
case GlobalValue::LinkOnceLinkage: OS << "[once]"; break;
|
||||||
|
case GlobalValue::WeakLinkage: OS << "[weak]"; break;
|
||||||
|
case GlobalValue::AppendingLinkage: OS << "[appending]"; break;
|
||||||
|
case GlobalValue::InternalLinkage: OS << "[internal]"; break;
|
||||||
|
case GlobalValue::DLLImportLinkage: OS << "[dllimport]"; break;
|
||||||
|
case GlobalValue::DLLExportLinkage: OS << "[dllexport]"; break;
|
||||||
|
case GlobalValue::ExternalWeakLinkage: OS << "[externweak]"; break;
|
||||||
|
case GlobalValue::GhostLinkage: OS << "[ghost]"; break;
|
||||||
|
case GlobalValue::CommonLinkage: OS << "[common]"; break;
|
||||||
|
}
|
||||||
} else if (const SrcValueSDNode *M = dyn_cast<SrcValueSDNode>(this)) {
|
} else if (const SrcValueSDNode *M = dyn_cast<SrcValueSDNode>(this)) {
|
||||||
if (M->getValue())
|
if (M->getValue())
|
||||||
OS << "<" << M->getValue() << ">";
|
OS << "<" << M->getValue() << ">";
|
||||||
|
@ -4293,7 +4293,7 @@ void SelectionDAGLowering::visitCall(CallInst &I) {
|
|||||||
if (!RenameFn)
|
if (!RenameFn)
|
||||||
Callee = getValue(I.getOperand(0));
|
Callee = getValue(I.getOperand(0));
|
||||||
else
|
else
|
||||||
Callee = DAG.getExternalSymbol(RenameFn, TLI.getPointerTy());
|
Callee = DAG.getSymbol(RenameFn, TLI.getPointerTy());
|
||||||
|
|
||||||
LowerCallTo(&I, Callee, I.isTailCall());
|
LowerCallTo(&I, Callee, I.isTailCall());
|
||||||
}
|
}
|
||||||
@ -4888,7 +4888,7 @@ void SelectionDAGLowering::visitInlineAsm(CallSite CS) {
|
|||||||
std::vector<SDValue> AsmNodeOperands;
|
std::vector<SDValue> AsmNodeOperands;
|
||||||
AsmNodeOperands.push_back(SDValue()); // reserve space for input chain
|
AsmNodeOperands.push_back(SDValue()); // reserve space for input chain
|
||||||
AsmNodeOperands.push_back(
|
AsmNodeOperands.push_back(
|
||||||
DAG.getTargetExternalSymbol(IA->getAsmString().c_str(), MVT::Other));
|
DAG.getTargetSymbol(IA->getAsmString().c_str(), MVT::Other));
|
||||||
|
|
||||||
|
|
||||||
// Loop over all of the inputs, copying the operand values into the
|
// Loop over all of the inputs, copying the operand values into the
|
||||||
@ -5139,7 +5139,7 @@ void SelectionDAGLowering::visitMalloc(MallocInst &I) {
|
|||||||
|
|
||||||
std::pair<SDValue,SDValue> Result =
|
std::pair<SDValue,SDValue> Result =
|
||||||
TLI.LowerCallTo(getRoot(), I.getType(), false, false, false, CallingConv::C,
|
TLI.LowerCallTo(getRoot(), I.getType(), false, false, false, CallingConv::C,
|
||||||
PerformTailCallOpt, DAG.getExternalSymbol("malloc", IntPtr),
|
PerformTailCallOpt, DAG.getSymbol("malloc", IntPtr),
|
||||||
Args, DAG);
|
Args, DAG);
|
||||||
setValue(&I, Result.first); // Pointers always fit in registers
|
setValue(&I, Result.first); // Pointers always fit in registers
|
||||||
DAG.setRoot(Result.second);
|
DAG.setRoot(Result.second);
|
||||||
@ -5155,7 +5155,7 @@ void SelectionDAGLowering::visitFree(FreeInst &I) {
|
|||||||
std::pair<SDValue,SDValue> Result =
|
std::pair<SDValue,SDValue> Result =
|
||||||
TLI.LowerCallTo(getRoot(), Type::VoidTy, false, false, false,
|
TLI.LowerCallTo(getRoot(), Type::VoidTy, false, false, false,
|
||||||
CallingConv::C, PerformTailCallOpt,
|
CallingConv::C, PerformTailCallOpt,
|
||||||
DAG.getExternalSymbol("free", IntPtr), Args, DAG);
|
DAG.getSymbol("free", IntPtr), Args, DAG);
|
||||||
DAG.setRoot(Result.second);
|
DAG.setRoot(Result.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,9 +185,8 @@ std::string DOTGraphTraits<SelectionDAG*>::getNodeLabel(const SDNode *Node,
|
|||||||
Op += ", isVarArg";
|
Op += ", isVarArg";
|
||||||
if (C->isTailCall())
|
if (C->isTailCall())
|
||||||
Op += ", isTailCall";
|
Op += ", isTailCall";
|
||||||
} else if (const ExternalSymbolSDNode *ES =
|
} else if (const SymbolSDNode *S = dyn_cast<SymbolSDNode>(Node)) {
|
||||||
dyn_cast<ExternalSymbolSDNode>(Node)) {
|
Op += "'" + std::string(S->getSymbol()) + "'";
|
||||||
Op += "'" + std::string(ES->getSymbol()) + "'";
|
|
||||||
} else if (const SrcValueSDNode *M = dyn_cast<SrcValueSDNode>(Node)) {
|
} else if (const SrcValueSDNode *M = dyn_cast<SrcValueSDNode>(Node)) {
|
||||||
if (M->getValue())
|
if (M->getValue())
|
||||||
Op += "<" + M->getValue()->getName() + ">";
|
Op += "<" + M->getValue()->getName() + ">";
|
||||||
|
@ -531,9 +531,9 @@ SDValue ARMTargetLowering::LowerCALL(SDValue Op, SelectionDAG &DAG) {
|
|||||||
InFlag = Chain.getValue(1);
|
InFlag = Chain.getValue(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the callee is a GlobalAddress/ExternalSymbol node (quite common, every
|
// If the callee is a GlobalAddress/Symbol node (quite common, every direct
|
||||||
// direct call is) turn it into a TargetGlobalAddress/TargetExternalSymbol
|
// call is) turn it into a TargetGlobalAddress/TargetSymbol node so that
|
||||||
// node so that legalize doesn't hack it.
|
// legalize doesn't hack it.
|
||||||
bool isDirect = false;
|
bool isDirect = false;
|
||||||
bool isARMFunc = false;
|
bool isARMFunc = false;
|
||||||
bool isLocalARMFunc = false;
|
bool isLocalARMFunc = false;
|
||||||
@ -558,7 +558,7 @@ SDValue ARMTargetLowering::LowerCALL(SDValue Op, SelectionDAG &DAG) {
|
|||||||
Callee = DAG.getNode(ARMISD::PIC_ADD, getPointerTy(), Callee, PICLabel);
|
Callee = DAG.getNode(ARMISD::PIC_ADD, getPointerTy(), Callee, PICLabel);
|
||||||
} else
|
} else
|
||||||
Callee = DAG.getTargetGlobalAddress(GV, getPointerTy());
|
Callee = DAG.getTargetGlobalAddress(GV, getPointerTy());
|
||||||
} else if (ExternalSymbolSDNode *S = dyn_cast<ExternalSymbolSDNode>(Callee)) {
|
} else if (SymbolSDNode *S = dyn_cast<SymbolSDNode>(Callee)) {
|
||||||
isDirect = true;
|
isDirect = true;
|
||||||
bool isStub = Subtarget->isTargetDarwin() &&
|
bool isStub = Subtarget->isTargetDarwin() &&
|
||||||
getTargetMachine().getRelocationModel() != Reloc::Static;
|
getTargetMachine().getRelocationModel() != Reloc::Static;
|
||||||
@ -574,7 +574,7 @@ SDValue ARMTargetLowering::LowerCALL(SDValue Op, SelectionDAG &DAG) {
|
|||||||
SDValue PICLabel = DAG.getConstant(ARMPCLabelIndex++, MVT::i32);
|
SDValue PICLabel = DAG.getConstant(ARMPCLabelIndex++, MVT::i32);
|
||||||
Callee = DAG.getNode(ARMISD::PIC_ADD, getPointerTy(), Callee, PICLabel);
|
Callee = DAG.getNode(ARMISD::PIC_ADD, getPointerTy(), Callee, PICLabel);
|
||||||
} else
|
} else
|
||||||
Callee = DAG.getTargetExternalSymbol(Sym, getPointerTy());
|
Callee = DAG.getTargetSymbol(Sym, getPointerTy(), S->getLinkage());
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: handle tail calls differently.
|
// FIXME: handle tail calls differently.
|
||||||
@ -715,12 +715,11 @@ static SDValue LowerRET(SDValue Op, SelectionDAG &DAG) {
|
|||||||
return DAG.getNode(ARMISD::RET_FLAG, MVT::Other, Copy, Copy.getValue(1));
|
return DAG.getNode(ARMISD::RET_FLAG, MVT::Other, Copy, Copy.getValue(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ConstantPool, JumpTable, GlobalAddress, and ExternalSymbol are lowered as
|
// ConstantPool, JumpTable, GlobalAddress, and Symbol are lowered as their
|
||||||
// their target countpart wrapped in the ARMISD::Wrapper node. Suppose N is
|
// target countpart wrapped in the ARMISD::Wrapper node. Suppose N is one of the
|
||||||
// one of the above mentioned nodes. It has to be wrapped because otherwise
|
// above mentioned nodes. It has to be wrapped because otherwise Select(N)
|
||||||
// Select(N) returns N. So the raw TargetGlobalAddress nodes, etc. can only
|
// returns N. So the raw TargetGlobalAddress nodes, etc. can only be used to
|
||||||
// be used to form addressing mode. These wrapped nodes will be selected
|
// form addressing mode. These wrapped nodes will be selected into MOVi.
|
||||||
// into MOVi.
|
|
||||||
static SDValue LowerConstantPool(SDValue Op, SelectionDAG &DAG) {
|
static SDValue LowerConstantPool(SDValue Op, SelectionDAG &DAG) {
|
||||||
MVT PtrVT = Op.getValueType();
|
MVT PtrVT = Op.getValueType();
|
||||||
ConstantPoolSDNode *CP = cast<ConstantPoolSDNode>(Op);
|
ConstantPoolSDNode *CP = cast<ConstantPoolSDNode>(Op);
|
||||||
@ -760,7 +759,7 @@ ARMTargetLowering::LowerToTLSGeneralDynamicModel(GlobalAddressSDNode *GA,
|
|||||||
std::pair<SDValue, SDValue> CallResult =
|
std::pair<SDValue, SDValue> CallResult =
|
||||||
LowerCallTo(Chain, (const Type *) Type::Int32Ty, false, false, false,
|
LowerCallTo(Chain, (const Type *) Type::Int32Ty, false, false, false,
|
||||||
CallingConv::C, false,
|
CallingConv::C, false,
|
||||||
DAG.getExternalSymbol("__tls_get_addr", PtrVT), Args, DAG);
|
DAG.getSymbol("__tls_get_addr", PtrVT), Args, DAG);
|
||||||
return CallResult.first;
|
return CallResult.first;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,12 +125,11 @@ AlphaTargetLowering::AlphaTargetLowering(TargetMachine &TM) : TargetLowering(TM)
|
|||||||
setOperationAction(ISD::STACKRESTORE, MVT::Other, Expand);
|
setOperationAction(ISD::STACKRESTORE, MVT::Other, Expand);
|
||||||
setOperationAction(ISD::DYNAMIC_STACKALLOC, MVT::i64, Expand);
|
setOperationAction(ISD::DYNAMIC_STACKALLOC, MVT::i64, Expand);
|
||||||
|
|
||||||
// We want to legalize GlobalAddress and ConstantPool and
|
// We want to legalize GlobalAddress and ConstantPool and Symbols nodes into
|
||||||
// ExternalSymbols nodes into the appropriate instructions to
|
// the appropriate instructions to materialize the address.
|
||||||
// materialize the address.
|
|
||||||
setOperationAction(ISD::GlobalAddress, MVT::i64, Custom);
|
setOperationAction(ISD::GlobalAddress, MVT::i64, Custom);
|
||||||
setOperationAction(ISD::ConstantPool, MVT::i64, Custom);
|
setOperationAction(ISD::ConstantPool, MVT::i64, Custom);
|
||||||
setOperationAction(ISD::ExternalSymbol, MVT::i64, Custom);
|
setOperationAction(ISD::Symbol, MVT::i64, Custom);
|
||||||
setOperationAction(ISD::GlobalTLSAddress, MVT::i64, Custom);
|
setOperationAction(ISD::GlobalTLSAddress, MVT::i64, Custom);
|
||||||
|
|
||||||
setOperationAction(ISD::VASTART, MVT::Other, Custom);
|
setOperationAction(ISD::VASTART, MVT::Other, Custom);
|
||||||
@ -491,13 +490,13 @@ SDValue AlphaTargetLowering::LowerOperation(SDValue Op, SelectionDAG &DAG) {
|
|||||||
return DAG.getNode(AlphaISD::RelLit, MVT::i64, GA,
|
return DAG.getNode(AlphaISD::RelLit, MVT::i64, GA,
|
||||||
DAG.getNode(ISD::GLOBAL_OFFSET_TABLE, MVT::i64));
|
DAG.getNode(ISD::GLOBAL_OFFSET_TABLE, MVT::i64));
|
||||||
}
|
}
|
||||||
case ISD::ExternalSymbol: {
|
case ISD::Symbol: {
|
||||||
|
SymbolSDNode *S = cast<SymbolSDNode>(Op);
|
||||||
return DAG.getNode(AlphaISD::RelLit, MVT::i64,
|
return DAG.getNode(AlphaISD::RelLit, MVT::i64,
|
||||||
DAG.getTargetExternalSymbol(cast<ExternalSymbolSDNode>(Op)
|
DAG.getTargetSymbol(S->getSymbol(), MVT::i64,
|
||||||
->getSymbol(), MVT::i64),
|
S->getLinkage()),
|
||||||
DAG.getNode(ISD::GLOBAL_OFFSET_TABLE, MVT::i64));
|
DAG.getNode(ISD::GLOBAL_OFFSET_TABLE, MVT::i64));
|
||||||
}
|
}
|
||||||
|
|
||||||
case ISD::UREM:
|
case ISD::UREM:
|
||||||
case ISD::SREM:
|
case ISD::SREM:
|
||||||
//Expand only on constant case
|
//Expand only on constant case
|
||||||
@ -526,7 +525,7 @@ SDValue AlphaTargetLowering::LowerOperation(SDValue Op, SelectionDAG &DAG) {
|
|||||||
}
|
}
|
||||||
SDValue Tmp1 = Op.getOperand(0),
|
SDValue Tmp1 = Op.getOperand(0),
|
||||||
Tmp2 = Op.getOperand(1),
|
Tmp2 = Op.getOperand(1),
|
||||||
Addr = DAG.getExternalSymbol(opstr, MVT::i64);
|
Addr = DAG.getSymbol(opstr, MVT::i64);
|
||||||
return DAG.getNode(AlphaISD::DivCall, MVT::i64, Addr, Tmp1, Tmp2);
|
return DAG.getNode(AlphaISD::DivCall, MVT::i64, Addr, Tmp1, Tmp2);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -92,12 +92,12 @@ namespace {
|
|||||||
|| Opc == ISD::GlobalTLSAddress
|
|| Opc == ISD::GlobalTLSAddress
|
||||||
|| Opc == ISD::JumpTable
|
|| Opc == ISD::JumpTable
|
||||||
|| Opc == ISD::ConstantPool
|
|| Opc == ISD::ConstantPool
|
||||||
|| Opc == ISD::ExternalSymbol
|
|| Opc == ISD::Symbol
|
||||||
|| Opc == ISD::TargetGlobalAddress
|
|| Opc == ISD::TargetGlobalAddress
|
||||||
|| Opc == ISD::TargetGlobalTLSAddress
|
|| Opc == ISD::TargetGlobalTLSAddress
|
||||||
|| Opc == ISD::TargetJumpTable
|
|| Opc == ISD::TargetJumpTable
|
||||||
|| Opc == ISD::TargetConstantPool
|
|| Opc == ISD::TargetConstantPool
|
||||||
|| Opc == ISD::TargetExternalSymbol
|
|| Opc == ISD::TargetSymbol
|
||||||
|| Opc == SPUISD::AFormAddr);
|
|| Opc == SPUISD::AFormAddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1201,9 +1201,9 @@ LowerCALL(SDValue Op, SelectionDAG &DAG, const SPUSubtarget *ST) {
|
|||||||
SmallVector<SDValue, 8> Ops;
|
SmallVector<SDValue, 8> Ops;
|
||||||
unsigned CallOpc = SPUISD::CALL;
|
unsigned CallOpc = SPUISD::CALL;
|
||||||
|
|
||||||
// If the callee is a GlobalAddress/ExternalSymbol node (quite common, every
|
// If the callee is a GlobalAddress/Symbol node (quite common, every direct
|
||||||
// direct call is) turn it into a TargetGlobalAddress/TargetExternalSymbol
|
// call is) turn it into a TargetGlobalAddress/TargetSymbol node so that
|
||||||
// node so that legalize doesn't hack it.
|
// legalize doesn't hack it.
|
||||||
if (GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee)) {
|
if (GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee)) {
|
||||||
GlobalValue *GV = G->getGlobal();
|
GlobalValue *GV = G->getGlobal();
|
||||||
MVT CalleeVT = Callee.getValueType();
|
MVT CalleeVT = Callee.getValueType();
|
||||||
@ -1229,8 +1229,9 @@ LowerCALL(SDValue Op, SelectionDAG &DAG, const SPUSubtarget *ST) {
|
|||||||
// address pairs:
|
// address pairs:
|
||||||
Callee = DAG.getNode(SPUISD::IndirectAddr, PtrVT, GA, Zero);
|
Callee = DAG.getNode(SPUISD::IndirectAddr, PtrVT, GA, Zero);
|
||||||
}
|
}
|
||||||
} else if (ExternalSymbolSDNode *S = dyn_cast<ExternalSymbolSDNode>(Callee))
|
} else if (SymbolSDNode *S = dyn_cast<SymbolSDNode>(Callee))
|
||||||
Callee = DAG.getExternalSymbol(S->getSymbol(), Callee.getValueType());
|
Callee = DAG.getSymbol(S->getSymbol(), Callee.getValueType(),
|
||||||
|
S->getLinkage());
|
||||||
else if (SDNode *Dest = isLSAAddress(Callee, DAG)) {
|
else if (SDNode *Dest = isLSAAddress(Callee, DAG)) {
|
||||||
// If this is an absolute destination address that appears to be a legal
|
// If this is an absolute destination address that appears to be a legal
|
||||||
// local store address, use the munged value.
|
// local store address, use the munged value.
|
||||||
|
@ -329,7 +329,7 @@ SDNode *IA64DAGToDAGISel::Select(SDValue Op) {
|
|||||||
dyn_cast<GlobalAddressSDNode>(N->getOperand(1))) {
|
dyn_cast<GlobalAddressSDNode>(N->getOperand(1))) {
|
||||||
CallOpcode = IA64::BRCALL_IPREL_GA;
|
CallOpcode = IA64::BRCALL_IPREL_GA;
|
||||||
CallOperand = CurDAG->getTargetGlobalAddress(GASD->getGlobal(), MVT::i64);
|
CallOperand = CurDAG->getTargetGlobalAddress(GASD->getGlobal(), MVT::i64);
|
||||||
} else if (isa<ExternalSymbolSDNode>(N->getOperand(1))) {
|
} else if (isa<SymbolSDNode>(N->getOperand(1))) {
|
||||||
// FIXME: we currently NEED this case for correctness, to avoid
|
// FIXME: we currently NEED this case for correctness, to avoid
|
||||||
// "non-pic code with imm reloc.n against dynamic symbol" errors
|
// "non-pic code with imm reloc.n against dynamic symbol" errors
|
||||||
CallOpcode = IA64::BRCALL_IPREL_ES;
|
CallOpcode = IA64::BRCALL_IPREL_ES;
|
||||||
@ -448,9 +448,9 @@ SDNode *IA64DAGToDAGISel::Select(SDValue Op) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* XXX
|
/* XXX
|
||||||
case ISD::ExternalSymbol: {
|
case ISD::Symbol: {
|
||||||
SDValue EA = CurDAG->getTargetExternalSymbol(
|
SDValue EA = CurDAG->getTargetSymbol(
|
||||||
cast<ExternalSymbolSDNode>(N)->getSymbol(),
|
cast<SymbolSDNode>(N)->getSymbol(),
|
||||||
MVT::i64);
|
MVT::i64);
|
||||||
SDValue Tmp = CurDAG->getTargetNode(IA64::ADDL_EA, MVT::i64,
|
SDValue Tmp = CurDAG->getTargetNode(IA64::ADDL_EA, MVT::i64,
|
||||||
CurDAG->getRegister(IA64::r1,
|
CurDAG->getRegister(IA64::r1,
|
||||||
|
@ -159,7 +159,7 @@ SelectAddr(SDValue Op, SDValue Addr, SDValue &Offset, SDValue &Base)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ((Addr.getOpcode() == ISD::TargetExternalSymbol ||
|
if ((Addr.getOpcode() == ISD::TargetSymbol ||
|
||||||
Addr.getOpcode() == ISD::TargetGlobalAddress))
|
Addr.getOpcode() == ISD::TargetGlobalAddress))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -354,7 +354,7 @@ Select(SDValue N)
|
|||||||
SDValue InFlag(0, 0);
|
SDValue InFlag(0, 0);
|
||||||
|
|
||||||
if ( (isa<GlobalAddressSDNode>(Callee)) ||
|
if ( (isa<GlobalAddressSDNode>(Callee)) ||
|
||||||
(isa<ExternalSymbolSDNode>(Callee)) )
|
(isa<SymbolSDNode>(Callee)) )
|
||||||
{
|
{
|
||||||
/// Direct call for global addresses and external symbols
|
/// Direct call for global addresses and external symbols
|
||||||
SDValue GPReg = CurDAG->getRegister(Mips::GP, MVT::i32);
|
SDValue GPReg = CurDAG->getRegister(Mips::GP, MVT::i32);
|
||||||
|
@ -684,14 +684,14 @@ LowerCALL(SDValue Op, SelectionDAG &DAG)
|
|||||||
InFlag = Chain.getValue(1);
|
InFlag = Chain.getValue(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the callee is a GlobalAddress/ExternalSymbol node (quite common, every
|
// If the callee is a GlobalAddress/Symbol node (quite common, every direct
|
||||||
// direct call is) turn it into a TargetGlobalAddress/TargetExternalSymbol
|
// call is) turn it into a TargetGlobalAddress/TargetSymbol node so that
|
||||||
// node so that legalize doesn't hack it.
|
// legalize doesn't hack it.
|
||||||
if (GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee))
|
if (GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee))
|
||||||
Callee = DAG.getTargetGlobalAddress(G->getGlobal(), getPointerTy());
|
Callee = DAG.getTargetGlobalAddress(G->getGlobal(), getPointerTy());
|
||||||
else if (ExternalSymbolSDNode *S = dyn_cast<ExternalSymbolSDNode>(Callee))
|
else if (SymbolSDNode *S = dyn_cast<SymbolSDNode>(Callee))
|
||||||
Callee = DAG.getTargetExternalSymbol(S->getSymbol(), getPointerTy());
|
Callee = DAG.getTargetSymbol(S->getSymbol(), getPointerTy(),
|
||||||
|
S->getLinkage());
|
||||||
|
|
||||||
// MipsJmpLink = #chain, #target_address, #opt_in_flags...
|
// MipsJmpLink = #chain, #target_address, #opt_in_flags...
|
||||||
// = Chain, Callee, Reg#1, Reg#2, ...
|
// = Chain, Callee, Reg#1, Reg#2, ...
|
||||||
|
@ -2462,13 +2462,14 @@ SDValue PPCTargetLowering::LowerCALL(SDValue Op, SelectionDAG &DAG,
|
|||||||
SmallVector<SDValue, 8> Ops;
|
SmallVector<SDValue, 8> Ops;
|
||||||
unsigned CallOpc = isMachoABI? PPCISD::CALL_Macho : PPCISD::CALL_ELF;
|
unsigned CallOpc = isMachoABI? PPCISD::CALL_Macho : PPCISD::CALL_ELF;
|
||||||
|
|
||||||
// If the callee is a GlobalAddress/ExternalSymbol node (quite common, every
|
// If the callee is a GlobalAddress/Symbol node (quite common, every direct
|
||||||
// direct call is) turn it into a TargetGlobalAddress/TargetExternalSymbol
|
// call is) turn it into a TargetGlobalAddress/TargetSymbol node so that
|
||||||
// node so that legalize doesn't hack it.
|
// legalize doesn't hack it.
|
||||||
if (GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee))
|
if (GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee))
|
||||||
Callee = DAG.getTargetGlobalAddress(G->getGlobal(), Callee.getValueType());
|
Callee = DAG.getTargetGlobalAddress(G->getGlobal(), Callee.getValueType());
|
||||||
else if (ExternalSymbolSDNode *S = dyn_cast<ExternalSymbolSDNode>(Callee))
|
else if (SymbolSDNode *S = dyn_cast<SymbolSDNode>(Callee))
|
||||||
Callee = DAG.getTargetExternalSymbol(S->getSymbol(), Callee.getValueType());
|
Callee = DAG.getTargetSymbol(S->getSymbol(), Callee.getValueType(),
|
||||||
|
S->getLinkage());
|
||||||
else if (SDNode *Dest = isBLACompatibleAddress(Callee, DAG))
|
else if (SDNode *Dest = isBLACompatibleAddress(Callee, DAG))
|
||||||
// If this is an absolute destination address, use the munged value.
|
// If this is an absolute destination address, use the munged value.
|
||||||
Callee = SDValue(Dest, 0);
|
Callee = SDValue(Dest, 0);
|
||||||
@ -2593,7 +2594,7 @@ SDValue PPCTargetLowering::LowerRET(SDValue Op, SelectionDAG &DAG,
|
|||||||
|
|
||||||
assert(((TargetAddress.getOpcode() == ISD::Register &&
|
assert(((TargetAddress.getOpcode() == ISD::Register &&
|
||||||
cast<RegisterSDNode>(TargetAddress)->getReg() == PPC::CTR) ||
|
cast<RegisterSDNode>(TargetAddress)->getReg() == PPC::CTR) ||
|
||||||
TargetAddress.getOpcode() == ISD::TargetExternalSymbol ||
|
TargetAddress.getOpcode() == ISD::TargetSymbol ||
|
||||||
TargetAddress.getOpcode() == ISD::TargetGlobalAddress ||
|
TargetAddress.getOpcode() == ISD::TargetGlobalAddress ||
|
||||||
isa<ConstantSDNode>(TargetAddress)) &&
|
isa<ConstantSDNode>(TargetAddress)) &&
|
||||||
"Expecting an global address, external symbol, absolute value or register");
|
"Expecting an global address, external symbol, absolute value or register");
|
||||||
@ -3414,7 +3415,7 @@ SDValue PPCTargetLowering::LowerBUILD_VECTOR(SDValue Op,
|
|||||||
static SDValue GeneratePerfectShuffle(unsigned PFEntry, SDValue LHS,
|
static SDValue GeneratePerfectShuffle(unsigned PFEntry, SDValue LHS,
|
||||||
SDValue RHS, SelectionDAG &DAG) {
|
SDValue RHS, SelectionDAG &DAG) {
|
||||||
unsigned OpNum = (PFEntry >> 26) & 0x0F;
|
unsigned OpNum = (PFEntry >> 26) & 0x0F;
|
||||||
unsigned LHSID = (PFEntry >> 13) & ((1 << 13)-1);
|
unsigned LHSID = (PFEntry >> 13) & ((1 << 13)-1);
|
||||||
unsigned RHSID = (PFEntry >> 0) & ((1 << 13)-1);
|
unsigned RHSID = (PFEntry >> 0) & ((1 << 13)-1);
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
@ -77,7 +77,7 @@ bool SparcDAGToDAGISel::SelectADDRri(SDValue Op, SDValue Addr,
|
|||||||
Offset = CurDAG->getTargetConstant(0, MVT::i32);
|
Offset = CurDAG->getTargetConstant(0, MVT::i32);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (Addr.getOpcode() == ISD::TargetExternalSymbol ||
|
if (Addr.getOpcode() == ISD::TargetSymbol ||
|
||||||
Addr.getOpcode() == ISD::TargetGlobalAddress)
|
Addr.getOpcode() == ISD::TargetGlobalAddress)
|
||||||
return false; // direct calls.
|
return false; // direct calls.
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ bool SparcDAGToDAGISel::SelectADDRri(SDValue Op, SDValue Addr,
|
|||||||
bool SparcDAGToDAGISel::SelectADDRrr(SDValue Op, SDValue Addr,
|
bool SparcDAGToDAGISel::SelectADDRrr(SDValue Op, SDValue Addr,
|
||||||
SDValue &R1, SDValue &R2) {
|
SDValue &R1, SDValue &R2) {
|
||||||
if (Addr.getOpcode() == ISD::FrameIndex) return false;
|
if (Addr.getOpcode() == ISD::FrameIndex) return false;
|
||||||
if (Addr.getOpcode() == ISD::TargetExternalSymbol ||
|
if (Addr.getOpcode() == ISD::TargetSymbol ||
|
||||||
Addr.getOpcode() == ISD::TargetGlobalAddress)
|
Addr.getOpcode() == ISD::TargetGlobalAddress)
|
||||||
return false; // direct calls.
|
return false; // direct calls.
|
||||||
|
|
||||||
|
@ -407,11 +407,11 @@ static SDValue LowerCALL(SDValue Op, SelectionDAG &DAG) {
|
|||||||
|
|
||||||
// If the callee is a GlobalAddress node (quite common, every direct call is)
|
// If the callee is a GlobalAddress node (quite common, every direct call is)
|
||||||
// turn it into a TargetGlobalAddress node so that legalize doesn't hack it.
|
// turn it into a TargetGlobalAddress node so that legalize doesn't hack it.
|
||||||
// Likewise ExternalSymbol -> TargetExternalSymbol.
|
// Likewise Symbol -> TargetSymbol.
|
||||||
if (GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee))
|
if (GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee))
|
||||||
Callee = DAG.getTargetGlobalAddress(G->getGlobal(), MVT::i32);
|
Callee = DAG.getTargetGlobalAddress(G->getGlobal(), MVT::i32);
|
||||||
else if (ExternalSymbolSDNode *E = dyn_cast<ExternalSymbolSDNode>(Callee))
|
else if (SymbolSDNode *S = dyn_cast<SymbolSDNode>(Callee))
|
||||||
Callee = DAG.getTargetExternalSymbol(E->getSymbol(), MVT::i32);
|
Callee = DAG.getTargetSymbol(S->getSymbol(), MVT::i32, S->getLinkage());
|
||||||
|
|
||||||
std::vector<MVT> NodeTys;
|
std::vector<MVT> NodeTys;
|
||||||
NodeTys.push_back(MVT::Other); // Returns a chain
|
NodeTys.push_back(MVT::Other); // Returns a chain
|
||||||
|
@ -265,10 +265,10 @@ def frameindex : SDNode<"ISD::FrameIndex", SDTPtrLeaf, [],
|
|||||||
"FrameIndexSDNode">;
|
"FrameIndexSDNode">;
|
||||||
def tframeindex : SDNode<"ISD::TargetFrameIndex", SDTPtrLeaf, [],
|
def tframeindex : SDNode<"ISD::TargetFrameIndex", SDTPtrLeaf, [],
|
||||||
"FrameIndexSDNode">;
|
"FrameIndexSDNode">;
|
||||||
def externalsym : SDNode<"ISD::ExternalSymbol", SDTPtrLeaf, [],
|
def externalsym : SDNode<"ISD::Symbol", SDTPtrLeaf, [],
|
||||||
"ExternalSymbolSDNode">;
|
"SymbolSDNode">;
|
||||||
def texternalsym: SDNode<"ISD::TargetExternalSymbol", SDTPtrLeaf, [],
|
def texternalsym: SDNode<"ISD::TargetSymbol", SDTPtrLeaf, [],
|
||||||
"ExternalSymbolSDNode">;
|
"SymbolSDNode">;
|
||||||
|
|
||||||
def add : SDNode<"ISD::ADD" , SDTIntBinOp ,
|
def add : SDNode<"ISD::ADD" , SDTIntBinOp ,
|
||||||
[SDNPCommutative, SDNPAssociative]>;
|
[SDNPCommutative, SDNPAssociative]>;
|
||||||
|
@ -207,7 +207,7 @@ namespace {
|
|||||||
Disp = CurDAG->getTargetConstantPool(AM.CP, MVT::i32,
|
Disp = CurDAG->getTargetConstantPool(AM.CP, MVT::i32,
|
||||||
AM.Align, AM.Disp);
|
AM.Align, AM.Disp);
|
||||||
else if (AM.ES)
|
else if (AM.ES)
|
||||||
Disp = CurDAG->getTargetExternalSymbol(AM.ES, MVT::i32);
|
Disp = CurDAG->getTargetSymbol(AM.ES, MVT::i32);
|
||||||
else if (AM.JT != -1)
|
else if (AM.JT != -1)
|
||||||
Disp = CurDAG->getTargetJumpTable(AM.JT, MVT::i32);
|
Disp = CurDAG->getTargetJumpTable(AM.JT, MVT::i32);
|
||||||
else
|
else
|
||||||
@ -835,7 +835,7 @@ DOUT << "AlreadySelected " << AlreadySelected << "\n";
|
|||||||
AM.isRIPRel = TM.getRelocationModel() != Reloc::Static &&
|
AM.isRIPRel = TM.getRelocationModel() != Reloc::Static &&
|
||||||
Subtarget->isPICStyleRIPRel();
|
Subtarget->isPICStyleRIPRel();
|
||||||
return false;
|
return false;
|
||||||
} else if (ExternalSymbolSDNode *S =dyn_cast<ExternalSymbolSDNode>(N0)) {
|
} else if (SymbolSDNode *S = dyn_cast<SymbolSDNode>(N0)) {
|
||||||
AM.ES = S->getSymbol();
|
AM.ES = S->getSymbol();
|
||||||
AM.isRIPRel = TM.getRelocationModel() != Reloc::Static &&
|
AM.isRIPRel = TM.getRelocationModel() != Reloc::Static &&
|
||||||
Subtarget->isPICStyleRIPRel();
|
Subtarget->isPICStyleRIPRel();
|
||||||
@ -1292,7 +1292,7 @@ SDNode *X86DAGToDAGISel::Select(SDValue N) {
|
|||||||
N1.getOpcode() == ISD::Constant) {
|
N1.getOpcode() == ISD::Constant) {
|
||||||
unsigned Offset = (unsigned)cast<ConstantSDNode>(N1)->getZExtValue();
|
unsigned Offset = (unsigned)cast<ConstantSDNode>(N1)->getZExtValue();
|
||||||
SDValue C(0, 0);
|
SDValue C(0, 0);
|
||||||
// TODO: handle ExternalSymbolSDNode.
|
// TODO: handle SymbolSDNode.
|
||||||
if (GlobalAddressSDNode *G =
|
if (GlobalAddressSDNode *G =
|
||||||
dyn_cast<GlobalAddressSDNode>(N0.getOperand(0))) {
|
dyn_cast<GlobalAddressSDNode>(N0.getOperand(0))) {
|
||||||
C = CurDAG->getTargetGlobalAddress(G->getGlobal(), PtrVT,
|
C = CurDAG->getTargetGlobalAddress(G->getGlobal(), PtrVT,
|
||||||
|
@ -268,12 +268,12 @@ X86TargetLowering::X86TargetLowering(X86TargetMachine &TM)
|
|||||||
setOperationAction(ISD::GlobalTLSAddress, MVT::i32 , Custom);
|
setOperationAction(ISD::GlobalTLSAddress, MVT::i32 , Custom);
|
||||||
if (Subtarget->is64Bit())
|
if (Subtarget->is64Bit())
|
||||||
setOperationAction(ISD::GlobalTLSAddress, MVT::i64, Custom);
|
setOperationAction(ISD::GlobalTLSAddress, MVT::i64, Custom);
|
||||||
setOperationAction(ISD::ExternalSymbol , MVT::i32 , Custom);
|
setOperationAction(ISD::Symbol , MVT::i32 , Custom);
|
||||||
if (Subtarget->is64Bit()) {
|
if (Subtarget->is64Bit()) {
|
||||||
setOperationAction(ISD::ConstantPool , MVT::i64 , Custom);
|
setOperationAction(ISD::ConstantPool , MVT::i64 , Custom);
|
||||||
setOperationAction(ISD::JumpTable , MVT::i64 , Custom);
|
setOperationAction(ISD::JumpTable , MVT::i64 , Custom);
|
||||||
setOperationAction(ISD::GlobalAddress , MVT::i64 , Custom);
|
setOperationAction(ISD::GlobalAddress , MVT::i64 , Custom);
|
||||||
setOperationAction(ISD::ExternalSymbol, MVT::i64 , Custom);
|
setOperationAction(ISD::Symbol , MVT::i64 , Custom);
|
||||||
}
|
}
|
||||||
// 64-bit addm sub, shl, sra, srl (iff 32-bit x86)
|
// 64-bit addm sub, shl, sra, srl (iff 32-bit x86)
|
||||||
setOperationAction(ISD::SHL_PARTS , MVT::i32 , Custom);
|
setOperationAction(ISD::SHL_PARTS , MVT::i32 , Custom);
|
||||||
@ -892,7 +892,7 @@ SDValue X86TargetLowering::LowerRET(SDValue Op, SelectionDAG &DAG) {
|
|||||||
assert(((TargetAddress.getOpcode() == ISD::Register &&
|
assert(((TargetAddress.getOpcode() == ISD::Register &&
|
||||||
(cast<RegisterSDNode>(TargetAddress)->getReg() == X86::ECX ||
|
(cast<RegisterSDNode>(TargetAddress)->getReg() == X86::ECX ||
|
||||||
cast<RegisterSDNode>(TargetAddress)->getReg() == X86::R9)) ||
|
cast<RegisterSDNode>(TargetAddress)->getReg() == X86::R9)) ||
|
||||||
TargetAddress.getOpcode() == ISD::TargetExternalSymbol ||
|
TargetAddress.getOpcode() == ISD::TargetSymbol ||
|
||||||
TargetAddress.getOpcode() == ISD::TargetGlobalAddress) &&
|
TargetAddress.getOpcode() == ISD::TargetGlobalAddress) &&
|
||||||
"Expecting an global address, external symbol, or register");
|
"Expecting an global address, external symbol, or register");
|
||||||
assert(StackAdjustment.getOpcode() == ISD::Constant &&
|
assert(StackAdjustment.getOpcode() == ISD::Constant &&
|
||||||
@ -1608,8 +1608,8 @@ SDValue X86TargetLowering::LowerCALL(SDValue Op, SelectionDAG &DAG) {
|
|||||||
if (G && !G->getGlobal()->hasHiddenVisibility() &&
|
if (G && !G->getGlobal()->hasHiddenVisibility() &&
|
||||||
!G->getGlobal()->hasProtectedVisibility())
|
!G->getGlobal()->hasProtectedVisibility())
|
||||||
Callee = LowerGlobalAddress(Callee, DAG);
|
Callee = LowerGlobalAddress(Callee, DAG);
|
||||||
else if (isa<ExternalSymbolSDNode>(Callee))
|
else if (isa<SymbolSDNode>(Callee))
|
||||||
Callee = LowerExternalSymbol(Callee,DAG);
|
Callee = LowerExternalSymbol(Callee, DAG);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Is64Bit && isVarArg) {
|
if (Is64Bit && isVarArg) {
|
||||||
@ -1697,8 +1697,9 @@ SDValue X86TargetLowering::LowerCALL(SDValue Op, SelectionDAG &DAG) {
|
|||||||
if (!Subtarget->GVRequiresExtraLoad(G->getGlobal(),
|
if (!Subtarget->GVRequiresExtraLoad(G->getGlobal(),
|
||||||
getTargetMachine(), true))
|
getTargetMachine(), true))
|
||||||
Callee = DAG.getTargetGlobalAddress(G->getGlobal(), getPointerTy());
|
Callee = DAG.getTargetGlobalAddress(G->getGlobal(), getPointerTy());
|
||||||
} else if (ExternalSymbolSDNode *S = dyn_cast<ExternalSymbolSDNode>(Callee)) {
|
} else if (SymbolSDNode *S = dyn_cast<SymbolSDNode>(Callee)) {
|
||||||
Callee = DAG.getTargetExternalSymbol(S->getSymbol(), getPointerTy());
|
Callee = DAG.getTargetSymbol(S->getSymbol(), getPointerTy(),
|
||||||
|
S->getLinkage());
|
||||||
} else if (IsTailCall) {
|
} else if (IsTailCall) {
|
||||||
unsigned Opc = Is64Bit ? X86::R9 : X86::ECX;
|
unsigned Opc = Is64Bit ? X86::R9 : X86::ECX;
|
||||||
|
|
||||||
@ -4286,12 +4287,11 @@ X86TargetLowering::LowerSCALAR_TO_VECTOR(SDValue Op, SelectionDAG &DAG) {
|
|||||||
DAG.getNode(ISD::SCALAR_TO_VECTOR, VT, AnyExt));
|
DAG.getNode(ISD::SCALAR_TO_VECTOR, VT, AnyExt));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ConstantPool, JumpTable, GlobalAddress, and ExternalSymbol are lowered as
|
// ConstantPool, JumpTable, GlobalAddress, and Symbol are lowered as their
|
||||||
// their target countpart wrapped in the X86ISD::Wrapper node. Suppose N is
|
// target countpart wrapped in the X86ISD::Wrapper node. Suppose N is one of the
|
||||||
// one of the above mentioned nodes. It has to be wrapped because otherwise
|
// above mentioned nodes. It has to be wrapped because otherwise Select(N)
|
||||||
// Select(N) returns N. So the raw TargetGlobalAddress nodes, etc. can only
|
// returns N. So the raw TargetGlobalAddress nodes, etc. can only be used to
|
||||||
// be used to form addressing mode. These wrapped nodes will be selected
|
// form addressing mode. These wrapped nodes will be selected into MOV32ri.
|
||||||
// into MOV32ri.
|
|
||||||
SDValue
|
SDValue
|
||||||
X86TargetLowering::LowerConstantPool(SDValue Op, SelectionDAG &DAG) {
|
X86TargetLowering::LowerConstantPool(SDValue Op, SelectionDAG &DAG) {
|
||||||
ConstantPoolSDNode *CP = cast<ConstantPoolSDNode>(Op);
|
ConstantPoolSDNode *CP = cast<ConstantPoolSDNode>(Op);
|
||||||
@ -4362,8 +4362,7 @@ LowerToTLSGeneralDynamicModel32(GlobalAddressSDNode *GA, SelectionDAG &DAG,
|
|||||||
|
|
||||||
NodeTys = DAG.getVTList(MVT::Other, MVT::Flag);
|
NodeTys = DAG.getVTList(MVT::Other, MVT::Flag);
|
||||||
SDValue Ops1[] = { Chain,
|
SDValue Ops1[] = { Chain,
|
||||||
DAG.getTargetExternalSymbol("___tls_get_addr",
|
DAG.getTargetSymbol("___tls_get_addr", PtrVT),
|
||||||
PtrVT),
|
|
||||||
DAG.getRegister(X86::EAX, PtrVT),
|
DAG.getRegister(X86::EAX, PtrVT),
|
||||||
DAG.getRegister(X86::EBX, PtrVT),
|
DAG.getRegister(X86::EBX, PtrVT),
|
||||||
InFlag };
|
InFlag };
|
||||||
@ -4396,8 +4395,7 @@ LowerToTLSGeneralDynamicModel64(GlobalAddressSDNode *GA, SelectionDAG &DAG,
|
|||||||
|
|
||||||
NodeTys = DAG.getVTList(MVT::Other, MVT::Flag);
|
NodeTys = DAG.getVTList(MVT::Other, MVT::Flag);
|
||||||
SDValue Ops1[] = { Chain,
|
SDValue Ops1[] = { Chain,
|
||||||
DAG.getTargetExternalSymbol("__tls_get_addr",
|
DAG.getTargetSymbol("__tls_get_addr", PtrVT),
|
||||||
PtrVT),
|
|
||||||
DAG.getRegister(X86::RDI, PtrVT),
|
DAG.getRegister(X86::RDI, PtrVT),
|
||||||
InFlag };
|
InFlag };
|
||||||
Chain = DAG.getNode(X86ISD::CALL, NodeTys, Ops1, 4);
|
Chain = DAG.getNode(X86ISD::CALL, NodeTys, Ops1, 4);
|
||||||
@ -4449,8 +4447,9 @@ X86TargetLowering::LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) {
|
|||||||
|
|
||||||
SDValue
|
SDValue
|
||||||
X86TargetLowering::LowerExternalSymbol(SDValue Op, SelectionDAG &DAG) {
|
X86TargetLowering::LowerExternalSymbol(SDValue Op, SelectionDAG &DAG) {
|
||||||
const char *Sym = cast<ExternalSymbolSDNode>(Op)->getSymbol();
|
SymbolSDNode *Sym = cast<SymbolSDNode>(Op);
|
||||||
SDValue Result = DAG.getTargetExternalSymbol(Sym, getPointerTy());
|
SDValue Result = DAG.getTargetSymbol(Sym->getSymbol(), getPointerTy(),
|
||||||
|
Sym->getLinkage());
|
||||||
Result = DAG.getNode(X86ISD::Wrapper, getPointerTy(), Result);
|
Result = DAG.getNode(X86ISD::Wrapper, getPointerTy(), Result);
|
||||||
// With PIC, the address is actually $g + Offset.
|
// With PIC, the address is actually $g + Offset.
|
||||||
if (getTargetMachine().getRelocationModel() == Reloc::PIC_ &&
|
if (getTargetMachine().getRelocationModel() == Reloc::PIC_ &&
|
||||||
@ -5054,7 +5053,7 @@ X86TargetLowering::LowerDYNAMIC_STACKALLOC(SDValue Op,
|
|||||||
|
|
||||||
SDVTList NodeTys = DAG.getVTList(MVT::Other, MVT::Flag);
|
SDVTList NodeTys = DAG.getVTList(MVT::Other, MVT::Flag);
|
||||||
SDValue Ops[] = { Chain,
|
SDValue Ops[] = { Chain,
|
||||||
DAG.getTargetExternalSymbol("_alloca", IntPtr),
|
DAG.getTargetSymbol("_alloca", IntPtr),
|
||||||
DAG.getRegister(X86::EAX, IntPtr),
|
DAG.getRegister(X86::EAX, IntPtr),
|
||||||
DAG.getRegister(X86StackPtr, SPTy),
|
DAG.getRegister(X86StackPtr, SPTy),
|
||||||
Flag };
|
Flag };
|
||||||
@ -5104,7 +5103,7 @@ X86TargetLowering::EmitTargetCodeForMemset(SelectionDAG &DAG,
|
|||||||
Args.push_back(Entry);
|
Args.push_back(Entry);
|
||||||
std::pair<SDValue,SDValue> CallResult =
|
std::pair<SDValue,SDValue> CallResult =
|
||||||
LowerCallTo(Chain, Type::VoidTy, false, false, false, CallingConv::C,
|
LowerCallTo(Chain, Type::VoidTy, false, false, false, CallingConv::C,
|
||||||
false, DAG.getExternalSymbol(bzeroEntry, IntPtr),
|
false, DAG.getSymbol(bzeroEntry, IntPtr),
|
||||||
Args, DAG);
|
Args, DAG);
|
||||||
return CallResult.second;
|
return CallResult.second;
|
||||||
}
|
}
|
||||||
@ -5977,7 +5976,7 @@ SDValue X86TargetLowering::LowerOperation(SDValue Op, SelectionDAG &DAG) {
|
|||||||
case ISD::ConstantPool: return LowerConstantPool(Op, DAG);
|
case ISD::ConstantPool: return LowerConstantPool(Op, DAG);
|
||||||
case ISD::GlobalAddress: return LowerGlobalAddress(Op, DAG);
|
case ISD::GlobalAddress: return LowerGlobalAddress(Op, DAG);
|
||||||
case ISD::GlobalTLSAddress: return LowerGlobalTLSAddress(Op, DAG);
|
case ISD::GlobalTLSAddress: return LowerGlobalTLSAddress(Op, DAG);
|
||||||
case ISD::ExternalSymbol: return LowerExternalSymbol(Op, DAG);
|
case ISD::Symbol: return LowerExternalSymbol(Op, DAG);
|
||||||
case ISD::SHL_PARTS:
|
case ISD::SHL_PARTS:
|
||||||
case ISD::SRA_PARTS:
|
case ISD::SRA_PARTS:
|
||||||
case ISD::SRL_PARTS: return LowerShift(Op, DAG);
|
case ISD::SRL_PARTS: return LowerShift(Op, DAG);
|
||||||
|
@ -145,8 +145,8 @@ namespace llvm {
|
|||||||
/// at function entry, used for PIC code.
|
/// at function entry, used for PIC code.
|
||||||
GlobalBaseReg,
|
GlobalBaseReg,
|
||||||
|
|
||||||
/// Wrapper - A wrapper node for TargetConstantPool,
|
/// Wrapper - A wrapper node for TargetConstantPool, TargetSymbol, and
|
||||||
/// TargetExternalSymbol, and TargetGlobalAddress.
|
/// TargetGlobalAddress.
|
||||||
Wrapper,
|
Wrapper,
|
||||||
|
|
||||||
/// WrapperRIP - Special wrapper used under X86-64 PIC mode for RIP
|
/// WrapperRIP - Special wrapper used under X86-64 PIC mode for RIP
|
||||||
|
@ -1192,7 +1192,7 @@ def ATOMUMAX64: I<0, Pseudo, (outs GR64:$dst),(ins i64mem:$ptr, GR64:$val),
|
|||||||
// Non-Instruction Patterns
|
// Non-Instruction Patterns
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
// ConstantPool GlobalAddress, ExternalSymbol, and JumpTable
|
// ConstantPool GlobalAddress, Symbol, and JumpTable
|
||||||
def : Pat<(i64 (X86Wrapper tconstpool :$dst)),
|
def : Pat<(i64 (X86Wrapper tconstpool :$dst)),
|
||||||
(MOV64ri tconstpool :$dst)>, Requires<[NotSmallCode]>;
|
(MOV64ri tconstpool :$dst)>, Requires<[NotSmallCode]>;
|
||||||
def : Pat<(i64 (X86Wrapper tjumptable :$dst)),
|
def : Pat<(i64 (X86Wrapper tjumptable :$dst)),
|
||||||
|
@ -2703,7 +2703,7 @@ def ATOMNAND8 : I<0, Pseudo,(outs GR8:$dst),(ins i8mem:$ptr, GR8:$val),
|
|||||||
// Non-Instruction Patterns
|
// Non-Instruction Patterns
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
// ConstantPool GlobalAddress, ExternalSymbol, and JumpTable
|
// ConstantPool GlobalAddress, Symbol, and JumpTable
|
||||||
def : Pat<(i32 (X86Wrapper tconstpool :$dst)), (MOV32ri tconstpool :$dst)>;
|
def : Pat<(i32 (X86Wrapper tconstpool :$dst)), (MOV32ri tconstpool :$dst)>;
|
||||||
def : Pat<(i32 (X86Wrapper tjumptable :$dst)), (MOV32ri tjumptable :$dst)>;
|
def : Pat<(i32 (X86Wrapper tjumptable :$dst)), (MOV32ri tjumptable :$dst)>;
|
||||||
def : Pat<(i32 (X86Wrapper tglobaltlsaddr:$dst)),(MOV32ri tglobaltlsaddr:$dst)>;
|
def : Pat<(i32 (X86Wrapper tglobaltlsaddr:$dst)),(MOV32ri tglobaltlsaddr:$dst)>;
|
||||||
|
@ -802,11 +802,11 @@ public:
|
|||||||
NodeOps.push_back(Val);
|
NodeOps.push_back(Val);
|
||||||
} else if (!N->isLeaf() && N->getOperator()->getName() == "texternalsym"){
|
} else if (!N->isLeaf() && N->getOperator()->getName() == "texternalsym"){
|
||||||
Record *Op = OperatorMap[N->getName()];
|
Record *Op = OperatorMap[N->getName()];
|
||||||
// Transform ExternalSymbol to TargetExternalSymbol
|
// Transform Symbol to TargetSymbol
|
||||||
if (Op && Op->getName() == "externalsym") {
|
if (Op && Op->getName() == "externalsym") {
|
||||||
std::string TmpVar = "Tmp"+utostr(ResNo);
|
std::string TmpVar = "Tmp"+utostr(ResNo);
|
||||||
emitCode("SDValue " + TmpVar + " = CurDAG->getTarget"
|
emitCode("SDValue " + TmpVar + " = CurDAG->getTarget"
|
||||||
"ExternalSymbol(cast<ExternalSymbolSDNode>(" +
|
"Symbol(cast<SymbolSDNode>(" +
|
||||||
Val + ")->getSymbol(), " +
|
Val + ")->getSymbol(), " +
|
||||||
getEnumName(N->getTypeNum(0)) + ");");
|
getEnumName(N->getTypeNum(0)) + ");");
|
||||||
// Add Tmp<ResNo> to VariableMap, so that we don't multiply select
|
// Add Tmp<ResNo> to VariableMap, so that we don't multiply select
|
||||||
@ -1949,7 +1949,7 @@ void DAGISelEmitter::EmitInstructionSelector(std::ostream &OS) {
|
|||||||
<< " case ISD::TargetConstantFP:\n"
|
<< " case ISD::TargetConstantFP:\n"
|
||||||
<< " case ISD::TargetConstantPool:\n"
|
<< " case ISD::TargetConstantPool:\n"
|
||||||
<< " case ISD::TargetFrameIndex:\n"
|
<< " case ISD::TargetFrameIndex:\n"
|
||||||
<< " case ISD::TargetExternalSymbol:\n"
|
<< " case ISD::TargetSymbol:\n"
|
||||||
<< " case ISD::TargetJumpTable:\n"
|
<< " case ISD::TargetJumpTable:\n"
|
||||||
<< " case ISD::TargetGlobalTLSAddress:\n"
|
<< " case ISD::TargetGlobalTLSAddress:\n"
|
||||||
<< " case ISD::TargetGlobalAddress: {\n"
|
<< " case ISD::TargetGlobalAddress: {\n"
|
||||||
|
Loading…
Reference in New Issue
Block a user