mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-13 04:38:24 +00:00
Add support for empty metadata nodes: !{}.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108259 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -3983,6 +3983,10 @@ int LLParser::ParseInsertValue(Instruction *&Inst, PerFunctionState &PFS) {
|
|||||||
/// ::= 'null' | TypeAndValue
|
/// ::= 'null' | TypeAndValue
|
||||||
bool LLParser::ParseMDNodeVector(SmallVectorImpl<Value*> &Elts,
|
bool LLParser::ParseMDNodeVector(SmallVectorImpl<Value*> &Elts,
|
||||||
PerFunctionState *PFS) {
|
PerFunctionState *PFS) {
|
||||||
|
// Check for an empty list.
|
||||||
|
if (Lex.getKind() == lltok::rbrace)
|
||||||
|
return false;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
// Null is a special case since it is typeless.
|
// Null is a special case since it is typeless.
|
||||||
if (EatIfPresent(lltok::kw_null)) {
|
if (EatIfPresent(lltok::kw_null)) {
|
||||||
|
@ -820,7 +820,7 @@ bool BitcodeReader::ParseMetadata() {
|
|||||||
IsFunctionLocal = true;
|
IsFunctionLocal = true;
|
||||||
// fall-through
|
// fall-through
|
||||||
case bitc::METADATA_NODE: {
|
case bitc::METADATA_NODE: {
|
||||||
if (Record.empty() || Record.size() % 2 == 1)
|
if (Record.size() % 2 == 1)
|
||||||
return Error("Invalid METADATA_NODE record");
|
return Error("Invalid METADATA_NODE record");
|
||||||
|
|
||||||
unsigned Size = Record.size();
|
unsigned Size = Record.size();
|
||||||
@ -834,7 +834,8 @@ bool BitcodeReader::ParseMetadata() {
|
|||||||
else
|
else
|
||||||
Elts.push_back(NULL);
|
Elts.push_back(NULL);
|
||||||
}
|
}
|
||||||
Value *V = MDNode::getWhenValsUnresolved(Context, &Elts[0], Elts.size(),
|
Value *V = MDNode::getWhenValsUnresolved(Context,
|
||||||
|
Elts.data(), Elts.size(),
|
||||||
IsFunctionLocal);
|
IsFunctionLocal);
|
||||||
IsFunctionLocal = false;
|
IsFunctionLocal = false;
|
||||||
MDValueList.AssignValue(V, NextMDValueNo++);
|
MDValueList.AssignValue(V, NextMDValueNo++);
|
||||||
|
@ -78,7 +78,8 @@ void MDNodeOperand::allUsesReplacedWith(Value *NV) {
|
|||||||
/// getOperandPtr - Helper function to get the MDNodeOperand's coallocated on
|
/// getOperandPtr - Helper function to get the MDNodeOperand's coallocated on
|
||||||
/// the end of the MDNode.
|
/// the end of the MDNode.
|
||||||
static MDNodeOperand *getOperandPtr(MDNode *N, unsigned Op) {
|
static MDNodeOperand *getOperandPtr(MDNode *N, unsigned Op) {
|
||||||
assert(Op < N->getNumOperands() && "Invalid operand number");
|
// Use <= instead of < to permit a one-past-the-end address.
|
||||||
|
assert(Op <= N->getNumOperands() && "Invalid operand number");
|
||||||
return reinterpret_cast<MDNodeOperand*>(N+1)+Op;
|
return reinterpret_cast<MDNodeOperand*>(N+1)+Op;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,4 +10,5 @@ declare void @llvm.zonk(metadata, i64, metadata) nounwind readnone
|
|||||||
|
|
||||||
!named = !{!0}
|
!named = !{!0}
|
||||||
!0 = metadata !{i8** null}
|
!0 = metadata !{i8** null}
|
||||||
!1 = metadata !{i8* null}
|
!1 = metadata !{i8* null, metadata !2}
|
||||||
|
!2 = metadata !{}
|
||||||
|
Reference in New Issue
Block a user