[PATCH] Replace the bitfield of SubtargetFeatures with a BitVector

Michael Kuperstein michael.m.kuperstein at intel.com
Tue Jan 20 01:01:37 PST 2015


Hi chandlerc,

SubtargetFeatures uses a uint64_t bitfield to store the SubtargetFeatures of each target. 
Unfortunately, at least for x86, we've run out of bits.

Per Chandler's suggestion, I tried to convert this into a BitVector, but I'm not sure it makes sense, especially from a compile-time standpoint. 
One potential problem is the look-up times.
The other is that the existing uint64_t is being passed by value into all sorts of places. One issue with replacing it with a BitVector is minimizing the number of copies. The other is that some odd things are done with it, like shoving it into a union. I replaced that particular case with a pointer to a BitVector (which should stay alive for the duration), but I'm not sure how safe that is.

Does this look like something we can do? If not, any other suggestions?

Note that the patch itself needs quite a lot of cleanup, among other things because of stuff missing in the BitVector interface (e.g. everything that uses .flip() right now). If there is consensus that this is sane, I'll clean it up and post a new version for review. There's also the bit with having to pass the size of the vector as part of the initializer list, which I would rather avoid, but I don't really see how.

(The patch is fairly large, but a lot of is trivial changes - replacing "getFeatureBits() & X" with "getFeaturesBits()[X]")

http://reviews.llvm.org/D7065

Files:
  include/llvm/ADT/BitVector.h
  include/llvm/MC/MCInstPrinter.h
  include/llvm/MC/MCInstrDesc.h
  include/llvm/MC/MCSubtargetInfo.h
  include/llvm/MC/SubtargetFeature.h
  lib/MC/MCSubtargetInfo.cpp
  lib/MC/SubtargetFeature.cpp
  lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
  lib/Target/AArch64/InstPrinter/AArch64InstPrinter.cpp
  lib/Target/AArch64/Utils/AArch64BaseInfo.cpp
  lib/Target/AArch64/Utils/AArch64BaseInfo.h
  lib/Target/ARM/ARMAsmPrinter.cpp
  lib/Target/ARM/ARMBaseInstrInfo.cpp
  lib/Target/ARM/ARMSubtarget.cpp
  lib/Target/ARM/AsmParser/ARMAsmParser.cpp
  lib/Target/ARM/Disassembler/ARMDisassembler.cpp
  lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp
  lib/Target/ARM/MCTargetDesc/ARMAsmBackend.h
  lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp
  lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp
  lib/Target/Mips/AsmParser/MipsAsmParser.cpp
  lib/Target/Mips/Disassembler/MipsDisassembler.cpp
  lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp
  lib/Target/Mips/MCTargetDesc/MipsOptionRecord.cpp
  lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp
  lib/Target/Mips/MipsSubtarget.cpp
  lib/Target/Mips/MipsTargetStreamer.h
  lib/Target/R600/MCTargetDesc/AMDGPUMCTargetDesc.cpp
  lib/Target/R600/MCTargetDesc/R600MCCodeEmitter.cpp
  lib/Target/Sparc/InstPrinter/SparcInstPrinter.cpp
  lib/Target/X86/AsmParser/X86AsmInstrumentation.cpp
  lib/Target/X86/AsmParser/X86AsmParser.cpp
  lib/Target/X86/Disassembler/X86Disassembler.cpp
  lib/Target/X86/InstPrinter/X86ATTInstPrinter.cpp
  lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp
  utils/TableGen/AsmMatcherEmitter.cpp
  utils/TableGen/FixedLenDecoderEmitter.cpp
  utils/TableGen/InstrInfoEmitter.cpp
  utils/TableGen/SubtargetEmitter.cpp

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7065.18419.patch
Type: text/x-patch
Size: 75974 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150120/9c4b1547/attachment.bin>


More information about the llvm-commits mailing list