[PATCH] D26969: [ARM] Emit the missing Tag_ABI_enum_size build attribute values

James Molloy via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 22 05:59:33 PST 2016


jmolloy requested changes to this revision.
jmolloy added a reviewer: jmolloy.
jmolloy added a comment.
This revision now requires changes to proceed.

Other than my inline comment this looks good!



================
Comment at: lib/Target/ARM/ARMAsmPrinter.cpp:907
 
-      // ABI_enum_size to indicate enum width
-      // FIXME: There is no way to emit value 0 (enums prohibited) or value 3
-      //        (all enums contain a value needing 32 bits to encode).
-      if (auto EnumWidthValue = mdconst::extract_or_null<ConstantInt>(
-              SourceModule->getModuleFlag("min_enum_size"))) {
-        int EnumWidth = EnumWidthValue->getZExtValue();
-        assert((EnumWidth == 1 || EnumWidth == 4) &&
-               "Minimum enum width must be 1 or 4 bytes");
-        int EnumBuildAttr = EnumWidth == 1 ? 1 : 2;
-        ATS.emitAttribute(ARMBuildAttrs::ABI_enum_size, EnumBuildAttr);
+      // Generate the correct Tag_ABI_enum_size build attribute.
+      if (auto BuildAttrValue = mdconst::extract_or_null<ConstantInt>(
----------------
My feeling here is that we need to maintain support for the min_enum_size metadata for a while. Our bitcode policy is that it should auto-upgrade for 2 releases.

I'm aware that metadata is normally excluded from this, but this particular metadata, if omitted, will cause link failures. So I think a fallback is needed.


https://reviews.llvm.org/D26969





More information about the llvm-commits mailing list