mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-24 20:29:53 +00:00
Remove MetadataBase class because it is not adding significant value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94243 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5d74e1f644
commit
bc5201f837
@ -30,27 +30,11 @@ template<typename ValueSubClass, typename ItemParentClass>
|
|||||||
class SymbolTableListTraits;
|
class SymbolTableListTraits;
|
||||||
|
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
// MetadataBase - A base class for MDNode and MDString.
|
|
||||||
class MetadataBase : public Value {
|
|
||||||
protected:
|
|
||||||
MetadataBase(const Type *Ty, unsigned scid)
|
|
||||||
: Value(Ty, scid) {}
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
||||||
static inline bool classof(const MetadataBase *) { return true; }
|
|
||||||
static bool classof(const Value *V) {
|
|
||||||
return V->getValueID() == MDStringVal || V->getValueID() == MDNodeVal;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
/// MDString - a single uniqued string.
|
/// MDString - a single uniqued string.
|
||||||
/// These are used to efficiently contain a byte sequence for metadata.
|
/// These are used to efficiently contain a byte sequence for metadata.
|
||||||
/// MDString is always unnamd.
|
/// MDString is always unnamd.
|
||||||
class MDString : public MetadataBase {
|
class MDString : public Value {
|
||||||
MDString(const MDString &); // DO NOT IMPLEMENT
|
MDString(const MDString &); // DO NOT IMPLEMENT
|
||||||
|
|
||||||
StringRef Str;
|
StringRef Str;
|
||||||
@ -87,7 +71,7 @@ class MDNodeOperand;
|
|||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
/// MDNode - a tuple of other values.
|
/// MDNode - a tuple of other values.
|
||||||
class MDNode : public MetadataBase, public FoldingSetNode {
|
class MDNode : public Value, public FoldingSetNode {
|
||||||
MDNode(const MDNode &); // DO NOT IMPLEMENT
|
MDNode(const MDNode &); // DO NOT IMPLEMENT
|
||||||
void operator=(const MDNode &); // DO NOT IMPLEMENT
|
void operator=(const MDNode &); // DO NOT IMPLEMENT
|
||||||
friend class MDNodeOperand;
|
friend class MDNodeOperand;
|
||||||
|
@ -29,7 +29,6 @@ namespace llvm {
|
|||||||
class Instruction;
|
class Instruction;
|
||||||
class Constant;
|
class Constant;
|
||||||
class GlobalValue;
|
class GlobalValue;
|
||||||
class MetadataBase;
|
|
||||||
class MDString;
|
class MDString;
|
||||||
class MDNode;
|
class MDNode;
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ void ValueEnumerator::setInstructionID(const Instruction *I) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsigned ValueEnumerator::getValueID(const Value *V) const {
|
unsigned ValueEnumerator::getValueID(const Value *V) const {
|
||||||
if (isa<MetadataBase>(V)) {
|
if (isa<MDNode>(V) || isa<MDString>(V)) {
|
||||||
ValueMapType::const_iterator I = MDValueMap.find(V);
|
ValueMapType::const_iterator I = MDValueMap.find(V);
|
||||||
assert(I != MDValueMap.end() && "Value not in slotcalculator!");
|
assert(I != MDValueMap.end() && "Value not in slotcalculator!");
|
||||||
return I->second-1;
|
return I->second-1;
|
||||||
@ -229,7 +229,8 @@ void ValueEnumerator::EnumerateNamedMDNode(const NamedMDNode *MD) {
|
|||||||
MDValueMap[MD] = Values.size();
|
MDValueMap[MD] = Values.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ValueEnumerator::EnumerateMetadata(const MetadataBase *MD) {
|
void ValueEnumerator::EnumerateMetadata(const Value *MD) {
|
||||||
|
assert(isa<MDNode>(MD) || isa<MDString>(MD) && "Invalid metadata kind");
|
||||||
// Check to see if it's already in!
|
// Check to see if it's already in!
|
||||||
unsigned &MDValueID = MDValueMap[MD];
|
unsigned &MDValueID = MDValueMap[MD];
|
||||||
if (MDValueID) {
|
if (MDValueID) {
|
||||||
@ -262,8 +263,8 @@ void ValueEnumerator::EnumerateMetadata(const MetadataBase *MD) {
|
|||||||
|
|
||||||
void ValueEnumerator::EnumerateValue(const Value *V) {
|
void ValueEnumerator::EnumerateValue(const Value *V) {
|
||||||
assert(!V->getType()->isVoidTy() && "Can't insert void values!");
|
assert(!V->getType()->isVoidTy() && "Can't insert void values!");
|
||||||
if (const MetadataBase *MB = dyn_cast<MetadataBase>(V))
|
if (isa<MDNode>(V) || isa<MDString>(V))
|
||||||
return EnumerateMetadata(MB);
|
return EnumerateMetadata(V);
|
||||||
else if (const NamedMDNode *NMD = dyn_cast<NamedMDNode>(V))
|
else if (const NamedMDNode *NMD = dyn_cast<NamedMDNode>(V))
|
||||||
return EnumerateNamedMDNode(NMD);
|
return EnumerateNamedMDNode(NMD);
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
void OptimizeConstants(unsigned CstStart, unsigned CstEnd);
|
void OptimizeConstants(unsigned CstStart, unsigned CstEnd);
|
||||||
|
|
||||||
void EnumerateMetadata(const MetadataBase *MD);
|
void EnumerateMetadata(const Value *MD);
|
||||||
void EnumerateNamedMDNode(const NamedMDNode *NMD);
|
void EnumerateNamedMDNode(const NamedMDNode *NMD);
|
||||||
void EnumerateValue(const Value *V);
|
void EnumerateValue(const Value *V);
|
||||||
void EnumerateType(const Type *T);
|
void EnumerateType(const Type *T);
|
||||||
|
@ -1910,8 +1910,7 @@ void DwarfDebug::collectVariableInfo() {
|
|||||||
MachineModuleInfo::VariableDbgInfoMapTy &VMap = MMI->getVariableDbgInfo();
|
MachineModuleInfo::VariableDbgInfoMapTy &VMap = MMI->getVariableDbgInfo();
|
||||||
for (MachineModuleInfo::VariableDbgInfoMapTy::iterator VI = VMap.begin(),
|
for (MachineModuleInfo::VariableDbgInfoMapTy::iterator VI = VMap.begin(),
|
||||||
VE = VMap.end(); VI != VE; ++VI) {
|
VE = VMap.end(); VI != VE; ++VI) {
|
||||||
MetadataBase *MB = VI->first;
|
MDNode *Var = VI->first;
|
||||||
MDNode *Var = dyn_cast_or_null<MDNode>(MB);
|
|
||||||
if (!Var) continue;
|
if (!Var) continue;
|
||||||
DIVariable DV (Var);
|
DIVariable DV (Var);
|
||||||
std::pair< unsigned, MDNode *> VP = VI->second;
|
std::pair< unsigned, MDNode *> VP = VI->second;
|
||||||
|
@ -392,7 +392,7 @@ static Value *RemapOperand(const Value *In,
|
|||||||
assert(!isa<GlobalValue>(CPV) && "Unmapped global?");
|
assert(!isa<GlobalValue>(CPV) && "Unmapped global?");
|
||||||
llvm_unreachable("Unknown type of derived type constant value!");
|
llvm_unreachable("Unknown type of derived type constant value!");
|
||||||
}
|
}
|
||||||
} else if (isa<MetadataBase>(In)) {
|
} else if (isa<MDNode>(In) || isa<MDString>(In)) {
|
||||||
Result = const_cast<Value*>(In);
|
Result = const_cast<Value*>(In);
|
||||||
} else if (isa<InlineAsm>(In)) {
|
} else if (isa<InlineAsm>(In)) {
|
||||||
Result = const_cast<Value*>(In);
|
Result = const_cast<Value*>(In);
|
||||||
|
@ -28,7 +28,7 @@ using namespace llvm;
|
|||||||
//
|
//
|
||||||
|
|
||||||
MDString::MDString(LLVMContext &C, StringRef S)
|
MDString::MDString(LLVMContext &C, StringRef S)
|
||||||
: MetadataBase(Type::getMetadataTy(C), Value::MDStringVal), Str(S) {}
|
: Value(Type::getMetadataTy(C), Value::MDStringVal), Str(S) {}
|
||||||
|
|
||||||
MDString *MDString::get(LLVMContext &Context, StringRef Str) {
|
MDString *MDString::get(LLVMContext &Context, StringRef Str) {
|
||||||
LLVMContextImpl *pImpl = Context.pImpl;
|
LLVMContextImpl *pImpl = Context.pImpl;
|
||||||
@ -93,7 +93,7 @@ static MDNodeOperand *getOperandPtr(MDNode *N, unsigned Op) {
|
|||||||
|
|
||||||
MDNode::MDNode(LLVMContext &C, Value *const *Vals, unsigned NumVals,
|
MDNode::MDNode(LLVMContext &C, Value *const *Vals, unsigned NumVals,
|
||||||
bool isFunctionLocal)
|
bool isFunctionLocal)
|
||||||
: MetadataBase(Type::getMetadataTy(C), Value::MDNodeVal) {
|
: Value(Type::getMetadataTy(C), Value::MDNodeVal) {
|
||||||
NumOperands = NumVals;
|
NumOperands = NumVals;
|
||||||
|
|
||||||
if (isFunctionLocal)
|
if (isFunctionLocal)
|
||||||
|
Loading…
Reference in New Issue
Block a user