diff options
author | Mark Seaborn <mseaborn@chromium.org> | 2013-06-21 11:34:16 -0700 |
---|---|---|
committer | Mark Seaborn <mseaborn@chromium.org> | 2013-06-21 11:34:16 -0700 |
commit | 222873819b08b3758f82bc2f432a99dcd76397de (patch) | |
tree | ecc203076dba68796eed8856145276b05bd1a339 /lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp | |
parent | c51cdee071a24059cc510297a3a6ad4cf5c8f4fa (diff) |
PNaCl wire format: Remove function attributes from pexe reader/writer
Remove support for reading and writing the PARAMATTR_BLOCK_ID and
PARAMATTR_GROUP_BLOCK_ID blocks.
These blocks will no longer be written into pexes. While PNaCl
doesn't allow function attributes on normal functions,
Function::Create() always inserts them back on intrinsics, so
previously the PARAMATTR blocks were being written into pexes.
Remove paramattr fields from two record types:
* MODULE_CODE_FUNCTION records (function declarations). Also remove
the fields that follow paramattr, which PNaCl also does not use.
* FUNC_CODE_INST_CALL (function calls).
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3506
TEST=PNaCl toolchain trybots + GCC torture tests + Spec2k
Review URL: https://codereview.chromium.org/17419013
Diffstat (limited to 'lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp')
-rw-r--r-- | lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp | 88 |
1 files changed, 1 insertions, 87 deletions
diff --git a/lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp b/lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp index 4295c6caf0..3fa90f88a0 100644 --- a/lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp +++ b/lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp @@ -205,78 +205,6 @@ static void WriteStringRecord(unsigned Code, StringRef Str, Stream.EmitRecord(Code, Vals, AbbrevToUse); } -static void WriteAttributeGroupTable(const NaClValueEnumerator &VE, - NaClBitstreamWriter &Stream) { - const std::vector<AttributeSet> &AttrGrps = VE.getAttributeGroups(); - if (AttrGrps.empty()) return; - DEBUG(dbgs() << "-> WriteAbbributeGroupTable\n"); - - Stream.EnterSubblock(naclbitc::PARAMATTR_GROUP_BLOCK_ID); - - SmallVector<uint64_t, 64> Record; - for (unsigned i = 0, e = AttrGrps.size(); i != e; ++i) { - AttributeSet AS = AttrGrps[i]; - for (unsigned i = 0, e = AS.getNumSlots(); i != e; ++i) { - AttributeSet A = AS.getSlotAttributes(i); - - Record.push_back(VE.getAttributeGroupID(A)); - Record.push_back(AS.getSlotIndex(i)); - - for (AttributeSet::iterator I = AS.begin(0), E = AS.end(0); - I != E; ++I) { - Attribute Attr = *I; - if (Attr.isEnumAttribute()) { - Record.push_back(0); - Record.push_back(Attr.getKindAsEnum()); - } else if (Attr.isAlignAttribute()) { - Record.push_back(1); - Record.push_back(Attr.getKindAsEnum()); - Record.push_back(Attr.getValueAsInt()); - } else { - StringRef Kind = Attr.getKindAsString(); - StringRef Val = Attr.getValueAsString(); - - Record.push_back(Val.empty() ? 3 : 4); - Record.append(Kind.begin(), Kind.end()); - Record.push_back(0); - if (!Val.empty()) { - Record.append(Val.begin(), Val.end()); - Record.push_back(0); - } - } - } - - Stream.EmitRecord(naclbitc::PARAMATTR_GRP_CODE_ENTRY, Record); - Record.clear(); - } - } - - Stream.ExitBlock(); - DEBUG(dbgs() << "<- WriteAbbributeGroupTable\n"); -} - -static void WriteAttributeTable(const NaClValueEnumerator &VE, - NaClBitstreamWriter &Stream) { - const std::vector<AttributeSet> &Attrs = VE.getAttributes(); - if (Attrs.empty()) return; - DEBUG(dbgs() << "-> WriteAttributeTable\n"); - - Stream.EnterSubblock(naclbitc::PARAMATTR_BLOCK_ID); - - SmallVector<uint64_t, 64> Record; - for (unsigned i = 0, e = Attrs.size(); i != e; ++i) { - const AttributeSet &A = Attrs[i]; - for (unsigned i = 0, e = A.getNumSlots(); i != e; ++i) - Record.push_back(VE.getAttributeGroupID(A.getSlotAttributes(i))); - - Stream.EmitRecord(naclbitc::PARAMATTR_CODE_ENTRY, Record); - Record.clear(); - } - - Stream.ExitBlock(); - DEBUG(dbgs() << "<- WriteAttributeTable\n"); -} - /// WriteTypeTable - Write out the type table for a module. static void WriteTypeTable(const NaClValueEnumerator &VE, NaClBitstreamWriter &Stream) { @@ -615,18 +543,11 @@ static void WriteModuleInfo(const Module *M, const NaClValueEnumerator &VE, // Emit the function proto information. for (Module::const_iterator F = M->begin(), E = M->end(); F != E; ++F) { - // FUNCTION: [type, callingconv, isproto, linkage, paramattrs, alignment, - // section, visibility, gc, unnamed_addr] + // FUNCTION: [type, callingconv, isproto, linkage] Vals.push_back(VE.getTypeID(F->getType())); Vals.push_back(GetEncodedCallingConv(F->getCallingConv())); Vals.push_back(F->isDeclaration()); Vals.push_back(getEncodedLinkage(F)); - Vals.push_back(VE.getAttributeID(F->getAttributes())); - Vals.push_back(Log2_32(F->getAlignment())+1); - Vals.push_back(F->hasSection() ? SectionMap[F->getSection()] : 0); - Vals.push_back(getEncodedVisibility(F)); - Vals.push_back(F->hasGC() ? GCMap[F->getGC()] : 0); - Vals.push_back(F->hasUnnamedAddr()); unsigned AbbrevToUse = 0; Stream.EmitRecord(naclbitc::MODULE_CODE_FUNCTION, Vals, AbbrevToUse); @@ -1501,7 +1422,6 @@ static void WriteInstruction(const Instruction &I, unsigned InstID, Code = naclbitc::FUNC_CODE_INST_CALL; - Vals.push_back(VE.getAttributeID(CI.getAttributes())); Vals.push_back((GetEncodedCallingConv(CI.getCallingConv()) << 1) | unsigned(CI.isTailCall())); PushValueAndType(CI.getCalledValue(), InstID, Vals, VE); // Callee @@ -1857,12 +1777,6 @@ static void WriteModule(const Module *M, NaClBitstreamWriter &Stream) { // Emit blockinfo, which defines the standard abbreviations etc. WriteBlockInfo(VE, Stream); - // Emit information about attribute groups. - WriteAttributeGroupTable(VE, Stream); - - // Emit information about parameter attributes. - WriteAttributeTable(VE, Stream); - // Emit information describing all of the types in the module. WriteTypeTable(VE, Stream); |