llvm.org GIT mirror llvm / e8e0213
Write and read metadata attachments. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82259 91177308-0d34-0410-b5e6-96231b3b80d8 Devang Patel 10 years ago
10 changed file(s) with 256 addition(s) and 19 deletion(s). Raw diff Collapse all Expand all
3333 FUNCTION_BLOCK_ID,
3434 TYPE_SYMTAB_BLOCK_ID,
3535 VALUE_SYMTAB_BLOCK_ID,
36 METADATA_BLOCK_ID
36 METADATA_BLOCK_ID,
37 METADATA_ATTACHMENT_ID
3738 };
3839
3940
110111 METADATA_STRING = 1, // MDSTRING: [values]
111112 METADATA_NODE = 2, // MDNODE: [n x (type num, value num)]
112113 METADATA_NAME = 3, // STRING: [values]
113 METADATA_NAMED_NODE = 4 // NAMEDMDNODE: [n x mdnodes]
114 METADATA_NAMED_NODE = 4, // NAMEDMDNODE: [n x mdnodes]
115 METADATA_KIND = 5, // [n x [id, name]]
116 METADATA_ATTACHMENT = 6 // [m x [value, [n x [id, mdnode]]]
114117 };
115118 // The constants block (CONSTANTS_BLOCK_ID) describes emission for each
116119 // constant and maintains an implicit current type value.
310310 /// MDKindID - This id identifies metadata kind the metadata store. Valid
311311 /// ID values are 1 or higher. This ID is set by RegisterMDKind.
312312 typedef unsigned MDKindID;
313
313314 class Metadata {
314315 public:
315316 typedef std::pair MDPairTy;
316317 typedef SmallVector MDMapTy;
317
318 typedef DenseMap MDStoreTy;
319 friend class BitcodeReader;
318320 private:
319 typedef DenseMap MDStoreTy;
320321
321322 /// MetadataStore - Collection of metadata used in this context.
322323 MDStoreTy MetadataStore;
343344 /// setMD - Attach the metadata of given kind with an Instruction.
344345 void setMD(MDKindID Kind, MDNode *Node, Instruction *Inst);
345346
347 /// getHandlerNames - Get handler names. This is used by bitcode
348 /// writer.
349 const StringMap *getHandlerNames();
350
346351 /// ValueIsDeleted - This handler is used to update metadata store
347352 /// when a value is deleted.
348353 void ValueIsDeleted(Value *V) {}
827827 Value *V = MDString::get(Context,
828828 StringRef(String.data(), String.size()));
829829 MDValueList.AssignValue(V, NextValueNo++);
830 break;
831 }
832 case bitc::METADATA_KIND: {
833 unsigned RecordLength = Record.size();
834 if (Record.empty() || RecordLength < 2)
835 return Error("Invalid METADATA_KIND record");
836 SmallString<8> Name;
837 Name.resize(RecordLength-1);
838 MDKindID Kind = Record[0];
839 for (unsigned i = 1; i != RecordLength; ++i)
840 Name[i-1] = Record[i];
841 Metadata &TheMetadata = Context.getMetadata();
842 assert(TheMetadata.MDHandlerNames.find(Name.str())
843 == TheMetadata.MDHandlerNames.end() &&
844 "Already registered MDKind!");
845 TheMetadata.MDHandlerNames[Name.str()] = Kind;
830846 break;
831847 }
832848 }
15341550 return false;
15351551 }
15361552
1553 /// ParseMetadataAttachment - Parse metadata attachments.
1554 bool BitcodeReader::ParseMetadataAttachment() {
1555 if (Stream.EnterSubBlock(bitc::METADATA_ATTACHMENT_ID))
1556 return Error("Malformed block record");
1557
1558 Metadata &TheMetadata = Context.getMetadata();
1559 SmallVector Record;
1560 while(1) {
1561 unsigned Code = Stream.ReadCode();
1562 if (Code == bitc::END_BLOCK) {
1563 if (Stream.ReadBlockEnd())
1564 return Error("Error at end of PARAMATTR block");
1565 break;
1566 }
1567 if (Code == bitc::DEFINE_ABBREV) {
1568 Stream.ReadAbbrevRecord();
1569 continue;
1570 }
1571 // Read a metadata attachment record.
1572 Record.clear();
1573 switch (Stream.ReadRecord(Code, Record)) {
1574 default: // Default behavior: ignore.
1575 break;
1576 case bitc::METADATA_ATTACHMENT: {
1577 unsigned RecordLength = Record.size();
1578 if (Record.empty() || (RecordLength - 1) % 2 == 1)
1579 return Error ("Invalid METADATA_ATTACHMENT reader!");
1580 Instruction *Inst = InstructionList[Record[0]];
1581 for (unsigned i = 1; i != RecordLength; i = i+2) {
1582 MDKindID Kind = Record[i];
1583 Value *Node = MDValueList.getValueFwdRef(Record[i+1]);
1584 TheMetadata.setMD(Kind, cast(Node), Inst);
1585 }
1586 break;
1587 }
1588 }
1589 }
1590 return false;
1591 }
15371592
15381593 /// ParseFunctionBody - Lazily parse the specified function body block.
15391594 bool BitcodeReader::ParseFunctionBody(Function *F) {
15731628 case bitc::VALUE_SYMTAB_BLOCK_ID:
15741629 if (ParseValueSymbolTable()) return true;
15751630 break;
1631 case bitc::METADATA_ATTACHMENT_ID:
1632 if (ParseMetadataAttachment()) return true;
1633 break;
15761634 }
15771635 continue;
15781636 }
16101668 int Opc = GetDecodedBinaryOpcode(Record[OpNum++], LHS->getType());
16111669 if (Opc == -1) return Error("Invalid BINOP record");
16121670 I = BinaryOperator::Create((Instruction::BinaryOps)Opc, LHS, RHS);
1671 InstructionList.push_back(I);
16131672 if (OpNum < Record.size()) {
16141673 if (Opc == Instruction::Add ||
16151674 Opc == Instruction::Sub ||
16371696 if (Opc == -1 || ResTy == 0)
16381697 return Error("Invalid CAST record");
16391698 I = CastInst::Create((Instruction::CastOps)Opc, Op, ResTy);
1699 InstructionList.push_back(I);
16401700 break;
16411701 }
16421702 case bitc::FUNC_CODE_INST_INBOUNDS_GEP:
16551715 }
16561716
16571717 I = GetElementPtrInst::Create(BasePtr, GEPIdx.begin(), GEPIdx.end());
1718 InstructionList.push_back(I);
16581719 if (BitCode == bitc::FUNC_CODE_INST_INBOUNDS_GEP)
16591720 cast(I)->setIsInBounds(true);
16601721 break;
16781739
16791740 I = ExtractValueInst::Create(Agg,
16801741 EXTRACTVALIdx.begin(), EXTRACTVALIdx.end());
1742 InstructionList.push_back(I);
16811743 break;
16821744 }
16831745
17021764
17031765 I = InsertValueInst::Create(Agg, Val,
17041766 INSERTVALIdx.begin(), INSERTVALIdx.end());
1767 InstructionList.push_back(I);
17051768 break;
17061769 }
17071770
17161779 return Error("Invalid SELECT record");
17171780
17181781 I = SelectInst::Create(Cond, TrueVal, FalseVal);
1782 InstructionList.push_back(I);
17191783 break;
17201784 }
17211785
17421806 }
17431807
17441808 I = SelectInst::Create(Cond, TrueVal, FalseVal);
1809 InstructionList.push_back(I);
17451810 break;
17461811 }
17471812
17521817 getValue(Record, OpNum, Type::getInt32Ty(Context), Idx))
17531818 return Error("Invalid EXTRACTELT record");
17541819 I = ExtractElementInst::Create(Vec, Idx);
1820 InstructionList.push_back(I);
17551821 break;
17561822 }
17571823
17641830 getValue(Record, OpNum, Type::getInt32Ty(Context), Idx))
17651831 return Error("Invalid INSERTELT record");
17661832 I = InsertElementInst::Create(Vec, Elt, Idx);
1833 InstructionList.push_back(I);
17671834 break;
17681835 }
17691836
17771844 if (getValueTypePair(Record, OpNum, NextValueNo, Mask))
17781845 return Error("Invalid SHUFFLEVEC record");
17791846 I = new ShuffleVectorInst(Vec1, Vec2, Mask);
1847 InstructionList.push_back(I);
17801848 break;
17811849 }
17821850
17981866 I = new FCmpInst((FCmpInst::Predicate)Record[OpNum], LHS, RHS);
17991867 else
18001868 I = new ICmpInst((ICmpInst::Predicate)Record[OpNum], LHS, RHS);
1869 InstructionList.push_back(I);
18011870 break;
18021871 }
18031872
18091878 getValueTypePair(Record, OpNum, NextValueNo, Op);
18101879 unsigned Index = Record[1];
18111880 I = ExtractValueInst::Create(Op, Index);
1881 InstructionList.push_back(I);
18121882 break;
18131883 }
18141884
18171887 unsigned Size = Record.size();
18181888 if (Size == 0) {
18191889 I = ReturnInst::Create(Context);
1890 InstructionList.push_back(I);
18201891 break;
18211892 }
18221893
18361907 Value *RV = UndefValue::get(ReturnType);
18371908 for (unsigned i = 0, e = Vs.size(); i != e; ++i) {
18381909 I = InsertValueInst::Create(RV, Vs[i], i, "mrv");
1910 InstructionList.push_back(I);
18391911 CurBB->getInstList().push_back(I);
18401912 ValueList.AssignValue(I, NextValueNo++);
18411913 RV = I;
18421914 }
18431915 I = ReturnInst::Create(Context, RV);
1916 InstructionList.push_back(I);
18441917 break;
18451918 }
18461919
18471920 I = ReturnInst::Create(Context, Vs[0]);
1921 InstructionList.push_back(I);
18481922 break;
18491923 }
18501924 case bitc::FUNC_CODE_INST_BR: { // BR: [bb#, bb#, opval] or [bb#]
18541928 if (TrueDest == 0)
18551929 return Error("Invalid BR record");
18561930
1857 if (Record.size() == 1)
1931 if (Record.size() == 1) {
18581932 I = BranchInst::Create(TrueDest);
1933 InstructionList.push_back(I);
1934 }
18591935 else {
18601936 BasicBlock *FalseDest = getBasicBlock(Record[1]);
18611937 Value *Cond = getFnValueByID(Record[2], Type::getInt1Ty(Context));
18621938 if (FalseDest == 0 || Cond == 0)
18631939 return Error("Invalid BR record");
18641940 I = BranchInst::Create(TrueDest, FalseDest, Cond);
1941 InstructionList.push_back(I);
18651942 }
18661943 break;
18671944 }
18751952 return Error("Invalid SWITCH record");
18761953 unsigned NumCases = (Record.size()-3)/2;
18771954 SwitchInst *SI = SwitchInst::Create(Cond, Default, NumCases);
1955 InstructionList.push_back(SI);
18781956 for (unsigned i = 0, e = NumCases; i != e; ++i) {
18791957 ConstantInt *CaseVal =
18801958 dyn_cast_or_null(getFnValueByID(Record[3+i*2], OpTy));
19322010
19332011 I = InvokeInst::Create(Callee, NormalBB, UnwindBB,
19342012 Ops.begin(), Ops.end());
2013 InstructionList.push_back(I);
19352014 cast(I)->setCallingConv(
19362015 static_cast(CCInfo));
19372016 cast(I)->setAttributes(PAL);
19392018 }
19402019 case bitc::FUNC_CODE_INST_UNWIND: // UNWIND
19412020 I = new UnwindInst(Context);
2021 InstructionList.push_back(I);
19422022 break;
19432023 case bitc::FUNC_CODE_INST_UNREACHABLE: // UNREACHABLE
19442024 I = new UnreachableInst(Context);
2025 InstructionList.push_back(I);
19452026 break;
19462027 case bitc::FUNC_CODE_INST_PHI: { // PHI: [ty, val0,bb0, ...]
19472028 if (Record.size() < 1 || ((Record.size()-1)&1))
19502031 if (!Ty) return Error("Invalid PHI record");
19512032
19522033 PHINode *PN = PHINode::Create(Ty);
2034 InstructionList.push_back(PN);
19532035 PN->reserveOperandSpace((Record.size()-1)/2);
19542036
19552037 for (unsigned i = 0, e = Record.size()-1; i != e; i += 2) {
19712053 unsigned Align = Record[2];
19722054 if (!Ty || !Size) return Error("Invalid MALLOC record");
19732055 I = new MallocInst(Ty->getElementType(), Size, (1 << Align) >> 1);
2056 InstructionList.push_back(I);
19742057 break;
19752058 }
19762059 case bitc::FUNC_CODE_INST_FREE: { // FREE: [op, opty]
19802063 OpNum != Record.size())
19812064 return Error("Invalid FREE record");
19822065 I = new FreeInst(Op);
2066 InstructionList.push_back(I);
19832067 break;
19842068 }
19852069 case bitc::FUNC_CODE_INST_ALLOCA: { // ALLOCA: [instty, op, align]
19912075 unsigned Align = Record[2];
19922076 if (!Ty || !Size) return Error("Invalid ALLOCA record");
19932077 I = new AllocaInst(Ty->getElementType(), Size, (1 << Align) >> 1);
2078 InstructionList.push_back(I);
19942079 break;
19952080 }
19962081 case bitc::FUNC_CODE_INST_LOAD: { // LOAD: [opty, op, align, vol]
20012086 return Error("Invalid LOAD record");
20022087
20032088 I = new LoadInst(Op, "", Record[OpNum+1], (1 << Record[OpNum]) >> 1);
2089 InstructionList.push_back(I);
20042090 break;
20052091 }
20062092 case bitc::FUNC_CODE_INST_STORE2: { // STORE2:[ptrty, ptr, val, align, vol]
20132099 return Error("Invalid STORE record");
20142100
20152101 I = new StoreInst(Val, Ptr, Record[OpNum+1], (1 << Record[OpNum]) >> 1);
2102 InstructionList.push_back(I);
20162103 break;
20172104 }
20182105 case bitc::FUNC_CODE_INST_STORE: { // STORE:[val, valty, ptr, align, vol]
20262113 return Error("Invalid STORE record");
20272114
20282115 I = new StoreInst(Val, Ptr, Record[OpNum+1], (1 << Record[OpNum]) >> 1);
2116 InstructionList.push_back(I);
20292117 break;
20302118 }
20312119 case bitc::FUNC_CODE_INST_CALL: {
20712159 }
20722160
20732161 I = CallInst::Create(Callee, Args.begin(), Args.end());
2162 InstructionList.push_back(I);
20742163 cast(I)->setCallingConv(
20752164 static_cast(CCInfo>>1));
20762165 cast(I)->setTailCall(CCInfo & 1);
20862175 if (!OpTy || !Op || !ResTy)
20872176 return Error("Invalid VAARG record");
20882177 I = new VAArgInst(Op, ResTy);
2178 InstructionList.push_back(I);
20892179 break;
20902180 }
20912181 }
131131 std::vector TypeList;
132132 BitcodeReaderValueList ValueList;
133133 BitcodeReaderMDValueList MDValueList;
134 SmallVector InstructionList;
135
134136 std::vector > GlobalInits;
135137 std::vector > AliasInits;
136138
249251 bool ParseFunctionBody(Function *F);
250252 bool ResolveGlobalAndAliasInits();
251253 bool ParseMetadata();
254 bool ParseMetadataAttachment();
252255 };
253256
254257 } // End llvm namespace
550550 }
551551
552552 if (StartedMetadataBlock)
553 Stream.ExitBlock();
553 Stream.ExitBlock();
554 }
555
556 static void WriteMetadataAttachment(const Function &F,
557 const ValueEnumerator &VE,
558 BitstreamWriter &Stream) {
559 bool StartedMetadataBlock = false;
560 SmallVector Record;
561
562 // Write metadata attachments
563 // METADATA_ATTACHMENT - [m x [value, [n x [id, mdnode]]]
564 Metadata &TheMetadata = F.getContext().getMetadata();
565 for (Function::const_iterator BB = F.begin(), E = F.end(); BB != E; ++BB)
566 for (BasicBlock::const_iterator I = BB->begin(), E = BB->end();
567 I != E; ++I) {
568 const Metadata::MDMapTy *P = TheMetadata.getMDs(I);
569 if (!P) continue;
570 bool RecordedInstruction = false;
571 for (Metadata::MDMapTy::const_iterator PI = P->begin(), PE = P->end();
572 PI != PE; ++PI) {
573 if (MDNode *ND = dyn_cast_or_null(PI->second)) {
574 if (RecordedInstruction == false) {
575 Record.push_back(VE.getInstructionID(I));
576 RecordedInstruction = true;
577 }
578 Record.push_back(PI->first);
579 Record.push_back(VE.getValueID(ND));
580 }
581 }
582 if (!StartedMetadataBlock) {
583 Stream.EnterSubblock(bitc::METADATA_ATTACHMENT_ID, 3);
584 StartedMetadataBlock = true;
585 }
586 Stream.EmitRecord(bitc::METADATA_ATTACHMENT, Record, 0);
587 Record.clear();
588 }
589
590 if (StartedMetadataBlock)
591 Stream.ExitBlock();
592 }
593
594 static void WriteModuleMetadataStore(const Module *M,
595 const ValueEnumerator &VE,
596 BitstreamWriter &Stream) {
597
598 bool StartedMetadataBlock = false;
599 SmallVector Record;
600
601 // Write metadata kinds
602 // METADATA_KIND - [n x [id, name]]
603 Metadata &TheMetadata = M->getContext().getMetadata();
604 const StringMap *Kinds = TheMetadata.getHandlerNames();
605 for (StringMap::const_iterator
606 I = Kinds->begin(), E = Kinds->end(); I != E; ++I) {
607 Record.push_back(I->second);
608 StringRef KName = I->first();
609 for (unsigned i = 0, e = KName.size(); i != e; ++i)
610 Record.push_back(KName[i]);
611 if (!StartedMetadataBlock) {
612 Stream.EnterSubblock(bitc::METADATA_BLOCK_ID, 3);
613 StartedMetadataBlock = true;
614 }
615 Stream.EmitRecord(bitc::METADATA_KIND, Record, 0);
616 Record.clear();
617 }
618
619 if (StartedMetadataBlock)
620 Stream.ExitBlock();
554621 }
555622
556623 static void WriteConstants(unsigned FirstVal, unsigned LastVal,
832899 SmallVector &Vals) {
833900 unsigned Code = 0;
834901 unsigned AbbrevToUse = 0;
902 VE.setInstructionID(&I);
835903 switch (I.getOpcode()) {
836904 default:
837905 if (Instruction::isCast(I.getOpcode())) {
11451213
11461214 // Emit names for all the instructions etc.
11471215 WriteValueSymbolTable(F.getValueSymbolTable(), VE, Stream);
1148
1216
1217 WriteMetadataAttachment(F, VE, Stream);
11491218 VE.purgeFunction();
11501219 Stream.ExitBlock();
11511220 }
13891458 for (Module::const_iterator I = M->begin(), E = M->end(); I != E; ++I)
13901459 if (!I->isDeclaration())
13911460 WriteFunction(*I, VE, Stream);
1461
1462 // Emit metadata.
1463 WriteModuleMetadataStore(M, VE, Stream);
13921464
13931465 // Emit the type symbol table information.
13941466 WriteTypeSymbolTable(M->getTypeSymbolTable(), VE, Stream);
3939
4040 /// ValueEnumerator - Enumerate module-level information.
4141 ValueEnumerator::ValueEnumerator(const Module *M) {
42 InstructionCount = 0;
43
4244 // Enumerate the global variables.
4345 for (Module::const_global_iterator I = M->global_begin(),
4446 E = M->global_end(); I != E; ++I)
8284 for (Function::const_arg_iterator I = F->arg_begin(), E = F->arg_end();
8385 I != E; ++I)
8486 EnumerateType(I->getType());
85
87
88 Metadata &TheMetadata = F->getContext().getMetadata();
8689 for (Function::const_iterator BB = F->begin(), E = F->end(); BB != E; ++BB)
8790 for (BasicBlock::const_iterator I = BB->begin(), E = BB->end(); I!=E;++I){
8891 for (User::const_op_iterator OI = I->op_begin(), E = I->op_end();
9396 EnumerateAttributes(CI->getAttributes());
9497 else if (const InvokeInst *II = dyn_cast(I))
9598 EnumerateAttributes(II->getAttributes());
99
100 // Enumerate metadata attached with this instruction.
101 const Metadata::MDMapTy *MDs = TheMetadata.getMDs(I);
102 if (MDs)
103 for (Metadata::MDMapTy::const_iterator MI = MDs->begin(),
104 ME = MDs->end(); MI != ME; ++MI)
105 if (MDNode *MDN = dyn_cast_or_null(MI->second))
106 EnumerateMetadata(MDN);
96107 }
97108 }
98109
111122 // Now that we rearranged the type table, rebuild TypeMap.
112123 for (unsigned i = 0, e = Types.size(); i != e; ++i)
113124 TypeMap[Types[i].first] = i+1;
125 }
126
127 unsigned ValueEnumerator::getInstructionID(const Instruction *Inst) const {
128 InstructionMapType::const_iterator I = InstructionMap.find(Inst);
129 assert (I != InstructionMap.end() && "Instruction is not mapped!");
130 return I->second;
131 }
132
133 void ValueEnumerator::setInstructionID(const Instruction *I) {
134 InstructionMap[I] = InstructionCount++;
114135 }
115136
116137 unsigned ValueEnumerator::getValueID(const Value *V) const {
2121
2222 class Type;
2323 class Value;
24 class Instruction;
2425 class BasicBlock;
2526 class Function;
2627 class Module;
4647 ValueList Values;
4748 ValueList MDValues;
4849 ValueMapType MDValueMap;
49
50
5051 typedef DenseMap AttributeMapType;
5152 AttributeMapType AttributeMap;
5253 std::vector Attributes;
5354
55 typedef DenseMap InstructionMapType;
56 InstructionMapType InstructionMap;
57 unsigned InstructionCount;
58
5459 /// BasicBlocks - This contains all the basic blocks for the currently
5560 /// incorporated function. Their reverse mapping is stored in ValueMap.
5661 std::vector BasicBlocks;
7378 assert(I != TypeMap.end() && "Type not in ValueEnumerator!");
7479 return I->second-1;
7580 }
76
81
82 unsigned getInstructionID(const Instruction *I) const;
83 void setInstructionID(const Instruction *I);
84
7785 unsigned getAttributeID(const AttrListPtr &PAL) const {
7886 if (PAL.isEmpty()) return 0; // Null maps to zero.
7987 AttributeMapType::const_iterator I = AttributeMap.find(PAL.getRawPointer());
316316 return &(I->second);
317317 }
318318
319 /// getHandlerNames - Get handler names. This is used by bitcode
320 /// writer.
321 const StringMap *Metadata::getHandlerNames() {
322 return &MDHandlerNames;
323 }
324
319325 /// ValueIsDeleted - This handler is used to update metadata store
320326 /// when a value is deleted.
321327 void Metadata::ValueIsDeleted(const Instruction *Inst) {
0 ; RUN: llvm-as < %s | llvm-dis | grep " dbg " | count 4
1 define i32 @foo() nounwind ssp {
2 entry:
3 %retval = alloca i32 ; [#uses=2]
4 call void @llvm.dbg.func.start(metadata !0)
5 store i32 42, i32* %retval, dbg !3
6 br label %0, dbg !3
7
8 ;
9 call void @llvm.dbg.region.end(metadata !0)
10 %1 = load i32* %retval, dbg !3 ; [#uses=1]
11 ret i32 %1, dbg !3
12 }
13
14 declare void @llvm.dbg.func.start(metadata) nounwind readnone
15
16 declare void @llvm.dbg.region.end(metadata) nounwind readnone
17
18 !0 = metadata !{i32 458798, i32 0, metadata !1, metadata !"foo", metadata !"foo", metadata !"foo", metadata !1, i32 1, metadata !2, i1 false, i1 true}
19 !1 = metadata !{i32 458769, i32 0, i32 12, metadata !"foo.c", metadata !"/tmp", metadata !"clang 1.0", i1 true, i1 false, metadata !"", i32 0}
20 !2 = metadata !{i32 458788, metadata !1, metadata !"int", metadata !1, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5}
21 !3 = metadata !{i32 1, i32 13, metadata !1, metadata !1}
9191 if (CurStreamType != LLVMIRBitstream) return 0;
9292
9393 switch (BlockID) {
94 default: return 0;
95 case bitc::MODULE_BLOCK_ID: return "MODULE_BLOCK";
96 case bitc::PARAMATTR_BLOCK_ID: return "PARAMATTR_BLOCK";
97 case bitc::TYPE_BLOCK_ID: return "TYPE_BLOCK";
98 case bitc::CONSTANTS_BLOCK_ID: return "CONSTANTS_BLOCK";
99 case bitc::FUNCTION_BLOCK_ID: return "FUNCTION_BLOCK";
100 case bitc::TYPE_SYMTAB_BLOCK_ID: return "TYPE_SYMTAB";
101 case bitc::VALUE_SYMTAB_BLOCK_ID: return "VALUE_SYMTAB";
102 case bitc::METADATA_BLOCK_ID: return "METADATA_BLOCK";
94 default: return 0;
95 case bitc::MODULE_BLOCK_ID: return "MODULE_BLOCK";
96 case bitc::PARAMATTR_BLOCK_ID: return "PARAMATTR_BLOCK";
97 case bitc::TYPE_BLOCK_ID: return "TYPE_BLOCK";
98 case bitc::CONSTANTS_BLOCK_ID: return "CONSTANTS_BLOCK";
99 case bitc::FUNCTION_BLOCK_ID: return "FUNCTION_BLOCK";
100 case bitc::TYPE_SYMTAB_BLOCK_ID: return "TYPE_SYMTAB";
101 case bitc::VALUE_SYMTAB_BLOCK_ID: return "VALUE_SYMTAB";
102 case bitc::METADATA_BLOCK_ID: return "METADATA_BLOCK";
103 case bitc::METADATA_ATTACHMENT_ID: return "METADATA_ATTACHMENT_BLOCK";
103104 }
104105 }
105106
244245 case bitc::VST_CODE_ENTRY: return "ENTRY";
245246 case bitc::VST_CODE_BBENTRY: return "BBENTRY";
246247 }
248 case bitc::METADATA_ATTACHMENT_ID:
249 switch(CodeID) {
250 default:return 0;
251 case bitc::METADATA_ATTACHMENT: return "METADATA_ATTACHMENT";
252 }
247253 case bitc::METADATA_BLOCK_ID:
248254 switch(CodeID) {
249255 default:return 0;
251257 case bitc::METADATA_NODE: return "MDNODE";
252258 case bitc::METADATA_NAME: return "METADATA_NAME";
253259 case bitc::METADATA_NAMED_NODE: return "NAMEDMDNODE";
260 case bitc::METADATA_KIND: return "METADATA_KIND";
254261 }
255262 }
256263 }