mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-30 04:18:16 +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:
@@ -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, [],
|
||||
|
||||
Reference in New Issue
Block a user