diff options
author | Mark Seaborn <mseaborn@chromium.org> | 2013-08-29 12:34:39 -0700 |
---|---|---|
committer | Mark Seaborn <mseaborn@chromium.org> | 2013-08-29 12:34:39 -0700 |
commit | a6bf06e32a23367bbc5b4029fa1c973d335683df (patch) | |
tree | f6bbaa00e5050e8d46a5c957f5dbe9c29c70c856 /lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp | |
parent | 013bcfcfcd04a3469429771e80997c02fdd03501 (diff) |
PNaCl bitcode: Remove handling of named struct types
Named struct types should not appear in LLVM IR that passes the PNaCl
ABI verifier.
Remove the test struct-types.ll because it no longer passes.
Handling of TYPE_CODE_STRUCT_ANON must remain for now until this issue
is fixed: https://code.google.com/p/nativeclient/issues/detail?id=3648
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3590
TEST=PNaCl toolchain trybots
Review URL: https://codereview.chromium.org/23490018
Diffstat (limited to 'lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp')
-rw-r--r-- | lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp | 47 |
1 files changed, 1 insertions, 46 deletions
diff --git a/lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp b/lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp index d4f7c51749..41a2501266 100644 --- a/lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp +++ b/lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp @@ -95,8 +95,6 @@ enum { TYPE_POINTER_ABBREV = naclbitc::FIRST_APPLICATION_ABBREV, TYPE_FUNCTION_ABBREV, TYPE_STRUCT_ANON_ABBREV, - TYPE_STRUCT_NAME_ABBREV, - TYPE_STRUCT_NAMED_ABBREV, TYPE_ARRAY_ABBREV, TYPE_MAX_ABBREV = TYPE_ARRAY_ABBREV }; @@ -163,22 +161,6 @@ static unsigned GetEncodedCallingConv(CallingConv::ID conv) { } } -static void WriteStringRecord(unsigned Code, StringRef Str, - unsigned AbbrevToUse, - NaClBitstreamWriter &Stream) { - SmallVector<unsigned, 64> Vals; - - // Code: [strchar x N] - for (unsigned i = 0, e = Str.size(); i != e; ++i) { - if (AbbrevToUse && !NaClBitCodeAbbrevOp::isChar6(Str[i])) - AbbrevToUse = 0; - Vals.push_back(Str[i]); - } - - // Emit the finished record. - Stream.EmitRecord(Code, Vals, AbbrevToUse); -} - /// WriteTypeTable - Write out the type table for a module. static void WriteTypeTable(const NaClValueEnumerator &VE, NaClBitstreamWriter &Stream) { @@ -228,23 +210,6 @@ static void WriteTypeTable(const NaClValueEnumerator &VE, if (TYPE_STRUCT_ANON_ABBREV != Stream.EmitAbbrev(Abbv)) llvm_unreachable("Unexpected abbrev ordering!"); - // Abbrev for TYPE_CODE_STRUCT_NAME. - Abbv = new NaClBitCodeAbbrev(); - Abbv->Add(NaClBitCodeAbbrevOp(naclbitc::TYPE_CODE_STRUCT_NAME)); - Abbv->Add(NaClBitCodeAbbrevOp(NaClBitCodeAbbrevOp::Array)); - Abbv->Add(NaClBitCodeAbbrevOp(NaClBitCodeAbbrevOp::Char6)); - if (TYPE_STRUCT_NAME_ABBREV != Stream.EmitAbbrev(Abbv)) - llvm_unreachable("Unexpected abbrev ordering!"); - - // Abbrev for TYPE_CODE_STRUCT_NAMED. - Abbv = new NaClBitCodeAbbrev(); - Abbv->Add(NaClBitCodeAbbrevOp(naclbitc::TYPE_CODE_STRUCT_NAMED)); - Abbv->Add(NaClBitCodeAbbrevOp(NaClBitCodeAbbrevOp::Fixed, 1)); // ispacked - Abbv->Add(NaClBitCodeAbbrevOp(NaClBitCodeAbbrevOp::Array)); - Abbv->Add(NaClBitCodeAbbrevOp(NaClBitCodeAbbrevOp::Fixed, NumBits)); - if (TYPE_STRUCT_NAMED_ABBREV != Stream.EmitAbbrev(Abbv)) - llvm_unreachable("Unexpected abbrev ordering!"); - // Abbrev for TYPE_CODE_ARRAY. Abbv = new NaClBitCodeAbbrev(); Abbv->Add(NaClBitCodeAbbrevOp(naclbitc::TYPE_CODE_ARRAY)); @@ -309,17 +274,7 @@ static void WriteTypeTable(const NaClValueEnumerator &VE, Code = naclbitc::TYPE_CODE_STRUCT_ANON; AbbrevToUse = TYPE_STRUCT_ANON_ABBREV; } else { - if (ST->isOpaque()) { - report_fatal_error("Opaque structs not supported in PNaCl bitcode"); - } else { - Code = naclbitc::TYPE_CODE_STRUCT_NAMED; - AbbrevToUse = TYPE_STRUCT_NAMED_ABBREV; - } - - // Emit the name if it is present. - if (!ST->getName().empty()) - WriteStringRecord(naclbitc::TYPE_CODE_STRUCT_NAME, ST->getName(), - TYPE_STRUCT_NAME_ABBREV, Stream); + report_fatal_error("Non-anon structs not supported in PNaCl bitcode"); } break; } |