OLD | NEW |
1 //===--- Bitcode/Writer/BitcodeWriter.cpp - Bitcode Writer ----------------===// | 1 //===--- Bitcode/Writer/BitcodeWriter.cpp - Bitcode Writer ----------------===// |
2 // | 2 // |
3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // Bitcode writer implementation. | 10 // Bitcode writer implementation. |
(...skipping 1587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1598 // Emit top-level description of module, including target triple, inline asm, | 1598 // Emit top-level description of module, including target triple, inline asm, |
1599 // descriptors for global variables, and function prototype info. | 1599 // descriptors for global variables, and function prototype info. |
1600 WriteModuleInfo(M, VE, Stream); | 1600 WriteModuleInfo(M, VE, Stream); |
1601 | 1601 |
1602 // Emit constants. | 1602 // Emit constants. |
1603 WriteModuleConstants(VE, Stream); | 1603 WriteModuleConstants(VE, Stream); |
1604 | 1604 |
1605 // Emit metadata. | 1605 // Emit metadata. |
1606 WriteModuleMetadata(M, VE, Stream); | 1606 WriteModuleMetadata(M, VE, Stream); |
1607 | 1607 |
1608 // Emit function bodies. | |
1609 for (Module::const_iterator F = M->begin(), E = M->end(); F != E; ++F) | |
1610 if (!F->isDeclaration()) | |
1611 WriteFunction(*F, VE, Stream); | |
1612 | |
1613 // Emit metadata. | 1608 // Emit metadata. |
1614 WriteModuleMetadataStore(M, Stream); | 1609 WriteModuleMetadataStore(M, Stream); |
1615 | 1610 |
1616 // Emit names for globals/functions etc. | 1611 // Emit names for globals/functions etc. |
1617 WriteValueSymbolTable(M->getValueSymbolTable(), VE, Stream); | 1612 WriteValueSymbolTable(M->getValueSymbolTable(), VE, Stream); |
1618 | 1613 |
| 1614 // Emit function bodies. |
| 1615 for (Module::const_iterator F = M->begin(), E = M->end(); F != E; ++F) |
| 1616 if (!F->isDeclaration()) |
| 1617 WriteFunction(*F, VE, Stream); |
| 1618 |
1619 Stream.ExitBlock(); | 1619 Stream.ExitBlock(); |
1620 } | 1620 } |
1621 | 1621 |
1622 /// EmitDarwinBCHeader - If generating a bc file on darwin, we have to emit a | 1622 /// EmitDarwinBCHeader - If generating a bc file on darwin, we have to emit a |
1623 /// header and trailer to make it compatible with the system archiver. To do | 1623 /// header and trailer to make it compatible with the system archiver. To do |
1624 /// this we emit the following header, and then emit a trailer that pads the | 1624 /// this we emit the following header, and then emit a trailer that pads the |
1625 /// file out to be a multiple of 16 bytes. | 1625 /// file out to be a multiple of 16 bytes. |
1626 /// | 1626 /// |
1627 /// struct bc_header { | 1627 /// struct bc_header { |
1628 /// uint32_t Magic; // 0x0B17C0DE | 1628 /// uint32_t Magic; // 0x0B17C0DE |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1717 Stream.Emit(0xC, 4); | 1717 Stream.Emit(0xC, 4); |
1718 Stream.Emit(0xE, 4); | 1718 Stream.Emit(0xE, 4); |
1719 Stream.Emit(0xD, 4); | 1719 Stream.Emit(0xD, 4); |
1720 | 1720 |
1721 // Emit the module. | 1721 // Emit the module. |
1722 WriteModule(M, Stream); | 1722 WriteModule(M, Stream); |
1723 | 1723 |
1724 if (TT.isOSDarwin()) | 1724 if (TT.isOSDarwin()) |
1725 EmitDarwinBCTrailer(Stream, Stream.getBuffer().size()); | 1725 EmitDarwinBCTrailer(Stream, Stream.getBuffer().size()); |
1726 } | 1726 } |
OLD | NEW |