mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-03-24 07:35:04 +00:00
Avoid a Symbol -> Name -> Symbol conversion.
Before this we were producing a TargetExternalSymbol from a MCSymbol. That meant extracting the symbol name and fetching the symbol again down the pipeline. This patch adds a DAG.getMCSymbol that lets the MCSymbol pass unchanged on the DAG. Doing so removes the need for MO_NOPREFIX and fixes the root cause of pr23900, allowing r240130 to be committed again. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240300 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2f801faafb
commit
09bbd16112
@ -124,6 +124,8 @@ namespace ISD {
|
||||
TargetExternalSymbol,
|
||||
TargetBlockAddress,
|
||||
|
||||
MCSymbol,
|
||||
|
||||
/// TargetIndex - Like a constant pool entry, but with completely
|
||||
/// target-dependent semantics. Holds target flags, a 32-bit index, and a
|
||||
/// 64-bit index. Targets can use this however they like.
|
||||
|
@ -450,11 +450,12 @@ public:
|
||||
return Contents.CFIIndex;
|
||||
}
|
||||
|
||||
/// getOffset - Return the offset from the symbol in this operand. This always
|
||||
/// returns 0 for ExternalSymbol operands.
|
||||
/// Return the offset from the symbol in this operand. This always returns 0
|
||||
/// for ExternalSymbol operands.
|
||||
int64_t getOffset() const {
|
||||
assert((isGlobal() || isSymbol() || isCPI() || isTargetIndex() ||
|
||||
isBlockAddress()) && "Wrong MachineOperand accessor");
|
||||
assert((isGlobal() || isSymbol() || isMCSymbol() || isCPI() ||
|
||||
isTargetIndex() || isBlockAddress()) &&
|
||||
"Wrong MachineOperand accessor");
|
||||
return int64_t(uint64_t(Contents.OffsetedInfo.OffsetHi) << 32) |
|
||||
SmallContents.OffsetLo;
|
||||
}
|
||||
@ -512,8 +513,9 @@ public:
|
||||
}
|
||||
|
||||
void setOffset(int64_t Offset) {
|
||||
assert((isGlobal() || isSymbol() || isCPI() || isTargetIndex() ||
|
||||
isBlockAddress()) && "Wrong MachineOperand accessor");
|
||||
assert((isGlobal() || isSymbol() || isMCSymbol() || isCPI() ||
|
||||
isTargetIndex() || isBlockAddress()) &&
|
||||
"Wrong MachineOperand accessor");
|
||||
SmallContents.OffsetLo = unsigned(Offset);
|
||||
Contents.OffsetedInfo.OffsetHi = int(Offset >> 32);
|
||||
}
|
||||
@ -706,6 +708,7 @@ public:
|
||||
static MachineOperand CreateMCSymbol(MCSymbol *Sym) {
|
||||
MachineOperand Op(MachineOperand::MO_MCSymbol);
|
||||
Op.Contents.Sym = Sym;
|
||||
Op.setOffset(0);
|
||||
return Op;
|
||||
}
|
||||
|
||||
|
@ -495,6 +495,8 @@ public:
|
||||
SDValue getExternalSymbol(const char *Sym, SDLoc dl, EVT VT);
|
||||
SDValue getTargetExternalSymbol(const char *Sym, EVT VT,
|
||||
unsigned char TargetFlags = 0);
|
||||
SDValue getMCSymbol(MCSymbol *Sym, EVT VT);
|
||||
|
||||
SDValue getValueType(EVT);
|
||||
SDValue getRegister(unsigned Reg, EVT VT);
|
||||
SDValue getRegisterMask(const uint32_t *RegMask);
|
||||
@ -1278,6 +1280,7 @@ private:
|
||||
StringMap<SDNode*> ExternalSymbols;
|
||||
|
||||
std::map<std::pair<std::string, unsigned char>,SDNode*> TargetExternalSymbols;
|
||||
DenseMap<MCSymbol *, SDNode *> MCSymbols;
|
||||
};
|
||||
|
||||
template <> struct GraphTraits<SelectionDAG*> : public GraphTraits<SDNode*> {
|
||||
|
@ -1810,6 +1810,21 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class MCSymbolSDNode : public SDNode {
|
||||
MCSymbol *Symbol;
|
||||
|
||||
friend class SelectionDAG;
|
||||
MCSymbolSDNode(MCSymbol *Symbol, EVT VT)
|
||||
: SDNode(ISD::MCSymbol, 0, DebugLoc(), getSDVTList(VT)), Symbol(Symbol) {}
|
||||
|
||||
public:
|
||||
MCSymbol *getMCSymbol() const { return Symbol; }
|
||||
|
||||
static bool classof(const SDNode *N) {
|
||||
return N->getOpcode() == ISD::MCSymbol;
|
||||
}
|
||||
};
|
||||
|
||||
class CondCodeSDNode : public SDNode {
|
||||
ISD::CondCode Condition;
|
||||
friend class SelectionDAG;
|
||||
|
@ -341,6 +341,7 @@ def externalsym : SDNode<"ISD::ExternalSymbol", SDTPtrLeaf, [],
|
||||
"ExternalSymbolSDNode">;
|
||||
def texternalsym: SDNode<"ISD::TargetExternalSymbol", SDTPtrLeaf, [],
|
||||
"ExternalSymbolSDNode">;
|
||||
def mcsym: SDNode<"ISD::MCSymbol", SDTPtrLeaf, [], "MCSymbolSDNode">;
|
||||
def blockaddress : SDNode<"ISD::BlockAddress", SDTPtrLeaf, [],
|
||||
"BlockAddressSDNode">;
|
||||
def tblockaddress: SDNode<"ISD::TargetBlockAddress", SDTPtrLeaf, [],
|
||||
|
@ -422,6 +422,8 @@ void InstrEmitter::AddOperand(MachineInstrBuilder &MIB,
|
||||
MIB.addConstantPoolIndex(Idx, Offset, CP->getTargetFlags());
|
||||
} else if (ExternalSymbolSDNode *ES = dyn_cast<ExternalSymbolSDNode>(Op)) {
|
||||
MIB.addExternalSymbol(ES->getSymbol(), ES->getTargetFlags());
|
||||
} else if (auto *SymNode = dyn_cast<MCSymbolSDNode>(Op)) {
|
||||
MIB.addSym(SymNode->getMCSymbol());
|
||||
} else if (BlockAddressSDNode *BA = dyn_cast<BlockAddressSDNode>(Op)) {
|
||||
MIB.addBlockAddress(BA->getBlockAddress(),
|
||||
BA->getOffset(),
|
||||
|
@ -64,6 +64,7 @@ namespace llvm {
|
||||
if (isa<TargetIndexSDNode>(Node)) return true;
|
||||
if (isa<JumpTableSDNode>(Node)) return true;
|
||||
if (isa<ExternalSymbolSDNode>(Node)) return true;
|
||||
if (isa<MCSymbolSDNode>(Node)) return true;
|
||||
if (isa<BlockAddressSDNode>(Node)) return true;
|
||||
if (Node->getOpcode() == ISD::EntryToken ||
|
||||
isa<MDNodeSDNode>(Node)) return true;
|
||||
|
@ -427,12 +427,12 @@ static void AddNodeIDNode(FoldingSetNodeID &ID, unsigned short OpC,
|
||||
AddNodeIDOperands(ID, OpList);
|
||||
}
|
||||
|
||||
/// AddNodeIDCustom - If this is an SDNode with special info, add this info to
|
||||
/// the NodeID data.
|
||||
/// If this is an SDNode with special info, add this info to the NodeID data.
|
||||
static void AddNodeIDCustom(FoldingSetNodeID &ID, const SDNode *N) {
|
||||
switch (N->getOpcode()) {
|
||||
case ISD::TargetExternalSymbol:
|
||||
case ISD::ExternalSymbol:
|
||||
case ISD::MCSymbol:
|
||||
llvm_unreachable("Should only be used on nodes with operands");
|
||||
default: break; // Normal nodes don't need extra info.
|
||||
case ISD::TargetConstant:
|
||||
@ -797,6 +797,11 @@ bool SelectionDAG::RemoveNodeFromCSEMaps(SDNode *N) {
|
||||
ESN->getTargetFlags()));
|
||||
break;
|
||||
}
|
||||
case ISD::MCSymbol: {
|
||||
auto *MCSN = cast<MCSymbolSDNode>(N);
|
||||
Erased = MCSymbols.erase(MCSN->getMCSymbol());
|
||||
break;
|
||||
}
|
||||
case ISD::VALUETYPE: {
|
||||
EVT VT = cast<VTSDNode>(N)->getVT();
|
||||
if (VT.isExtended()) {
|
||||
@ -1014,6 +1019,7 @@ void SelectionDAG::clear() {
|
||||
ExtendedValueTypeNodes.clear();
|
||||
ExternalSymbols.clear();
|
||||
TargetExternalSymbols.clear();
|
||||
MCSymbols.clear();
|
||||
std::fill(CondCodeNodes.begin(), CondCodeNodes.end(),
|
||||
static_cast<CondCodeSDNode*>(nullptr));
|
||||
std::fill(ValueTypeNodes.begin(), ValueTypeNodes.end(),
|
||||
@ -1469,6 +1475,15 @@ SDValue SelectionDAG::getExternalSymbol(const char *Sym, EVT VT) {
|
||||
return SDValue(N, 0);
|
||||
}
|
||||
|
||||
SDValue SelectionDAG::getMCSymbol(MCSymbol *Sym, EVT VT) {
|
||||
SDNode *&N = MCSymbols[Sym];
|
||||
if (N)
|
||||
return SDValue(N, 0);
|
||||
N = new (NodeAllocator) MCSymbolSDNode(Sym, VT);
|
||||
InsertNode(N);
|
||||
return SDValue(N, 0);
|
||||
}
|
||||
|
||||
SDValue SelectionDAG::getTargetExternalSymbol(const char *Sym, EVT VT,
|
||||
unsigned char TargetFlags) {
|
||||
SDNode *&N =
|
||||
|
@ -4976,11 +4976,9 @@ SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, unsigned Intrinsic) {
|
||||
MF.getMMI().getContext().getOrCreateFrameAllocSymbol(
|
||||
GlobalValue::getRealLinkageName(Fn->getName()), IdxVal);
|
||||
|
||||
// Create a TargetExternalSymbol for the label to avoid any target lowering
|
||||
// Create a MCSymbol for the label to avoid any target lowering
|
||||
// that would make this PC relative.
|
||||
StringRef Name = FrameAllocSym->getName();
|
||||
assert(Name.data()[Name.size()] == '\0' && "not null terminated");
|
||||
SDValue OffsetSym = DAG.getTargetExternalSymbol(Name.data(), PtrVT);
|
||||
SDValue OffsetSym = DAG.getMCSymbol(FrameAllocSym, PtrVT);
|
||||
SDValue OffsetVal =
|
||||
DAG.getNode(ISD::FRAME_ALLOC_RECOVER, sdl, PtrVT, OffsetSym);
|
||||
|
||||
|
@ -130,6 +130,7 @@ std::string SDNode::getOperationName(const SelectionDAG *G) const {
|
||||
case ISD::TargetJumpTable: return "TargetJumpTable";
|
||||
case ISD::TargetConstantPool: return "TargetConstantPool";
|
||||
case ISD::TargetExternalSymbol: return "TargetExternalSymbol";
|
||||
case ISD::MCSymbol: return "MCSymbol";
|
||||
case ISD::TargetBlockAddress: return "TargetBlockAddress";
|
||||
|
||||
case ISD::CopyToReg: return "CopyToReg";
|
||||
|
@ -2562,6 +2562,7 @@ SelectCodeCommon(SDNode *NodeToMatch, const unsigned char *MatcherTable,
|
||||
case ISD::TargetConstantPool:
|
||||
case ISD::TargetFrameIndex:
|
||||
case ISD::TargetExternalSymbol:
|
||||
case ISD::MCSymbol:
|
||||
case ISD::TargetBlockAddress:
|
||||
case ISD::TargetJumpTable:
|
||||
case ISD::TargetGlobalTLSAddress:
|
||||
|
@ -213,11 +213,7 @@ namespace X86II {
|
||||
/// the offset from beginning of section.
|
||||
///
|
||||
/// This is the TLS offset for the COFF/Windows TLS mechanism.
|
||||
MO_SECREL,
|
||||
|
||||
/// MO_NOPREFIX - On a symbol operand this indicates that the symbol should
|
||||
/// not be mangled with a prefix.
|
||||
MO_NOPREFIX,
|
||||
MO_SECREL
|
||||
};
|
||||
|
||||
enum : uint64_t {
|
||||
|
@ -67,19 +67,19 @@ namespace {
|
||||
const Constant *CP;
|
||||
const BlockAddress *BlockAddr;
|
||||
const char *ES;
|
||||
MCSymbol *MCSym;
|
||||
int JT;
|
||||
unsigned Align; // CP alignment.
|
||||
unsigned char SymbolFlags; // X86II::MO_*
|
||||
|
||||
X86ISelAddressMode()
|
||||
: BaseType(RegBase), Base_FrameIndex(0), Scale(1), IndexReg(), Disp(0),
|
||||
Segment(), GV(nullptr), CP(nullptr), BlockAddr(nullptr), ES(nullptr),
|
||||
JT(-1), Align(0), SymbolFlags(X86II::MO_NO_FLAG) {
|
||||
}
|
||||
: BaseType(RegBase), Base_FrameIndex(0), Scale(1), IndexReg(), Disp(0),
|
||||
Segment(), GV(nullptr), CP(nullptr), BlockAddr(nullptr), ES(nullptr),
|
||||
MCSym(nullptr), JT(-1), Align(0), SymbolFlags(X86II::MO_NO_FLAG) {}
|
||||
|
||||
bool hasSymbolicDisplacement() const {
|
||||
return GV != nullptr || CP != nullptr || ES != nullptr ||
|
||||
JT != -1 || BlockAddr != nullptr;
|
||||
MCSym != nullptr || JT != -1 || BlockAddr != nullptr;
|
||||
}
|
||||
|
||||
bool hasBaseOrIndexReg() const {
|
||||
@ -134,6 +134,11 @@ namespace {
|
||||
dbgs() << ES;
|
||||
else
|
||||
dbgs() << "nul";
|
||||
dbgs() << " MCSym ";
|
||||
if (MCSym)
|
||||
dbgs() << MCSym;
|
||||
else
|
||||
dbgs() << "nul";
|
||||
dbgs() << " JT" << JT << " Align" << Align << '\n';
|
||||
}
|
||||
#endif
|
||||
@ -258,6 +263,10 @@ namespace {
|
||||
else if (AM.ES) {
|
||||
assert(!AM.Disp && "Non-zero displacement is ignored with ES.");
|
||||
Disp = CurDAG->getTargetExternalSymbol(AM.ES, MVT::i32, AM.SymbolFlags);
|
||||
} else if (AM.MCSym) {
|
||||
assert(!AM.Disp && "Non-zero displacement is ignored with MCSym.");
|
||||
assert(AM.SymbolFlags == 0 && "oo");
|
||||
Disp = CurDAG->getMCSymbol(AM.MCSym, MVT::i32);
|
||||
} else if (AM.JT != -1) {
|
||||
assert(!AM.Disp && "Non-zero displacement is ignored with JT.");
|
||||
Disp = CurDAG->getTargetJumpTable(AM.JT, MVT::i32, AM.SymbolFlags);
|
||||
@ -604,7 +613,7 @@ static bool isDispSafeForFrameIndex(int64_t Val) {
|
||||
bool X86DAGToDAGISel::FoldOffsetIntoAddress(uint64_t Offset,
|
||||
X86ISelAddressMode &AM) {
|
||||
// Cannot combine ExternalSymbol displacements with integer offsets.
|
||||
if (Offset != 0 && AM.ES)
|
||||
if (Offset != 0 && (AM.ES || AM.MCSym))
|
||||
return true;
|
||||
int64_t Val = AM.Disp + Offset;
|
||||
CodeModel::Model M = TM.getCodeModel();
|
||||
@ -690,6 +699,8 @@ bool X86DAGToDAGISel::MatchWrapper(SDValue N, X86ISelAddressMode &AM) {
|
||||
} else if (ExternalSymbolSDNode *S = dyn_cast<ExternalSymbolSDNode>(N0)) {
|
||||
AM.ES = S->getSymbol();
|
||||
AM.SymbolFlags = S->getTargetFlags();
|
||||
} else if (auto *S = dyn_cast<MCSymbolSDNode>(N0)) {
|
||||
AM.MCSym = S->getMCSymbol();
|
||||
} else if (JumpTableSDNode *J = dyn_cast<JumpTableSDNode>(N0)) {
|
||||
AM.JT = J->getIndex();
|
||||
AM.SymbolFlags = J->getTargetFlags();
|
||||
@ -728,6 +739,8 @@ bool X86DAGToDAGISel::MatchWrapper(SDValue N, X86ISelAddressMode &AM) {
|
||||
} else if (ExternalSymbolSDNode *S = dyn_cast<ExternalSymbolSDNode>(N0)) {
|
||||
AM.ES = S->getSymbol();
|
||||
AM.SymbolFlags = S->getTargetFlags();
|
||||
} else if (auto *S = dyn_cast<MCSymbolSDNode>(N0)) {
|
||||
AM.MCSym = S->getMCSymbol();
|
||||
} else if (JumpTableSDNode *J = dyn_cast<JumpTableSDNode>(N0)) {
|
||||
AM.JT = J->getIndex();
|
||||
AM.SymbolFlags = J->getTargetFlags();
|
||||
@ -1001,7 +1014,8 @@ bool X86DAGToDAGISel::MatchAddressRecursively(SDValue N, X86ISelAddressMode &AM,
|
||||
// FIXME: JumpTable and ExternalSymbol address currently don't like
|
||||
// displacements. It isn't very important, but this should be fixed for
|
||||
// consistency.
|
||||
if (!AM.ES && AM.JT != -1) return true;
|
||||
if (!(AM.ES || AM.MCSym) && AM.JT != -1)
|
||||
return true;
|
||||
|
||||
if (ConstantSDNode *Cst = dyn_cast<ConstantSDNode>(N))
|
||||
if (!FoldOffsetIntoAddress(Cst->getSExtValue(), AM))
|
||||
@ -1013,13 +1027,11 @@ bool X86DAGToDAGISel::MatchAddressRecursively(SDValue N, X86ISelAddressMode &AM,
|
||||
default: break;
|
||||
case ISD::FRAME_ALLOC_RECOVER: {
|
||||
if (!AM.hasSymbolicDisplacement() && AM.Disp == 0)
|
||||
if (const auto *ESNode = dyn_cast<ExternalSymbolSDNode>(N.getOperand(0)))
|
||||
if (ESNode->getOpcode() == ISD::TargetExternalSymbol) {
|
||||
// Use the symbol and don't prefix it.
|
||||
AM.ES = ESNode->getSymbol();
|
||||
AM.SymbolFlags = X86II::MO_NOPREFIX;
|
||||
return false;
|
||||
}
|
||||
if (const auto *ESNode = dyn_cast<MCSymbolSDNode>(N.getOperand(0))) {
|
||||
// Use the symbol and don't prefix it.
|
||||
AM.MCSym = ESNode->getMCSymbol();
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ISD::Constant: {
|
||||
@ -1473,6 +1485,7 @@ bool X86DAGToDAGISel::SelectMOV64Imm32(SDValue N, SDValue &Imm) {
|
||||
N->getOpcode() != ISD::TargetJumpTable &&
|
||||
N->getOpcode() != ISD::TargetGlobalAddress &&
|
||||
N->getOpcode() != ISD::TargetExternalSymbol &&
|
||||
N->getOpcode() != ISD::MCSymbol &&
|
||||
N->getOpcode() != ISD::TargetBlockAddress)
|
||||
return false;
|
||||
|
||||
|
@ -15409,13 +15409,10 @@ static SDValue LowerINTRINSIC_WO_CHAIN(SDValue Op, const X86Subtarget *Subtarget
|
||||
auto *Fn = cast<Function>(cast<GlobalAddressSDNode>(Op1)->getGlobal());
|
||||
MCSymbol *LSDASym = MF.getMMI().getContext().getOrCreateLSDASymbol(
|
||||
GlobalValue::getRealLinkageName(Fn->getName()));
|
||||
StringRef Name = LSDASym->getName();
|
||||
assert(Name.data()[Name.size()] == '\0' && "not null terminated");
|
||||
|
||||
// Generate a simple absolute symbol reference. This intrinsic is only
|
||||
// supported on 32-bit Windows, which isn't PIC.
|
||||
SDValue Result =
|
||||
DAG.getTargetExternalSymbol(Name.data(), VT, X86II::MO_NOPREFIX);
|
||||
SDValue Result = DAG.getMCSymbol(LSDASym, VT);
|
||||
return DAG.getNode(X86ISD::Wrapper, dl, VT, Result);
|
||||
}
|
||||
}
|
||||
@ -15615,13 +15612,11 @@ static SDValue LowerEXCEPTIONINFO(SDValue Op, const X86Subtarget *Subtarget,
|
||||
MCSymbol *ParentFrameSym =
|
||||
MF.getMMI().getContext().getOrCreateParentFrameOffsetSymbol(
|
||||
GlobalValue::getRealLinkageName(Fn->getName()));
|
||||
StringRef Name = ParentFrameSym->getName();
|
||||
assert(Name.data()[Name.size()] == '\0' && "not null terminated");
|
||||
|
||||
// Create a TargetExternalSymbol for the label to avoid any target lowering
|
||||
// that would make this PC relative.
|
||||
MVT PtrVT = Op.getSimpleValueType();
|
||||
SDValue OffsetSym = DAG.getTargetExternalSymbol(Name.data(), PtrVT);
|
||||
SDValue OffsetSym = DAG.getMCSymbol(ParentFrameSym, PtrVT);
|
||||
SDValue OffsetVal =
|
||||
DAG.getNode(ISD::FRAME_ALLOC_RECOVER, dl, PtrVT, OffsetSym);
|
||||
|
||||
|
@ -869,6 +869,7 @@ def : Pat<(i32 (X86Wrapper tjumptable :$dst)), (MOV32ri tjumptable :$dst)>;
|
||||
def : Pat<(i32 (X86Wrapper tglobaltlsaddr:$dst)),(MOV32ri tglobaltlsaddr:$dst)>;
|
||||
def : Pat<(i32 (X86Wrapper tglobaladdr :$dst)), (MOV32ri tglobaladdr :$dst)>;
|
||||
def : Pat<(i32 (X86Wrapper texternalsym:$dst)), (MOV32ri texternalsym:$dst)>;
|
||||
def : Pat<(i32 (X86Wrapper mcsym:$dst)), (MOV32ri mcsym:$dst)>;
|
||||
def : Pat<(i32 (X86Wrapper tblockaddress:$dst)), (MOV32ri tblockaddress:$dst)>;
|
||||
|
||||
def : Pat<(add GR32:$src1, (X86Wrapper tconstpool:$src2)),
|
||||
@ -879,6 +880,8 @@ def : Pat<(add GR32:$src1, (X86Wrapper tglobaladdr :$src2)),
|
||||
(ADD32ri GR32:$src1, tglobaladdr:$src2)>;
|
||||
def : Pat<(add GR32:$src1, (X86Wrapper texternalsym:$src2)),
|
||||
(ADD32ri GR32:$src1, texternalsym:$src2)>;
|
||||
def : Pat<(add GR32:$src1, (X86Wrapper mcsym:$src2)),
|
||||
(ADD32ri GR32:$src1, mcsym:$src2)>;
|
||||
def : Pat<(add GR32:$src1, (X86Wrapper tblockaddress:$src2)),
|
||||
(ADD32ri GR32:$src1, tblockaddress:$src2)>;
|
||||
|
||||
@ -886,6 +889,8 @@ def : Pat<(store (i32 (X86Wrapper tglobaladdr:$src)), addr:$dst),
|
||||
(MOV32mi addr:$dst, tglobaladdr:$src)>;
|
||||
def : Pat<(store (i32 (X86Wrapper texternalsym:$src)), addr:$dst),
|
||||
(MOV32mi addr:$dst, texternalsym:$src)>;
|
||||
def : Pat<(store (i32 (X86Wrapper mcsym:$src)), addr:$dst),
|
||||
(MOV32mi addr:$dst, mcsym:$src)>;
|
||||
def : Pat<(store (i32 (X86Wrapper tblockaddress:$src)), addr:$dst),
|
||||
(MOV32mi addr:$dst, tblockaddress:$src)>;
|
||||
|
||||
@ -900,6 +905,8 @@ def : Pat<(i64 (X86Wrapper tglobaladdr :$dst)),
|
||||
(MOV64ri tglobaladdr :$dst)>, Requires<[FarData]>;
|
||||
def : Pat<(i64 (X86Wrapper texternalsym:$dst)),
|
||||
(MOV64ri texternalsym:$dst)>, Requires<[FarData]>;
|
||||
def : Pat<(i64 (X86Wrapper mcsym:$dst)),
|
||||
(MOV64ri mcsym:$dst)>, Requires<[FarData]>;
|
||||
def : Pat<(i64 (X86Wrapper tblockaddress:$dst)),
|
||||
(MOV64ri tblockaddress:$dst)>, Requires<[FarData]>;
|
||||
|
||||
@ -914,6 +921,8 @@ def : Pat<(i64 (X86Wrapper tglobaladdr :$dst)),
|
||||
(MOV64ri32 tglobaladdr :$dst)>, Requires<[KernelCode]>;
|
||||
def : Pat<(i64 (X86Wrapper texternalsym:$dst)),
|
||||
(MOV64ri32 texternalsym:$dst)>, Requires<[KernelCode]>;
|
||||
def : Pat<(i64 (X86Wrapper mcsym:$dst)),
|
||||
(MOV64ri32 mcsym:$dst)>, Requires<[KernelCode]>;
|
||||
def : Pat<(i64 (X86Wrapper tblockaddress:$dst)),
|
||||
(MOV64ri32 tblockaddress:$dst)>, Requires<[KernelCode]>;
|
||||
|
||||
@ -932,12 +941,15 @@ def : Pat<(store (i64 (X86Wrapper tglobaladdr:$src)), addr:$dst),
|
||||
def : Pat<(store (i64 (X86Wrapper texternalsym:$src)), addr:$dst),
|
||||
(MOV64mi32 addr:$dst, texternalsym:$src)>,
|
||||
Requires<[NearData, IsStatic]>;
|
||||
def : Pat<(store (i64 (X86Wrapper mcsym:$src)), addr:$dst),
|
||||
(MOV64mi32 addr:$dst, mcsym:$src)>,
|
||||
Requires<[NearData, IsStatic]>;
|
||||
def : Pat<(store (i64 (X86Wrapper tblockaddress:$src)), addr:$dst),
|
||||
(MOV64mi32 addr:$dst, tblockaddress:$src)>,
|
||||
Requires<[NearData, IsStatic]>;
|
||||
|
||||
def : Pat<(i32 (X86RecoverFrameAlloc texternalsym:$dst)), (MOV32ri texternalsym:$dst)>;
|
||||
def : Pat<(i64 (X86RecoverFrameAlloc texternalsym:$dst)), (MOV64ri texternalsym:$dst)>;
|
||||
def : Pat<(i32 (X86RecoverFrameAlloc mcsym:$dst)), (MOV32ri mcsym:$dst)>;
|
||||
def : Pat<(i64 (X86RecoverFrameAlloc mcsym:$dst)), (MOV64ri mcsym:$dst)>;
|
||||
|
||||
// Calls
|
||||
|
||||
|
@ -159,10 +159,7 @@ GetSymbolFromOperand(const MachineOperand &MO) const {
|
||||
const GlobalValue *GV = MO.getGlobal();
|
||||
AsmPrinter.getNameWithPrefix(Name, GV);
|
||||
} else if (MO.isSymbol()) {
|
||||
if (MO.getTargetFlags() == X86II::MO_NOPREFIX)
|
||||
Name += MO.getSymbolName();
|
||||
else
|
||||
getMang()->getNameWithPrefix(Name, MO.getSymbolName());
|
||||
getMang()->getNameWithPrefix(Name, MO.getSymbolName());
|
||||
} else if (MO.isMBB()) {
|
||||
assert(Suffix.empty());
|
||||
Sym = MO.getMBB()->getSymbol();
|
||||
@ -241,7 +238,6 @@ MCOperand X86MCInstLower::LowerSymbolOperand(const MachineOperand &MO,
|
||||
case X86II::MO_DARWIN_NONLAZY:
|
||||
case X86II::MO_DLLIMPORT:
|
||||
case X86II::MO_DARWIN_STUB:
|
||||
case X86II::MO_NOPREFIX:
|
||||
break;
|
||||
|
||||
case X86II::MO_TLVP: RefKind = MCSymbolRefExpr::VK_TLVP; break;
|
||||
@ -423,6 +419,8 @@ X86MCInstLower::LowerMachineOperand(const MachineInstr *MI,
|
||||
case MachineOperand::MO_GlobalAddress:
|
||||
case MachineOperand::MO_ExternalSymbol:
|
||||
return LowerSymbolOperand(MO, GetSymbolFromOperand(MO));
|
||||
case MachineOperand::MO_MCSymbol:
|
||||
return LowerSymbolOperand(MO, MO.getMCSymbol());
|
||||
case MachineOperand::MO_JumpTableIndex:
|
||||
return LowerSymbolOperand(MO, AsmPrinter.GetJTISymbol(MO.getIndex()));
|
||||
case MachineOperand::MO_ConstantPoolIndex:
|
||||
|
@ -2143,7 +2143,8 @@ TreePatternNode *TreePattern::ParseTreePattern(Init *TheInit, StringRef OpName){
|
||||
Operator->getName() != "tblockaddress" &&
|
||||
Operator->getName() != "tglobaladdr" &&
|
||||
Operator->getName() != "bb" &&
|
||||
Operator->getName() != "vt")
|
||||
Operator->getName() != "vt" &&
|
||||
Operator->getName() != "mcsym")
|
||||
error("Cannot use '" + Operator->getName() + "' in an output pattern!");
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user