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 1589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1600 // Emit top-level description of module, including target triple, inline asm, | 1600 // Emit top-level description of module, including target triple, inline asm, |
1601 // descriptors for global variables, and function prototype info. | 1601 // descriptors for global variables, and function prototype info. |
1602 WriteModuleInfo(M, VE, Stream); | 1602 WriteModuleInfo(M, VE, Stream); |
1603 | 1603 |
1604 // Emit constants. | 1604 // Emit constants. |
1605 WriteModuleConstants(VE, Stream); | 1605 WriteModuleConstants(VE, Stream); |
1606 | 1606 |
1607 // Emit metadata. | 1607 // Emit metadata. |
1608 WriteModuleMetadata(M, VE, Stream); | 1608 WriteModuleMetadata(M, VE, Stream); |
1609 | 1609 |
1610 // Emit function bodies. | |
1611 for (Module::const_iterator F = M->begin(), E = M->end(); F != E; ++F) | |
1612 if (!F->isDeclaration()) | |
1613 WriteFunction(*F, VE, Stream); | |
1614 | |
1615 // Emit metadata. | 1610 // Emit metadata. |
1616 WriteModuleMetadataStore(M, Stream); | 1611 WriteModuleMetadataStore(M, Stream); |
1617 | 1612 |
1618 // Emit names for globals/functions etc. | 1613 // Emit names for globals/functions etc. |
1619 WriteValueSymbolTable(M->getValueSymbolTable(), VE, Stream); | 1614 WriteValueSymbolTable(M->getValueSymbolTable(), VE, Stream); |
1620 | 1615 |
| 1616 // Emit function bodies. |
| 1617 for (Module::const_iterator F = M->begin(), E = M->end(); F != E; ++F) |
| 1618 if (!F->isDeclaration()) |
| 1619 WriteFunction(*F, VE, Stream); |
| 1620 |
1621 Stream.ExitBlock(); | 1621 Stream.ExitBlock(); |
1622 } | 1622 } |
1623 | 1623 |
1624 /// EmitDarwinBCHeader - If generating a bc file on darwin, we have to emit a | 1624 /// EmitDarwinBCHeader - If generating a bc file on darwin, we have to emit a |
1625 /// header and trailer to make it compatible with the system archiver. To do | 1625 /// header and trailer to make it compatible with the system archiver. To do |
1626 /// this we emit the following header, and then emit a trailer that pads the | 1626 /// this we emit the following header, and then emit a trailer that pads the |
1627 /// file out to be a multiple of 16 bytes. | 1627 /// file out to be a multiple of 16 bytes. |
1628 /// | 1628 /// |
1629 /// struct bc_header { | 1629 /// struct bc_header { |
1630 /// uint32_t Magic; // 0x0B17C0DE | 1630 /// uint32_t Magic; // 0x0B17C0DE |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1719 Stream.Emit(0xC, 4); | 1719 Stream.Emit(0xC, 4); |
1720 Stream.Emit(0xE, 4); | 1720 Stream.Emit(0xE, 4); |
1721 Stream.Emit(0xD, 4); | 1721 Stream.Emit(0xD, 4); |
1722 | 1722 |
1723 // Emit the module. | 1723 // Emit the module. |
1724 WriteModule(M, Stream); | 1724 WriteModule(M, Stream); |
1725 | 1725 |
1726 if (TT.isOSDarwin()) | 1726 if (TT.isOSDarwin()) |
1727 EmitDarwinBCTrailer(Stream, Stream.getBuffer().size()); | 1727 EmitDarwinBCTrailer(Stream, Stream.getBuffer().size()); |
1728 } | 1728 } |
OLD | NEW |