forked from OSchip/llvm-project
switch to use the new api for structtypes.
llvm-svn: 137480
This commit is contained in:
parent
2f50231c10
commit
335d399a0e
|
@ -1263,7 +1263,7 @@ bool LLParser::ParseType(Type *&Result, bool AllowVoid) {
|
||||||
// If the type hasn't been defined yet, create a forward definition and
|
// If the type hasn't been defined yet, create a forward definition and
|
||||||
// remember where that forward def'n was seen (in case it never is defined).
|
// remember where that forward def'n was seen (in case it never is defined).
|
||||||
if (Entry.first == 0) {
|
if (Entry.first == 0) {
|
||||||
Entry.first = StructType::createNamed(Context, Lex.getStrVal());
|
Entry.first = StructType::create(Context, Lex.getStrVal());
|
||||||
Entry.second = Lex.getLoc();
|
Entry.second = Lex.getLoc();
|
||||||
}
|
}
|
||||||
Result = Entry.first;
|
Result = Entry.first;
|
||||||
|
@ -1280,7 +1280,7 @@ bool LLParser::ParseType(Type *&Result, bool AllowVoid) {
|
||||||
// If the type hasn't been defined yet, create a forward definition and
|
// If the type hasn't been defined yet, create a forward definition and
|
||||||
// remember where that forward def'n was seen (in case it never is defined).
|
// remember where that forward def'n was seen (in case it never is defined).
|
||||||
if (Entry.first == 0) {
|
if (Entry.first == 0) {
|
||||||
Entry.first = StructType::createNamed(Context, "");
|
Entry.first = StructType::create(Context);
|
||||||
Entry.second = Lex.getLoc();
|
Entry.second = Lex.getLoc();
|
||||||
}
|
}
|
||||||
Result = Entry.first;
|
Result = Entry.first;
|
||||||
|
@ -1502,7 +1502,7 @@ bool LLParser::ParseStructDefinition(SMLoc TypeLoc, StringRef Name,
|
||||||
|
|
||||||
// If this type number has never been uttered, create it.
|
// If this type number has never been uttered, create it.
|
||||||
if (Entry.first == 0)
|
if (Entry.first == 0)
|
||||||
Entry.first = StructType::createNamed(Context, Name);
|
Entry.first = StructType::create(Context, Name);
|
||||||
ResultTy = Entry.first;
|
ResultTy = Entry.first;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1528,7 +1528,7 @@ bool LLParser::ParseStructDefinition(SMLoc TypeLoc, StringRef Name,
|
||||||
|
|
||||||
// If this type number has never been uttered, create it.
|
// If this type number has never been uttered, create it.
|
||||||
if (Entry.first == 0)
|
if (Entry.first == 0)
|
||||||
Entry.first = StructType::createNamed(Context, Name);
|
Entry.first = StructType::create(Context, Name);
|
||||||
|
|
||||||
StructType *STy = cast<StructType>(Entry.first);
|
StructType *STy = cast<StructType>(Entry.first);
|
||||||
|
|
||||||
|
|
|
@ -400,7 +400,7 @@ Type *BitcodeReader::getTypeByID(unsigned ID) {
|
||||||
|
|
||||||
// If we have a forward reference, the only possible case is when it is to a
|
// If we have a forward reference, the only possible case is when it is to a
|
||||||
// named struct. Just create a placeholder for now.
|
// named struct. Just create a placeholder for now.
|
||||||
return TypeList[ID] = StructType::createNamed(Context, "");
|
return TypeList[ID] = StructType::create(Context);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// FIXME: Remove in LLVM 3.1, only used by ParseOldTypeTable.
|
/// FIXME: Remove in LLVM 3.1, only used by ParseOldTypeTable.
|
||||||
|
@ -668,7 +668,7 @@ bool BitcodeReader::ParseTypeTableBody() {
|
||||||
Res->setName(TypeName);
|
Res->setName(TypeName);
|
||||||
TypeList[NumRecords] = 0;
|
TypeList[NumRecords] = 0;
|
||||||
} else // Otherwise, create a new struct.
|
} else // Otherwise, create a new struct.
|
||||||
Res = StructType::createNamed(Context, TypeName);
|
Res = StructType::create(Context, TypeName);
|
||||||
TypeName.clear();
|
TypeName.clear();
|
||||||
|
|
||||||
SmallVector<Type*, 8> EltTys;
|
SmallVector<Type*, 8> EltTys;
|
||||||
|
@ -697,7 +697,7 @@ bool BitcodeReader::ParseTypeTableBody() {
|
||||||
Res->setName(TypeName);
|
Res->setName(TypeName);
|
||||||
TypeList[NumRecords] = 0;
|
TypeList[NumRecords] = 0;
|
||||||
} else // Otherwise, create a new struct with no body.
|
} else // Otherwise, create a new struct with no body.
|
||||||
Res = StructType::createNamed(Context, TypeName);
|
Res = StructType::create(Context, TypeName);
|
||||||
TypeName.clear();
|
TypeName.clear();
|
||||||
ResultTy = Res;
|
ResultTy = Res;
|
||||||
break;
|
break;
|
||||||
|
@ -831,7 +831,7 @@ RestartScan:
|
||||||
break;
|
break;
|
||||||
case bitc::TYPE_CODE_OPAQUE: // OPAQUE
|
case bitc::TYPE_CODE_OPAQUE: // OPAQUE
|
||||||
if (NextTypeID < TypeList.size() && TypeList[NextTypeID] == 0)
|
if (NextTypeID < TypeList.size() && TypeList[NextTypeID] == 0)
|
||||||
ResultTy = StructType::createNamed(Context, "");
|
ResultTy = StructType::create(Context);
|
||||||
break;
|
break;
|
||||||
case bitc::TYPE_CODE_STRUCT_OLD: {// STRUCT_OLD
|
case bitc::TYPE_CODE_STRUCT_OLD: {// STRUCT_OLD
|
||||||
if (NextTypeID >= TypeList.size()) break;
|
if (NextTypeID >= TypeList.size()) break;
|
||||||
|
@ -842,7 +842,7 @@ RestartScan:
|
||||||
|
|
||||||
// Set a type.
|
// Set a type.
|
||||||
if (TypeList[NextTypeID] == 0)
|
if (TypeList[NextTypeID] == 0)
|
||||||
TypeList[NextTypeID] = StructType::createNamed(Context, "");
|
TypeList[NextTypeID] = StructType::create(Context);
|
||||||
|
|
||||||
std::vector<Type*> EltTys;
|
std::vector<Type*> EltTys;
|
||||||
for (unsigned i = 1, e = Record.size(); i != e; ++i) {
|
for (unsigned i = 1, e = Record.size(); i != e; ++i) {
|
||||||
|
@ -961,7 +961,7 @@ bool BitcodeReader::ParseOldTypeSymbolTable() {
|
||||||
|
|
||||||
// Only apply the type name to a struct type with no name.
|
// Only apply the type name to a struct type with no name.
|
||||||
if (StructType *STy = dyn_cast<StructType>(TypeList[TypeID]))
|
if (StructType *STy = dyn_cast<StructType>(TypeList[TypeID]))
|
||||||
if (!STy->isAnonymous() && !STy->hasName())
|
if (!STy->isLiteral() && !STy->hasName())
|
||||||
STy->setName(TypeName);
|
STy->setName(TypeName);
|
||||||
TypeName.clear();
|
TypeName.clear();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -303,7 +303,7 @@ static void WriteTypeTable(const ValueEnumerator &VE, BitstreamWriter &Stream) {
|
||||||
E = ST->element_end(); I != E; ++I)
|
E = ST->element_end(); I != E; ++I)
|
||||||
TypeVals.push_back(VE.getTypeID(*I));
|
TypeVals.push_back(VE.getTypeID(*I));
|
||||||
|
|
||||||
if (ST->isAnonymous()) {
|
if (ST->isLiteral()) {
|
||||||
Code = bitc::TYPE_CODE_STRUCT_ANON;
|
Code = bitc::TYPE_CODE_STRUCT_ANON;
|
||||||
AbbrevToUse = StructAnonAbbrev;
|
AbbrevToUse = StructAnonAbbrev;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -326,7 +326,7 @@ void ValueEnumerator::EnumerateType(Type *Ty) {
|
||||||
// don't recursively visit it. This is safe because we allow forward
|
// don't recursively visit it. This is safe because we allow forward
|
||||||
// references of these in the bitcode reader.
|
// references of these in the bitcode reader.
|
||||||
if (StructType *STy = dyn_cast<StructType>(Ty))
|
if (StructType *STy = dyn_cast<StructType>(Ty))
|
||||||
if (!STy->isAnonymous())
|
if (!STy->isLiteral())
|
||||||
*TypeID = ~0U;
|
*TypeID = ~0U;
|
||||||
|
|
||||||
// Enumerate all of the subtypes before we enumerate this type. This ensures
|
// Enumerate all of the subtypes before we enumerate this type. This ensures
|
||||||
|
|
|
@ -218,7 +218,7 @@ Constant *ShadowStackGC::GetFrameMap(Function &F) {
|
||||||
};
|
};
|
||||||
|
|
||||||
Type *EltTys[] = { DescriptorElts[0]->getType(),DescriptorElts[1]->getType()};
|
Type *EltTys[] = { DescriptorElts[0]->getType(),DescriptorElts[1]->getType()};
|
||||||
StructType *STy = StructType::createNamed("gc_map."+utostr(NumMeta), EltTys);
|
StructType *STy = StructType::create(EltTys, "gc_map."+utostr(NumMeta));
|
||||||
|
|
||||||
Constant *FrameMap = ConstantStruct::get(STy, DescriptorElts);
|
Constant *FrameMap = ConstantStruct::get(STy, DescriptorElts);
|
||||||
|
|
||||||
|
@ -253,7 +253,7 @@ Type* ShadowStackGC::GetConcreteStackEntryType(Function &F) {
|
||||||
for (size_t I = 0; I != Roots.size(); I++)
|
for (size_t I = 0; I != Roots.size(); I++)
|
||||||
EltTys.push_back(Roots[I].second->getAllocatedType());
|
EltTys.push_back(Roots[I].second->getAllocatedType());
|
||||||
|
|
||||||
return StructType::createNamed("gc_stackentry."+F.getName().str(), EltTys);
|
return StructType::create(EltTys, "gc_stackentry."+F.getName().str());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// doInitialization - If this module uses the GC intrinsics, find them now. If
|
/// doInitialization - If this module uses the GC intrinsics, find them now. If
|
||||||
|
@ -269,7 +269,7 @@ bool ShadowStackGC::initializeCustomLowering(Module &M) {
|
||||||
EltTys.push_back(Type::getInt32Ty(M.getContext()));
|
EltTys.push_back(Type::getInt32Ty(M.getContext()));
|
||||||
// Specifies length of variable length array.
|
// Specifies length of variable length array.
|
||||||
EltTys.push_back(Type::getInt32Ty(M.getContext()));
|
EltTys.push_back(Type::getInt32Ty(M.getContext()));
|
||||||
FrameMapTy = StructType::createNamed("gc_map", EltTys);
|
FrameMapTy = StructType::create(EltTys, "gc_map");
|
||||||
PointerType *FrameMapPtrTy = PointerType::getUnqual(FrameMapTy);
|
PointerType *FrameMapPtrTy = PointerType::getUnqual(FrameMapTy);
|
||||||
|
|
||||||
// struct StackEntry {
|
// struct StackEntry {
|
||||||
|
@ -278,7 +278,7 @@ bool ShadowStackGC::initializeCustomLowering(Module &M) {
|
||||||
// void *Roots[]; // Stack roots (in-place array, so we pretend).
|
// void *Roots[]; // Stack roots (in-place array, so we pretend).
|
||||||
// };
|
// };
|
||||||
|
|
||||||
StackEntryTy = StructType::createNamed(M.getContext(), "gc_stackentry");
|
StackEntryTy = StructType::create(M.getContext(), "gc_stackentry");
|
||||||
|
|
||||||
EltTys.clear();
|
EltTys.clear();
|
||||||
EltTys.push_back(PointerType::getUnqual(StackEntryTy));
|
EltTys.push_back(PointerType::getUnqual(StackEntryTy));
|
||||||
|
|
|
@ -180,7 +180,7 @@ static void StripTypeNames(Module &M, bool PreserveDbgInfo) {
|
||||||
|
|
||||||
for (unsigned i = 0, e = StructTypes.size(); i != e; ++i) {
|
for (unsigned i = 0, e = StructTypes.size(); i != e; ++i) {
|
||||||
StructType *STy = StructTypes[i];
|
StructType *STy = StructTypes[i];
|
||||||
if (STy->isAnonymous() || STy->getName().empty()) continue;
|
if (STy->isLiteral() || STy->getName().empty()) continue;
|
||||||
|
|
||||||
if (PreserveDbgInfo && STy->getName().startswith("llvm.dbg"))
|
if (PreserveDbgInfo && STy->getName().startswith("llvm.dbg"))
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -127,7 +127,7 @@ bool LowerInvoke::doInitialization(Module &M) {
|
||||||
JBSize = JBSize ? JBSize : 200;
|
JBSize = JBSize ? JBSize : 200;
|
||||||
Type *JmpBufTy = ArrayType::get(VoidPtrTy, JBSize);
|
Type *JmpBufTy = ArrayType::get(VoidPtrTy, JBSize);
|
||||||
|
|
||||||
JBLinkTy = StructType::createNamed(M.getContext(), "llvm.sjljeh.jmpbufty");
|
JBLinkTy = StructType::create(M.getContext(), "llvm.sjljeh.jmpbufty");
|
||||||
Type *Elts[] = { JmpBufTy, PointerType::getUnqual(JBLinkTy) };
|
Type *Elts[] = { JmpBufTy, PointerType::getUnqual(JBLinkTy) };
|
||||||
JBLinkTy->setBody(Elts);
|
JBLinkTy->setBody(Elts);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue