forked from OSchip/llvm-project
SelectionDAG, MI, AArch64: Widen target flags fields/arguments from unsigned char to unsigned.
This makes the field wider than MachineOperand::SubReg_TargetFlags so that we don't end up silently truncating any higher bits. We should still catch any bits truncated from the MachineOperand field as a consequence of the assertion in MachineOperand::setTargetFlags(). Differential Revision: https://reviews.llvm.org/D65465 llvm-svn: 367474
This commit is contained in:
parent
0e86e7fda3
commit
33773d5cfc
|
@ -135,7 +135,7 @@ public:
|
|||
}
|
||||
|
||||
const MachineInstrBuilder &addMBB(MachineBasicBlock *MBB,
|
||||
unsigned char TargetFlags = 0) const {
|
||||
unsigned TargetFlags = 0) const {
|
||||
MI->addOperand(*MF, MachineOperand::CreateMBB(MBB, TargetFlags));
|
||||
return *this;
|
||||
}
|
||||
|
@ -145,42 +145,42 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
const MachineInstrBuilder &addConstantPoolIndex(unsigned Idx,
|
||||
int Offset = 0,
|
||||
unsigned char TargetFlags = 0) const {
|
||||
const MachineInstrBuilder &
|
||||
addConstantPoolIndex(unsigned Idx, int Offset = 0,
|
||||
unsigned TargetFlags = 0) const {
|
||||
MI->addOperand(*MF, MachineOperand::CreateCPI(Idx, Offset, TargetFlags));
|
||||
return *this;
|
||||
}
|
||||
|
||||
const MachineInstrBuilder &addTargetIndex(unsigned Idx, int64_t Offset = 0,
|
||||
unsigned char TargetFlags = 0) const {
|
||||
unsigned TargetFlags = 0) const {
|
||||
MI->addOperand(*MF, MachineOperand::CreateTargetIndex(Idx, Offset,
|
||||
TargetFlags));
|
||||
return *this;
|
||||
}
|
||||
|
||||
const MachineInstrBuilder &addJumpTableIndex(unsigned Idx,
|
||||
unsigned char TargetFlags = 0) const {
|
||||
unsigned TargetFlags = 0) const {
|
||||
MI->addOperand(*MF, MachineOperand::CreateJTI(Idx, TargetFlags));
|
||||
return *this;
|
||||
}
|
||||
|
||||
const MachineInstrBuilder &addGlobalAddress(const GlobalValue *GV,
|
||||
int64_t Offset = 0,
|
||||
unsigned char TargetFlags = 0) const {
|
||||
unsigned TargetFlags = 0) const {
|
||||
MI->addOperand(*MF, MachineOperand::CreateGA(GV, Offset, TargetFlags));
|
||||
return *this;
|
||||
}
|
||||
|
||||
const MachineInstrBuilder &addExternalSymbol(const char *FnName,
|
||||
unsigned char TargetFlags = 0) const {
|
||||
unsigned TargetFlags = 0) const {
|
||||
MI->addOperand(*MF, MachineOperand::CreateES(FnName, TargetFlags));
|
||||
return *this;
|
||||
}
|
||||
|
||||
const MachineInstrBuilder &addBlockAddress(const BlockAddress *BA,
|
||||
int64_t Offset = 0,
|
||||
unsigned char TargetFlags = 0) const {
|
||||
unsigned TargetFlags = 0) const {
|
||||
MI->addOperand(*MF, MachineOperand::CreateBA(BA, Offset, TargetFlags));
|
||||
return *this;
|
||||
}
|
||||
|
|
|
@ -717,11 +717,11 @@ public:
|
|||
void ChangeToFPImmediate(const ConstantFP *FPImm);
|
||||
|
||||
/// ChangeToES - Replace this operand with a new external symbol operand.
|
||||
void ChangeToES(const char *SymName, unsigned char TargetFlags = 0);
|
||||
void ChangeToES(const char *SymName, unsigned TargetFlags = 0);
|
||||
|
||||
/// ChangeToGA - Replace this operand with a new global address operand.
|
||||
void ChangeToGA(const GlobalValue *GV, int64_t Offset,
|
||||
unsigned char TargetFlags = 0);
|
||||
unsigned TargetFlags = 0);
|
||||
|
||||
/// ChangeToMCSymbol - Replace this operand with a new MC symbol operand.
|
||||
void ChangeToMCSymbol(MCSymbol *Sym);
|
||||
|
@ -731,7 +731,7 @@ public:
|
|||
|
||||
/// Replace this operand with a target index.
|
||||
void ChangeToTargetIndex(unsigned Idx, int64_t Offset,
|
||||
unsigned char TargetFlags = 0);
|
||||
unsigned TargetFlags = 0);
|
||||
|
||||
/// ChangeToRegister - Replace this operand with a new register operand of
|
||||
/// the specified value. If an operand is known to be an register already,
|
||||
|
@ -788,7 +788,7 @@ public:
|
|||
return Op;
|
||||
}
|
||||
static MachineOperand CreateMBB(MachineBasicBlock *MBB,
|
||||
unsigned char TargetFlags = 0) {
|
||||
unsigned TargetFlags = 0) {
|
||||
MachineOperand Op(MachineOperand::MO_MachineBasicBlock);
|
||||
Op.setMBB(MBB);
|
||||
Op.setTargetFlags(TargetFlags);
|
||||
|
@ -800,7 +800,7 @@ public:
|
|||
return Op;
|
||||
}
|
||||
static MachineOperand CreateCPI(unsigned Idx, int Offset,
|
||||
unsigned char TargetFlags = 0) {
|
||||
unsigned TargetFlags = 0) {
|
||||
MachineOperand Op(MachineOperand::MO_ConstantPoolIndex);
|
||||
Op.setIndex(Idx);
|
||||
Op.setOffset(Offset);
|
||||
|
@ -808,21 +808,21 @@ public:
|
|||
return Op;
|
||||
}
|
||||
static MachineOperand CreateTargetIndex(unsigned Idx, int64_t Offset,
|
||||
unsigned char TargetFlags = 0) {
|
||||
unsigned TargetFlags = 0) {
|
||||
MachineOperand Op(MachineOperand::MO_TargetIndex);
|
||||
Op.setIndex(Idx);
|
||||
Op.setOffset(Offset);
|
||||
Op.setTargetFlags(TargetFlags);
|
||||
return Op;
|
||||
}
|
||||
static MachineOperand CreateJTI(unsigned Idx, unsigned char TargetFlags = 0) {
|
||||
static MachineOperand CreateJTI(unsigned Idx, unsigned TargetFlags = 0) {
|
||||
MachineOperand Op(MachineOperand::MO_JumpTableIndex);
|
||||
Op.setIndex(Idx);
|
||||
Op.setTargetFlags(TargetFlags);
|
||||
return Op;
|
||||
}
|
||||
static MachineOperand CreateGA(const GlobalValue *GV, int64_t Offset,
|
||||
unsigned char TargetFlags = 0) {
|
||||
unsigned TargetFlags = 0) {
|
||||
MachineOperand Op(MachineOperand::MO_GlobalAddress);
|
||||
Op.Contents.OffsetedInfo.Val.GV = GV;
|
||||
Op.setOffset(Offset);
|
||||
|
@ -830,7 +830,7 @@ public:
|
|||
return Op;
|
||||
}
|
||||
static MachineOperand CreateES(const char *SymName,
|
||||
unsigned char TargetFlags = 0) {
|
||||
unsigned TargetFlags = 0) {
|
||||
MachineOperand Op(MachineOperand::MO_ExternalSymbol);
|
||||
Op.Contents.OffsetedInfo.Val.SymbolName = SymName;
|
||||
Op.setOffset(0); // Offset is always 0.
|
||||
|
@ -838,7 +838,7 @@ public:
|
|||
return Op;
|
||||
}
|
||||
static MachineOperand CreateBA(const BlockAddress *BA, int64_t Offset,
|
||||
unsigned char TargetFlags = 0) {
|
||||
unsigned TargetFlags = 0) {
|
||||
MachineOperand Op(MachineOperand::MO_BlockAddress);
|
||||
Op.Contents.OffsetedInfo.Val.BA = BA;
|
||||
Op.setOffset(Offset);
|
||||
|
@ -876,7 +876,7 @@ public:
|
|||
}
|
||||
|
||||
static MachineOperand CreateMCSymbol(MCSymbol *Sym,
|
||||
unsigned char TargetFlags = 0) {
|
||||
unsigned TargetFlags = 0) {
|
||||
MachineOperand Op(MachineOperand::MO_MCSymbol);
|
||||
Op.Contents.Sym = Sym;
|
||||
Op.setOffset(0);
|
||||
|
|
|
@ -634,10 +634,9 @@ public:
|
|||
|
||||
SDValue getGlobalAddress(const GlobalValue *GV, const SDLoc &DL, EVT VT,
|
||||
int64_t offset = 0, bool isTargetGA = false,
|
||||
unsigned char TargetFlags = 0);
|
||||
unsigned TargetFlags = 0);
|
||||
SDValue getTargetGlobalAddress(const GlobalValue *GV, const SDLoc &DL, EVT VT,
|
||||
int64_t offset = 0,
|
||||
unsigned char TargetFlags = 0) {
|
||||
int64_t offset = 0, unsigned TargetFlags = 0) {
|
||||
return getGlobalAddress(GV, DL, VT, offset, true, TargetFlags);
|
||||
}
|
||||
SDValue getFrameIndex(int FI, EVT VT, bool isTarget = false);
|
||||
|
@ -645,28 +644,27 @@ public:
|
|||
return getFrameIndex(FI, VT, true);
|
||||
}
|
||||
SDValue getJumpTable(int JTI, EVT VT, bool isTarget = false,
|
||||
unsigned char TargetFlags = 0);
|
||||
SDValue getTargetJumpTable(int JTI, EVT VT, unsigned char TargetFlags = 0) {
|
||||
unsigned TargetFlags = 0);
|
||||
SDValue getTargetJumpTable(int JTI, EVT VT, unsigned TargetFlags = 0) {
|
||||
return getJumpTable(JTI, VT, true, TargetFlags);
|
||||
}
|
||||
SDValue getConstantPool(const Constant *C, EVT VT,
|
||||
unsigned Align = 0, int Offs = 0, bool isT=false,
|
||||
unsigned char TargetFlags = 0);
|
||||
SDValue getTargetConstantPool(const Constant *C, EVT VT,
|
||||
unsigned Align = 0, int Offset = 0,
|
||||
unsigned char TargetFlags = 0) {
|
||||
SDValue getConstantPool(const Constant *C, EVT VT, unsigned Align = 0,
|
||||
int Offs = 0, bool isT = false,
|
||||
unsigned TargetFlags = 0);
|
||||
SDValue getTargetConstantPool(const Constant *C, EVT VT, unsigned Align = 0,
|
||||
int Offset = 0, unsigned TargetFlags = 0) {
|
||||
return getConstantPool(C, VT, Align, Offset, true, TargetFlags);
|
||||
}
|
||||
SDValue getConstantPool(MachineConstantPoolValue *C, EVT VT,
|
||||
unsigned Align = 0, int Offs = 0, bool isT=false,
|
||||
unsigned char TargetFlags = 0);
|
||||
SDValue getTargetConstantPool(MachineConstantPoolValue *C,
|
||||
EVT VT, unsigned Align = 0,
|
||||
int Offset = 0, unsigned char TargetFlags=0) {
|
||||
unsigned TargetFlags = 0);
|
||||
SDValue getTargetConstantPool(MachineConstantPoolValue *C, EVT VT,
|
||||
unsigned Align = 0, int Offset = 0,
|
||||
unsigned TargetFlags = 0) {
|
||||
return getConstantPool(C, VT, Align, Offset, true, TargetFlags);
|
||||
}
|
||||
SDValue getTargetIndex(int Index, EVT VT, int64_t Offset = 0,
|
||||
unsigned char TargetFlags = 0);
|
||||
unsigned TargetFlags = 0);
|
||||
// When generating a branch to a BB, we don't in general know enough
|
||||
// to provide debug info for the BB at that time, so keep this one around.
|
||||
SDValue getBasicBlock(MachineBasicBlock *MBB);
|
||||
|
@ -674,7 +672,7 @@ public:
|
|||
SDValue getExternalSymbol(const char *Sym, EVT VT);
|
||||
SDValue getExternalSymbol(const char *Sym, const SDLoc &dl, EVT VT);
|
||||
SDValue getTargetExternalSymbol(const char *Sym, EVT VT,
|
||||
unsigned char TargetFlags = 0);
|
||||
unsigned TargetFlags = 0);
|
||||
SDValue getMCSymbol(MCSymbol *Sym, EVT VT);
|
||||
|
||||
SDValue getValueType(EVT);
|
||||
|
@ -683,12 +681,10 @@ public:
|
|||
SDValue getEHLabel(const SDLoc &dl, SDValue Root, MCSymbol *Label);
|
||||
SDValue getLabelNode(unsigned Opcode, const SDLoc &dl, SDValue Root,
|
||||
MCSymbol *Label);
|
||||
SDValue getBlockAddress(const BlockAddress *BA, EVT VT,
|
||||
int64_t Offset = 0, bool isTarget = false,
|
||||
unsigned char TargetFlags = 0);
|
||||
SDValue getBlockAddress(const BlockAddress *BA, EVT VT, int64_t Offset = 0,
|
||||
bool isTarget = false, unsigned TargetFlags = 0);
|
||||
SDValue getTargetBlockAddress(const BlockAddress *BA, EVT VT,
|
||||
int64_t Offset = 0,
|
||||
unsigned char TargetFlags = 0) {
|
||||
int64_t Offset = 0, unsigned TargetFlags = 0) {
|
||||
return getBlockAddress(BA, VT, Offset, true, TargetFlags);
|
||||
}
|
||||
|
||||
|
@ -1733,7 +1729,7 @@ private:
|
|||
std::map<EVT, SDNode*, EVT::compareRawBits> ExtendedValueTypeNodes;
|
||||
StringMap<SDNode*> ExternalSymbols;
|
||||
|
||||
std::map<std::pair<std::string, unsigned char>,SDNode*> TargetExternalSymbols;
|
||||
std::map<std::pair<std::string, unsigned>, SDNode *> TargetExternalSymbols;
|
||||
DenseMap<MCSymbol *, SDNode *> MCSymbols;
|
||||
};
|
||||
|
||||
|
|
|
@ -1702,16 +1702,16 @@ class GlobalAddressSDNode : public SDNode {
|
|||
|
||||
const GlobalValue *TheGlobal;
|
||||
int64_t Offset;
|
||||
unsigned char TargetFlags;
|
||||
unsigned TargetFlags;
|
||||
|
||||
GlobalAddressSDNode(unsigned Opc, unsigned Order, const DebugLoc &DL,
|
||||
const GlobalValue *GA, EVT VT, int64_t o,
|
||||
unsigned char TF);
|
||||
unsigned TF);
|
||||
|
||||
public:
|
||||
const GlobalValue *getGlobal() const { return TheGlobal; }
|
||||
int64_t getOffset() const { return Offset; }
|
||||
unsigned char getTargetFlags() const { return TargetFlags; }
|
||||
unsigned getTargetFlags() const { return TargetFlags; }
|
||||
// Return the address space this GlobalAddress belongs to.
|
||||
unsigned getAddressSpace() const;
|
||||
|
||||
|
@ -1778,16 +1778,16 @@ class JumpTableSDNode : public SDNode {
|
|||
friend class SelectionDAG;
|
||||
|
||||
int JTI;
|
||||
unsigned char TargetFlags;
|
||||
unsigned TargetFlags;
|
||||
|
||||
JumpTableSDNode(int jti, EVT VT, bool isTarg, unsigned char TF)
|
||||
JumpTableSDNode(int jti, EVT VT, bool isTarg, unsigned TF)
|
||||
: SDNode(isTarg ? ISD::TargetJumpTable : ISD::JumpTable,
|
||||
0, DebugLoc(), getSDVTList(VT)), JTI(jti), TargetFlags(TF) {
|
||||
}
|
||||
|
||||
public:
|
||||
int getIndex() const { return JTI; }
|
||||
unsigned char getTargetFlags() const { return TargetFlags; }
|
||||
unsigned getTargetFlags() const { return TargetFlags; }
|
||||
|
||||
static bool classof(const SDNode *N) {
|
||||
return N->getOpcode() == ISD::JumpTable ||
|
||||
|
@ -1804,10 +1804,10 @@ class ConstantPoolSDNode : public SDNode {
|
|||
} Val;
|
||||
int Offset; // It's a MachineConstantPoolValue if top bit is set.
|
||||
unsigned Alignment; // Minimum alignment requirement of CP (not log2 value).
|
||||
unsigned char TargetFlags;
|
||||
unsigned TargetFlags;
|
||||
|
||||
ConstantPoolSDNode(bool isTarget, const Constant *c, EVT VT, int o,
|
||||
unsigned Align, unsigned char TF)
|
||||
unsigned Align, unsigned TF)
|
||||
: SDNode(isTarget ? ISD::TargetConstantPool : ISD::ConstantPool, 0,
|
||||
DebugLoc(), getSDVTList(VT)), Offset(o), Alignment(Align),
|
||||
TargetFlags(TF) {
|
||||
|
@ -1816,7 +1816,7 @@ class ConstantPoolSDNode : public SDNode {
|
|||
}
|
||||
|
||||
ConstantPoolSDNode(bool isTarget, MachineConstantPoolValue *v,
|
||||
EVT VT, int o, unsigned Align, unsigned char TF)
|
||||
EVT VT, int o, unsigned Align, unsigned TF)
|
||||
: SDNode(isTarget ? ISD::TargetConstantPool : ISD::ConstantPool, 0,
|
||||
DebugLoc(), getSDVTList(VT)), Offset(o), Alignment(Align),
|
||||
TargetFlags(TF) {
|
||||
|
@ -1847,7 +1847,7 @@ public:
|
|||
// Return the alignment of this constant pool object, which is either 0 (for
|
||||
// default alignment) or the desired value.
|
||||
unsigned getAlignment() const { return Alignment; }
|
||||
unsigned char getTargetFlags() const { return TargetFlags; }
|
||||
unsigned getTargetFlags() const { return TargetFlags; }
|
||||
|
||||
Type *getType() const;
|
||||
|
||||
|
@ -1861,16 +1861,16 @@ public:
|
|||
class TargetIndexSDNode : public SDNode {
|
||||
friend class SelectionDAG;
|
||||
|
||||
unsigned char TargetFlags;
|
||||
unsigned TargetFlags;
|
||||
int Index;
|
||||
int64_t Offset;
|
||||
|
||||
public:
|
||||
TargetIndexSDNode(int Idx, EVT VT, int64_t Ofs, unsigned char TF)
|
||||
: SDNode(ISD::TargetIndex, 0, DebugLoc(), getSDVTList(VT)),
|
||||
TargetFlags(TF), Index(Idx), Offset(Ofs) {}
|
||||
TargetIndexSDNode(int Idx, EVT VT, int64_t Ofs, unsigned TF)
|
||||
: SDNode(ISD::TargetIndex, 0, DebugLoc(), getSDVTList(VT)),
|
||||
TargetFlags(TF), Index(Idx), Offset(Ofs) {}
|
||||
|
||||
unsigned char getTargetFlags() const { return TargetFlags; }
|
||||
unsigned getTargetFlags() const { return TargetFlags; }
|
||||
int getIndex() const { return Index; }
|
||||
int64_t getOffset() const { return Offset; }
|
||||
|
||||
|
@ -2063,17 +2063,17 @@ class BlockAddressSDNode : public SDNode {
|
|||
|
||||
const BlockAddress *BA;
|
||||
int64_t Offset;
|
||||
unsigned char TargetFlags;
|
||||
unsigned TargetFlags;
|
||||
|
||||
BlockAddressSDNode(unsigned NodeTy, EVT VT, const BlockAddress *ba,
|
||||
int64_t o, unsigned char Flags)
|
||||
int64_t o, unsigned Flags)
|
||||
: SDNode(NodeTy, 0, DebugLoc(), getSDVTList(VT)),
|
||||
BA(ba), Offset(o), TargetFlags(Flags) {}
|
||||
|
||||
public:
|
||||
const BlockAddress *getBlockAddress() const { return BA; }
|
||||
int64_t getOffset() const { return Offset; }
|
||||
unsigned char getTargetFlags() const { return TargetFlags; }
|
||||
unsigned getTargetFlags() const { return TargetFlags; }
|
||||
|
||||
static bool classof(const SDNode *N) {
|
||||
return N->getOpcode() == ISD::BlockAddress ||
|
||||
|
@ -2104,15 +2104,16 @@ class ExternalSymbolSDNode : public SDNode {
|
|||
friend class SelectionDAG;
|
||||
|
||||
const char *Symbol;
|
||||
unsigned char TargetFlags;
|
||||
unsigned TargetFlags;
|
||||
|
||||
ExternalSymbolSDNode(bool isTarget, const char *Sym, unsigned char TF, EVT VT)
|
||||
: SDNode(isTarget ? ISD::TargetExternalSymbol : ISD::ExternalSymbol,
|
||||
0, DebugLoc(), getSDVTList(VT)), Symbol(Sym), TargetFlags(TF) {}
|
||||
ExternalSymbolSDNode(bool isTarget, const char *Sym, unsigned TF, EVT VT)
|
||||
: SDNode(isTarget ? ISD::TargetExternalSymbol : ISD::ExternalSymbol, 0,
|
||||
DebugLoc(), getSDVTList(VT)),
|
||||
Symbol(Sym), TargetFlags(TF) {}
|
||||
|
||||
public:
|
||||
const char *getSymbol() const { return Symbol; }
|
||||
unsigned char getTargetFlags() const { return TargetFlags; }
|
||||
unsigned getTargetFlags() const { return TargetFlags; }
|
||||
|
||||
static bool classof(const SDNode *N) {
|
||||
return N->getOpcode() == ISD::ExternalSymbol ||
|
||||
|
|
|
@ -169,7 +169,7 @@ void MachineOperand::ChangeToFPImmediate(const ConstantFP *FPImm) {
|
|||
}
|
||||
|
||||
void MachineOperand::ChangeToES(const char *SymName,
|
||||
unsigned char TargetFlags) {
|
||||
unsigned TargetFlags) {
|
||||
assert((!isReg() || !isTied()) &&
|
||||
"Cannot change a tied operand into an external symbol");
|
||||
|
||||
|
@ -182,7 +182,7 @@ void MachineOperand::ChangeToES(const char *SymName,
|
|||
}
|
||||
|
||||
void MachineOperand::ChangeToGA(const GlobalValue *GV, int64_t Offset,
|
||||
unsigned char TargetFlags) {
|
||||
unsigned TargetFlags) {
|
||||
assert((!isReg() || !isTied()) &&
|
||||
"Cannot change a tied operand into a global address");
|
||||
|
||||
|
@ -215,7 +215,7 @@ void MachineOperand::ChangeToFrameIndex(int Idx) {
|
|||
}
|
||||
|
||||
void MachineOperand::ChangeToTargetIndex(unsigned Idx, int64_t Offset,
|
||||
unsigned char TargetFlags) {
|
||||
unsigned TargetFlags) {
|
||||
assert((!isReg() || !isTied()) &&
|
||||
"Cannot change a tied operand into a FrameIndex");
|
||||
|
||||
|
|
|
@ -859,9 +859,8 @@ bool SelectionDAG::RemoveNodeFromCSEMaps(SDNode *N) {
|
|||
break;
|
||||
case ISD::TargetExternalSymbol: {
|
||||
ExternalSymbolSDNode *ESN = cast<ExternalSymbolSDNode>(N);
|
||||
Erased = TargetExternalSymbols.erase(
|
||||
std::pair<std::string,unsigned char>(ESN->getSymbol(),
|
||||
ESN->getTargetFlags()));
|
||||
Erased = TargetExternalSymbols.erase(std::pair<std::string, unsigned>(
|
||||
ESN->getSymbol(), ESN->getTargetFlags()));
|
||||
break;
|
||||
}
|
||||
case ISD::MCSymbol: {
|
||||
|
@ -1353,7 +1352,7 @@ SDValue SelectionDAG::getConstantFP(double Val, const SDLoc &DL, EVT VT,
|
|||
|
||||
SDValue SelectionDAG::getGlobalAddress(const GlobalValue *GV, const SDLoc &DL,
|
||||
EVT VT, int64_t Offset, bool isTargetGA,
|
||||
unsigned char TargetFlags) {
|
||||
unsigned TargetFlags) {
|
||||
assert((TargetFlags == 0 || isTargetGA) &&
|
||||
"Cannot set target flags on target-independent globals");
|
||||
|
||||
|
@ -1400,7 +1399,7 @@ SDValue SelectionDAG::getFrameIndex(int FI, EVT VT, bool isTarget) {
|
|||
}
|
||||
|
||||
SDValue SelectionDAG::getJumpTable(int JTI, EVT VT, bool isTarget,
|
||||
unsigned char TargetFlags) {
|
||||
unsigned TargetFlags) {
|
||||
assert((TargetFlags == 0 || isTarget) &&
|
||||
"Cannot set target flags on target-independent jump tables");
|
||||
unsigned Opc = isTarget ? ISD::TargetJumpTable : ISD::JumpTable;
|
||||
|
@ -1421,7 +1420,7 @@ SDValue SelectionDAG::getJumpTable(int JTI, EVT VT, bool isTarget,
|
|||
SDValue SelectionDAG::getConstantPool(const Constant *C, EVT VT,
|
||||
unsigned Alignment, int Offset,
|
||||
bool isTarget,
|
||||
unsigned char TargetFlags) {
|
||||
unsigned TargetFlags) {
|
||||
assert((TargetFlags == 0 || isTarget) &&
|
||||
"Cannot set target flags on target-independent globals");
|
||||
if (Alignment == 0)
|
||||
|
@ -1449,7 +1448,7 @@ SDValue SelectionDAG::getConstantPool(const Constant *C, EVT VT,
|
|||
SDValue SelectionDAG::getConstantPool(MachineConstantPoolValue *C, EVT VT,
|
||||
unsigned Alignment, int Offset,
|
||||
bool isTarget,
|
||||
unsigned char TargetFlags) {
|
||||
unsigned TargetFlags) {
|
||||
assert((TargetFlags == 0 || isTarget) &&
|
||||
"Cannot set target flags on target-independent globals");
|
||||
if (Alignment == 0)
|
||||
|
@ -1473,7 +1472,7 @@ SDValue SelectionDAG::getConstantPool(MachineConstantPoolValue *C, EVT VT,
|
|||
}
|
||||
|
||||
SDValue SelectionDAG::getTargetIndex(int Index, EVT VT, int64_t Offset,
|
||||
unsigned char TargetFlags) {
|
||||
unsigned TargetFlags) {
|
||||
FoldingSetNodeID ID;
|
||||
AddNodeIDNode(ID, ISD::TargetIndex, getVTList(VT), None);
|
||||
ID.AddInteger(Index);
|
||||
|
@ -1535,10 +1534,9 @@ SDValue SelectionDAG::getMCSymbol(MCSymbol *Sym, EVT VT) {
|
|||
}
|
||||
|
||||
SDValue SelectionDAG::getTargetExternalSymbol(const char *Sym, EVT VT,
|
||||
unsigned char TargetFlags) {
|
||||
unsigned TargetFlags) {
|
||||
SDNode *&N =
|
||||
TargetExternalSymbols[std::pair<std::string,unsigned char>(Sym,
|
||||
TargetFlags)];
|
||||
TargetExternalSymbols[std::pair<std::string, unsigned>(Sym, TargetFlags)];
|
||||
if (N) return SDValue(N, 0);
|
||||
N = newSDNode<ExternalSymbolSDNode>(true, Sym, TargetFlags, VT);
|
||||
InsertNode(N);
|
||||
|
@ -1802,9 +1800,8 @@ SDValue SelectionDAG::getLabelNode(unsigned Opcode, const SDLoc &dl,
|
|||
}
|
||||
|
||||
SDValue SelectionDAG::getBlockAddress(const BlockAddress *BA, EVT VT,
|
||||
int64_t Offset,
|
||||
bool isTarget,
|
||||
unsigned char TargetFlags) {
|
||||
int64_t Offset, bool isTarget,
|
||||
unsigned TargetFlags) {
|
||||
unsigned Opc = isTarget ? ISD::TargetBlockAddress : ISD::BlockAddress;
|
||||
|
||||
FoldingSetNodeID ID;
|
||||
|
@ -8800,7 +8797,7 @@ HandleSDNode::~HandleSDNode() {
|
|||
GlobalAddressSDNode::GlobalAddressSDNode(unsigned Opc, unsigned Order,
|
||||
const DebugLoc &DL,
|
||||
const GlobalValue *GA, EVT VT,
|
||||
int64_t o, unsigned char TF)
|
||||
int64_t o, unsigned TF)
|
||||
: SDNode(Opc, Order, DL, getSDVTList(VT)), Offset(o), TargetFlags(TF) {
|
||||
TheGlobal = GA;
|
||||
}
|
||||
|
|
|
@ -459,7 +459,7 @@ unsigned AArch64FastISel::materializeGV(const GlobalValue *GV) {
|
|||
if (!Subtarget->useSmallAddressing() && !Subtarget->isTargetMachO())
|
||||
return 0;
|
||||
|
||||
unsigned char OpFlags = Subtarget->ClassifyGlobalReference(GV, TM);
|
||||
unsigned OpFlags = Subtarget->ClassifyGlobalReference(GV, TM);
|
||||
|
||||
EVT DestEVT = TLI.getValueType(DL, GV->getType(), true);
|
||||
if (!DestEVT.isSimple())
|
||||
|
|
|
@ -4165,8 +4165,7 @@ SDValue AArch64TargetLowering::LowerGlobalAddress(SDValue Op,
|
|||
SelectionDAG &DAG) const {
|
||||
GlobalAddressSDNode *GN = cast<GlobalAddressSDNode>(Op);
|
||||
const GlobalValue *GV = GN->getGlobal();
|
||||
unsigned char OpFlags =
|
||||
Subtarget->ClassifyGlobalReference(GV, getTargetMachine());
|
||||
unsigned OpFlags = Subtarget->ClassifyGlobalReference(GV, getTargetMachine());
|
||||
|
||||
if (OpFlags != AArch64II::MO_NO_FLAG)
|
||||
assert(cast<GlobalAddressSDNode>(Op)->getOffset() == 0 &&
|
||||
|
|
|
@ -1501,7 +1501,7 @@ bool AArch64InstrInfo::expandPostRAPseudo(MachineInstr &MI) const {
|
|||
const GlobalValue *GV =
|
||||
cast<GlobalValue>((*MI.memoperands_begin())->getValue());
|
||||
const TargetMachine &TM = MBB.getParent()->getTarget();
|
||||
unsigned char OpFlags = Subtarget.ClassifyGlobalReference(GV, TM);
|
||||
unsigned OpFlags = Subtarget.ClassifyGlobalReference(GV, TM);
|
||||
const unsigned char MO_NC = AArch64II::MO_NC;
|
||||
|
||||
if ((OpFlags & AArch64II::MO_GOT) != 0) {
|
||||
|
|
|
@ -203,7 +203,7 @@ private:
|
|||
|
||||
// Materialize a GlobalValue or BlockAddress using a movz+movk sequence.
|
||||
void materializeLargeCMVal(MachineInstr &I, const Value *V,
|
||||
unsigned char OpFlags) const;
|
||||
unsigned OpFlags) const;
|
||||
|
||||
// Optimization methods.
|
||||
bool tryOptVectorShuffle(MachineInstr &I) const;
|
||||
|
@ -1060,7 +1060,7 @@ bool AArch64InstructionSelector::selectVaStartDarwin(
|
|||
}
|
||||
|
||||
void AArch64InstructionSelector::materializeLargeCMVal(
|
||||
MachineInstr &I, const Value *V, unsigned char OpFlags) const {
|
||||
MachineInstr &I, const Value *V, unsigned OpFlags) const {
|
||||
MachineBasicBlock &MBB = *I.getParent();
|
||||
MachineFunction &MF = *MBB.getParent();
|
||||
MachineRegisterInfo &MRI = MF.getRegInfo();
|
||||
|
@ -1668,7 +1668,7 @@ bool AArch64InstructionSelector::select(MachineInstr &I,
|
|||
// FIXME: we don't support TLS yet.
|
||||
return false;
|
||||
}
|
||||
unsigned char OpFlags = STI.ClassifyGlobalReference(GV, TM);
|
||||
unsigned OpFlags = STI.ClassifyGlobalReference(GV, TM);
|
||||
if (OpFlags & AArch64II::MO_GOT) {
|
||||
I.setDesc(TII.get(AArch64::LOADgot));
|
||||
I.getOperand(1).setTargetFlags(OpFlags);
|
||||
|
|
|
@ -206,7 +206,7 @@ const RegisterBankInfo *AArch64Subtarget::getRegBankInfo() const {
|
|||
|
||||
/// Find the target operand flags that describe how a global value should be
|
||||
/// referenced for the current subtarget.
|
||||
unsigned char
|
||||
unsigned
|
||||
AArch64Subtarget::ClassifyGlobalReference(const GlobalValue *GV,
|
||||
const TargetMachine &TM) const {
|
||||
// MachO large model always goes via a GOT, simply to get a single 8-byte
|
||||
|
@ -232,7 +232,7 @@ AArch64Subtarget::ClassifyGlobalReference(const GlobalValue *GV,
|
|||
return AArch64II::MO_NO_FLAG;
|
||||
}
|
||||
|
||||
unsigned char AArch64Subtarget::classifyGlobalFunctionReference(
|
||||
unsigned AArch64Subtarget::classifyGlobalFunctionReference(
|
||||
const GlobalValue *GV, const TargetMachine &TM) const {
|
||||
// MachO large model always goes via a GOT, because we don't have the
|
||||
// relocations available to do anything else..
|
||||
|
|
|
@ -452,11 +452,11 @@ public:
|
|||
|
||||
/// ClassifyGlobalReference - Find the target operand flags that describe
|
||||
/// how a global value should be referenced for the current subtarget.
|
||||
unsigned char ClassifyGlobalReference(const GlobalValue *GV,
|
||||
const TargetMachine &TM) const;
|
||||
unsigned ClassifyGlobalReference(const GlobalValue *GV,
|
||||
const TargetMachine &TM) const;
|
||||
|
||||
unsigned char classifyGlobalFunctionReference(const GlobalValue *GV,
|
||||
const TargetMachine &TM) const;
|
||||
unsigned classifyGlobalFunctionReference(const GlobalValue *GV,
|
||||
const TargetMachine &TM) const;
|
||||
|
||||
void overrideSchedPolicy(MachineSchedPolicy &Policy,
|
||||
unsigned NumRegionInstrs) const override;
|
||||
|
|
Loading…
Reference in New Issue