mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
add targetflags to jump tables and constant pool entries.
llvm-svn: 74204
This commit is contained in:
parent
f94959f1a3
commit
6a77e841e8
@ -289,22 +289,26 @@ public:
|
|||||||
SDValue getTargetFrameIndex(int FI, MVT VT) {
|
SDValue getTargetFrameIndex(int FI, MVT VT) {
|
||||||
return getFrameIndex(FI, VT, true);
|
return getFrameIndex(FI, VT, true);
|
||||||
}
|
}
|
||||||
SDValue getJumpTable(int JTI, MVT VT, bool isTarget = false);
|
SDValue getJumpTable(int JTI, MVT VT, bool isTarget = false,
|
||||||
SDValue getTargetJumpTable(int JTI, MVT VT) {
|
unsigned char TargetFlags = 0);
|
||||||
return getJumpTable(JTI, VT, true);
|
SDValue getTargetJumpTable(int JTI, MVT VT, unsigned char TargetFlags = 0) {
|
||||||
|
return getJumpTable(JTI, VT, true, TargetFlags);
|
||||||
}
|
}
|
||||||
SDValue getConstantPool(Constant *C, MVT VT,
|
SDValue getConstantPool(Constant *C, MVT VT,
|
||||||
unsigned Align = 0, int Offs = 0, bool isT=false);
|
unsigned Align = 0, int Offs = 0, bool isT=false,
|
||||||
|
unsigned char TargetFlags = 0);
|
||||||
SDValue getTargetConstantPool(Constant *C, MVT VT,
|
SDValue getTargetConstantPool(Constant *C, MVT VT,
|
||||||
unsigned Align = 0, int Offset = 0) {
|
unsigned Align = 0, int Offset = 0,
|
||||||
return getConstantPool(C, VT, Align, Offset, true);
|
unsigned char TargetFlags = 0) {
|
||||||
|
return getConstantPool(C, VT, Align, Offset, true, TargetFlags);
|
||||||
}
|
}
|
||||||
SDValue getConstantPool(MachineConstantPoolValue *C, MVT VT,
|
SDValue getConstantPool(MachineConstantPoolValue *C, MVT VT,
|
||||||
unsigned Align = 0, int Offs = 0, bool isT=false);
|
unsigned Align = 0, int Offs = 0, bool isT=false,
|
||||||
|
unsigned char TargetFlags = 0);
|
||||||
SDValue getTargetConstantPool(MachineConstantPoolValue *C,
|
SDValue getTargetConstantPool(MachineConstantPoolValue *C,
|
||||||
MVT VT, unsigned Align = 0,
|
MVT VT, unsigned Align = 0,
|
||||||
int Offset = 0) {
|
int Offset = 0, unsigned char TargetFlags=0) {
|
||||||
return getConstantPool(C, VT, Align, Offset, true);
|
return getConstantPool(C, VT, Align, Offset, true, TargetFlags);
|
||||||
}
|
}
|
||||||
// When generating a branch to a BB, we don't in general know enough
|
// 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.
|
// to provide debug info for the BB at that time, so keep this one around.
|
||||||
|
@ -1860,14 +1860,16 @@ public:
|
|||||||
|
|
||||||
class JumpTableSDNode : public SDNode {
|
class JumpTableSDNode : public SDNode {
|
||||||
int JTI;
|
int JTI;
|
||||||
|
unsigned char TargetFlags;
|
||||||
friend class SelectionDAG;
|
friend class SelectionDAG;
|
||||||
JumpTableSDNode(int jti, MVT VT, bool isTarg)
|
JumpTableSDNode(int jti, MVT VT, bool isTarg, unsigned char TF)
|
||||||
: SDNode(isTarg ? ISD::TargetJumpTable : ISD::JumpTable,
|
: SDNode(isTarg ? ISD::TargetJumpTable : ISD::JumpTable,
|
||||||
DebugLoc::getUnknownLoc(), getSDVTList(VT)), JTI(jti) {
|
DebugLoc::getUnknownLoc(), getSDVTList(VT)), JTI(jti), TargetFlags(TF) {
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|
||||||
int getIndex() const { return JTI; }
|
int getIndex() const { return JTI; }
|
||||||
|
unsigned char getTargetFlags() const { return TargetFlags; }
|
||||||
|
|
||||||
static bool classof(const JumpTableSDNode *) { return true; }
|
static bool classof(const JumpTableSDNode *) { return true; }
|
||||||
static bool classof(const SDNode *N) {
|
static bool classof(const SDNode *N) {
|
||||||
@ -1883,40 +1885,27 @@ class ConstantPoolSDNode : public SDNode {
|
|||||||
} Val;
|
} Val;
|
||||||
int Offset; // It's a MachineConstantPoolValue if top bit is set.
|
int Offset; // It's a MachineConstantPoolValue if top bit is set.
|
||||||
unsigned Alignment; // Minimum alignment requirement of CP (not log2 value).
|
unsigned Alignment; // Minimum alignment requirement of CP (not log2 value).
|
||||||
|
unsigned char TargetFlags;
|
||||||
friend class SelectionDAG;
|
friend class SelectionDAG;
|
||||||
ConstantPoolSDNode(bool isTarget, Constant *c, MVT VT, int o=0)
|
ConstantPoolSDNode(bool isTarget, Constant *c, MVT VT, int o, unsigned Align,
|
||||||
|
unsigned char TF)
|
||||||
: SDNode(isTarget ? ISD::TargetConstantPool : ISD::ConstantPool,
|
: SDNode(isTarget ? ISD::TargetConstantPool : ISD::ConstantPool,
|
||||||
DebugLoc::getUnknownLoc(),
|
DebugLoc::getUnknownLoc(),
|
||||||
getSDVTList(VT)), Offset(o), Alignment(0) {
|
getSDVTList(VT)), Offset(o), Alignment(Align), TargetFlags(TF) {
|
||||||
assert((int)Offset >= 0 && "Offset is too large");
|
|
||||||
Val.ConstVal = c;
|
|
||||||
}
|
|
||||||
ConstantPoolSDNode(bool isTarget, Constant *c, MVT VT, int o, unsigned Align)
|
|
||||||
: SDNode(isTarget ? ISD::TargetConstantPool : ISD::ConstantPool,
|
|
||||||
DebugLoc::getUnknownLoc(),
|
|
||||||
getSDVTList(VT)), Offset(o), Alignment(Align) {
|
|
||||||
assert((int)Offset >= 0 && "Offset is too large");
|
assert((int)Offset >= 0 && "Offset is too large");
|
||||||
Val.ConstVal = c;
|
Val.ConstVal = c;
|
||||||
}
|
}
|
||||||
ConstantPoolSDNode(bool isTarget, MachineConstantPoolValue *v,
|
ConstantPoolSDNode(bool isTarget, MachineConstantPoolValue *v,
|
||||||
MVT VT, int o=0)
|
MVT VT, int o, unsigned Align, unsigned char TF)
|
||||||
: SDNode(isTarget ? ISD::TargetConstantPool : ISD::ConstantPool,
|
: SDNode(isTarget ? ISD::TargetConstantPool : ISD::ConstantPool,
|
||||||
DebugLoc::getUnknownLoc(),
|
DebugLoc::getUnknownLoc(),
|
||||||
getSDVTList(VT)), Offset(o), Alignment(0) {
|
getSDVTList(VT)), Offset(o), Alignment(Align), TargetFlags(TF) {
|
||||||
assert((int)Offset >= 0 && "Offset is too large");
|
|
||||||
Val.MachineCPVal = v;
|
|
||||||
Offset |= 1 << (sizeof(unsigned)*CHAR_BIT-1);
|
|
||||||
}
|
|
||||||
ConstantPoolSDNode(bool isTarget, MachineConstantPoolValue *v,
|
|
||||||
MVT VT, int o, unsigned Align)
|
|
||||||
: SDNode(isTarget ? ISD::TargetConstantPool : ISD::ConstantPool,
|
|
||||||
DebugLoc::getUnknownLoc(),
|
|
||||||
getSDVTList(VT)), Offset(o), Alignment(Align) {
|
|
||||||
assert((int)Offset >= 0 && "Offset is too large");
|
assert((int)Offset >= 0 && "Offset is too large");
|
||||||
Val.MachineCPVal = v;
|
Val.MachineCPVal = v;
|
||||||
Offset |= 1 << (sizeof(unsigned)*CHAR_BIT-1);
|
Offset |= 1 << (sizeof(unsigned)*CHAR_BIT-1);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
bool isMachineConstantPoolEntry() const {
|
bool isMachineConstantPoolEntry() const {
|
||||||
return (int)Offset < 0;
|
return (int)Offset < 0;
|
||||||
@ -1939,6 +1928,7 @@ public:
|
|||||||
// Return the alignment of this constant pool object, which is either 0 (for
|
// Return the alignment of this constant pool object, which is either 0 (for
|
||||||
// default alignment) or the desired value.
|
// default alignment) or the desired value.
|
||||||
unsigned getAlignment() const { return Alignment; }
|
unsigned getAlignment() const { return Alignment; }
|
||||||
|
unsigned char getTargetFlags() const { return TargetFlags; }
|
||||||
|
|
||||||
const Type *getType() const;
|
const Type *getType() const;
|
||||||
|
|
||||||
|
@ -415,6 +415,7 @@ static void AddNodeIDCustom(FoldingSetNodeID &ID, const SDNode *N) {
|
|||||||
case ISD::JumpTable:
|
case ISD::JumpTable:
|
||||||
case ISD::TargetJumpTable:
|
case ISD::TargetJumpTable:
|
||||||
ID.AddInteger(cast<JumpTableSDNode>(N)->getIndex());
|
ID.AddInteger(cast<JumpTableSDNode>(N)->getIndex());
|
||||||
|
ID.AddInteger(cast<JumpTableSDNode>(N)->getTargetFlags());
|
||||||
break;
|
break;
|
||||||
case ISD::ConstantPool:
|
case ISD::ConstantPool:
|
||||||
case ISD::TargetConstantPool: {
|
case ISD::TargetConstantPool: {
|
||||||
@ -425,6 +426,7 @@ static void AddNodeIDCustom(FoldingSetNodeID &ID, const SDNode *N) {
|
|||||||
CP->getMachineCPVal()->AddSelectionDAGCSEId(ID);
|
CP->getMachineCPVal()->AddSelectionDAGCSEId(ID);
|
||||||
else
|
else
|
||||||
ID.AddPointer(CP->getConstVal());
|
ID.AddPointer(CP->getConstVal());
|
||||||
|
ID.AddInteger(CP->getTargetFlags());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ISD::CALL: {
|
case ISD::CALL: {
|
||||||
@ -1015,16 +1017,20 @@ SDValue SelectionDAG::getFrameIndex(int FI, MVT VT, bool isTarget) {
|
|||||||
return SDValue(N, 0);
|
return SDValue(N, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDValue SelectionDAG::getJumpTable(int JTI, MVT VT, bool isTarget){
|
SDValue SelectionDAG::getJumpTable(int JTI, MVT VT, bool isTarget,
|
||||||
|
unsigned char TargetFlags) {
|
||||||
|
assert((TargetFlags == 0 || isTarget) &&
|
||||||
|
"Cannot set target flags on target-independent jump tables");
|
||||||
unsigned Opc = isTarget ? ISD::TargetJumpTable : ISD::JumpTable;
|
unsigned Opc = isTarget ? ISD::TargetJumpTable : ISD::JumpTable;
|
||||||
FoldingSetNodeID ID;
|
FoldingSetNodeID ID;
|
||||||
AddNodeIDNode(ID, Opc, getVTList(VT), 0, 0);
|
AddNodeIDNode(ID, Opc, getVTList(VT), 0, 0);
|
||||||
ID.AddInteger(JTI);
|
ID.AddInteger(JTI);
|
||||||
|
ID.AddInteger(TargetFlags);
|
||||||
void *IP = 0;
|
void *IP = 0;
|
||||||
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
|
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
|
||||||
return SDValue(E, 0);
|
return SDValue(E, 0);
|
||||||
SDNode *N = NodeAllocator.Allocate<JumpTableSDNode>();
|
SDNode *N = NodeAllocator.Allocate<JumpTableSDNode>();
|
||||||
new (N) JumpTableSDNode(JTI, VT, isTarget);
|
new (N) JumpTableSDNode(JTI, VT, isTarget, TargetFlags);
|
||||||
CSEMap.InsertNode(N, IP);
|
CSEMap.InsertNode(N, IP);
|
||||||
AllNodes.push_back(N);
|
AllNodes.push_back(N);
|
||||||
return SDValue(N, 0);
|
return SDValue(N, 0);
|
||||||
@ -1032,7 +1038,10 @@ SDValue SelectionDAG::getJumpTable(int JTI, MVT VT, bool isTarget){
|
|||||||
|
|
||||||
SDValue SelectionDAG::getConstantPool(Constant *C, MVT VT,
|
SDValue SelectionDAG::getConstantPool(Constant *C, MVT VT,
|
||||||
unsigned Alignment, int Offset,
|
unsigned Alignment, int Offset,
|
||||||
bool isTarget) {
|
bool isTarget,
|
||||||
|
unsigned char TargetFlags) {
|
||||||
|
assert((TargetFlags == 0 || isTarget) &&
|
||||||
|
"Cannot set target flags on target-independent globals");
|
||||||
if (Alignment == 0)
|
if (Alignment == 0)
|
||||||
Alignment = TLI.getTargetData()->getPrefTypeAlignment(C->getType());
|
Alignment = TLI.getTargetData()->getPrefTypeAlignment(C->getType());
|
||||||
unsigned Opc = isTarget ? ISD::TargetConstantPool : ISD::ConstantPool;
|
unsigned Opc = isTarget ? ISD::TargetConstantPool : ISD::ConstantPool;
|
||||||
@ -1041,11 +1050,12 @@ SDValue SelectionDAG::getConstantPool(Constant *C, MVT VT,
|
|||||||
ID.AddInteger(Alignment);
|
ID.AddInteger(Alignment);
|
||||||
ID.AddInteger(Offset);
|
ID.AddInteger(Offset);
|
||||||
ID.AddPointer(C);
|
ID.AddPointer(C);
|
||||||
|
ID.AddInteger(TargetFlags);
|
||||||
void *IP = 0;
|
void *IP = 0;
|
||||||
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
|
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
|
||||||
return SDValue(E, 0);
|
return SDValue(E, 0);
|
||||||
SDNode *N = NodeAllocator.Allocate<ConstantPoolSDNode>();
|
SDNode *N = NodeAllocator.Allocate<ConstantPoolSDNode>();
|
||||||
new (N) ConstantPoolSDNode(isTarget, C, VT, Offset, Alignment);
|
new (N) ConstantPoolSDNode(isTarget, C, VT, Offset, Alignment, TargetFlags);
|
||||||
CSEMap.InsertNode(N, IP);
|
CSEMap.InsertNode(N, IP);
|
||||||
AllNodes.push_back(N);
|
AllNodes.push_back(N);
|
||||||
return SDValue(N, 0);
|
return SDValue(N, 0);
|
||||||
@ -1054,7 +1064,10 @@ SDValue SelectionDAG::getConstantPool(Constant *C, MVT VT,
|
|||||||
|
|
||||||
SDValue SelectionDAG::getConstantPool(MachineConstantPoolValue *C, MVT VT,
|
SDValue SelectionDAG::getConstantPool(MachineConstantPoolValue *C, MVT VT,
|
||||||
unsigned Alignment, int Offset,
|
unsigned Alignment, int Offset,
|
||||||
bool isTarget) {
|
bool isTarget,
|
||||||
|
unsigned char TargetFlags) {
|
||||||
|
assert((TargetFlags == 0 || isTarget) &&
|
||||||
|
"Cannot set target flags on target-independent globals");
|
||||||
if (Alignment == 0)
|
if (Alignment == 0)
|
||||||
Alignment = TLI.getTargetData()->getPrefTypeAlignment(C->getType());
|
Alignment = TLI.getTargetData()->getPrefTypeAlignment(C->getType());
|
||||||
unsigned Opc = isTarget ? ISD::TargetConstantPool : ISD::ConstantPool;
|
unsigned Opc = isTarget ? ISD::TargetConstantPool : ISD::ConstantPool;
|
||||||
@ -1063,11 +1076,12 @@ SDValue SelectionDAG::getConstantPool(MachineConstantPoolValue *C, MVT VT,
|
|||||||
ID.AddInteger(Alignment);
|
ID.AddInteger(Alignment);
|
||||||
ID.AddInteger(Offset);
|
ID.AddInteger(Offset);
|
||||||
C->AddSelectionDAGCSEId(ID);
|
C->AddSelectionDAGCSEId(ID);
|
||||||
|
ID.AddInteger(TargetFlags);
|
||||||
void *IP = 0;
|
void *IP = 0;
|
||||||
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
|
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
|
||||||
return SDValue(E, 0);
|
return SDValue(E, 0);
|
||||||
SDNode *N = NodeAllocator.Allocate<ConstantPoolSDNode>();
|
SDNode *N = NodeAllocator.Allocate<ConstantPoolSDNode>();
|
||||||
new (N) ConstantPoolSDNode(isTarget, C, VT, Offset, Alignment);
|
new (N) ConstantPoolSDNode(isTarget, C, VT, Offset, Alignment, TargetFlags);
|
||||||
CSEMap.InsertNode(N, IP);
|
CSEMap.InsertNode(N, IP);
|
||||||
AllNodes.push_back(N);
|
AllNodes.push_back(N);
|
||||||
return SDValue(N, 0);
|
return SDValue(N, 0);
|
||||||
@ -5502,6 +5516,8 @@ void SDNode::print_details(raw_ostream &OS, const SelectionDAG *G) const {
|
|||||||
OS << "<" << FIDN->getIndex() << ">";
|
OS << "<" << FIDN->getIndex() << ">";
|
||||||
} else if (const JumpTableSDNode *JTDN = dyn_cast<JumpTableSDNode>(this)) {
|
} else if (const JumpTableSDNode *JTDN = dyn_cast<JumpTableSDNode>(this)) {
|
||||||
OS << "<" << JTDN->getIndex() << ">";
|
OS << "<" << JTDN->getIndex() << ">";
|
||||||
|
if (unsigned char TF = JTDN->getTargetFlags())
|
||||||
|
OS << " [TF=" << TF << ']';
|
||||||
} else if (const ConstantPoolSDNode *CP = dyn_cast<ConstantPoolSDNode>(this)){
|
} else if (const ConstantPoolSDNode *CP = dyn_cast<ConstantPoolSDNode>(this)){
|
||||||
int offset = CP->getOffset();
|
int offset = CP->getOffset();
|
||||||
if (CP->isMachineConstantPoolEntry())
|
if (CP->isMachineConstantPoolEntry())
|
||||||
@ -5512,6 +5528,8 @@ void SDNode::print_details(raw_ostream &OS, const SelectionDAG *G) const {
|
|||||||
OS << " + " << offset;
|
OS << " + " << offset;
|
||||||
else
|
else
|
||||||
OS << " " << offset;
|
OS << " " << offset;
|
||||||
|
if (unsigned char TF = CP->getTargetFlags())
|
||||||
|
OS << " [TF=" << TF << ']';
|
||||||
} else if (const BasicBlockSDNode *BBDN = dyn_cast<BasicBlockSDNode>(this)) {
|
} else if (const BasicBlockSDNode *BBDN = dyn_cast<BasicBlockSDNode>(this)) {
|
||||||
OS << "<";
|
OS << "<";
|
||||||
const Value *LBB = (const Value*)BBDN->getBasicBlock()->getBasicBlock();
|
const Value *LBB = (const Value*)BBDN->getBasicBlock()->getBasicBlock();
|
||||||
|
Loading…
Reference in New Issue
Block a user