mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-12 01:25:10 +00:00
Begin adding experimental support for preserving use-list ordering of bitcode
files. First, add a new block USELIST_BLOCK to the bitcode format. This is where USELIST_CODE_ENTRYs will be stored. The format of the USELIST_CODE_ENTRYs have not yet been defined. Add support in the BitcodeReader for parsing the USELIST_BLOCK. Part of rdar://9860654 and PR5680. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146078 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
#include "llvm/Operator.h"
|
||||
#include "llvm/ValueSymbolTable.h"
|
||||
#include "llvm/ADT/Triple.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
@@ -31,6 +32,12 @@
|
||||
#include <map>
|
||||
using namespace llvm;
|
||||
|
||||
static cl::opt<bool>
|
||||
EnablePreserveUseListOrdering("enable-bc-uselist-preserve",
|
||||
cl::desc("Turn on experimental support for "
|
||||
"use-list order preservation."),
|
||||
cl::init(false), cl::Hidden);
|
||||
|
||||
/// These are manifest constants used by the bitcode writer. They do not need to
|
||||
/// be kept in sync with the reader, but need to be consistent within this file.
|
||||
enum {
|
||||
@@ -1571,6 +1578,20 @@ static void WriteBlockInfo(const ValueEnumerator &VE, BitstreamWriter &Stream) {
|
||||
Stream.ExitBlock();
|
||||
}
|
||||
|
||||
// Emit use-lists.
|
||||
static void WriteModuleUseLists(const Module *M, ValueEnumerator &VE,
|
||||
BitstreamWriter &Stream) {
|
||||
Stream.EnterSubblock(bitc::USELIST_BLOCK_ID, 3);
|
||||
|
||||
// Emit a bogus record for testing purposes.
|
||||
SmallVector<uint64_t, 64> Record;
|
||||
Record.push_back(0);
|
||||
Stream.EmitRecord(bitc::USELIST_CODE_ENTRY, Record);
|
||||
|
||||
// TODO: Tons.
|
||||
|
||||
Stream.ExitBlock();
|
||||
}
|
||||
|
||||
/// WriteModule - Emit the specified module to the bitstream.
|
||||
static void WriteModule(const Module *M, BitstreamWriter &Stream) {
|
||||
@@ -1616,6 +1637,10 @@ static void WriteModule(const Module *M, BitstreamWriter &Stream) {
|
||||
// Emit names for globals/functions etc.
|
||||
WriteValueSymbolTable(M->getValueSymbolTable(), VE, Stream);
|
||||
|
||||
// Emit use-lists.
|
||||
if (EnablePreserveUseListOrdering)
|
||||
WriteModuleUseLists(M, VE, Stream);
|
||||
|
||||
Stream.ExitBlock();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user