[llvm-dev] How to find out the default CPU / Features String for a given triple?

Andrew Kelley via llvm-dev llvm-dev at lists.llvm.org
Thu Jan 23 08:22:03 PST 2020


On 1/23/20 5:04 AM, David Spickett wrote:
> Hi Andrew,
> 
> What tools are you passing this triple to, and where did you get the
> list of features you showed? (looks like an MC level list to me)

include/llvm/Support/TargetRegistry.h

  /// createTargetMachine - Create a target specific machine implementation
  /// for the specified \p Triple.
  ///
  /// \param TT This argument is used to determine the target machine
  /// feature set; it should always be provided. Generally this should be
  /// either the target triple from the module, or the target triple of the
  /// host if that does not exist.
  TargetMachine *createTargetMachine(StringRef TT, StringRef CPU,
                            StringRef Features,
                            const TargetOptions &Options,
                            Optional<Reloc::Model> RM,
                            Optional<CodeModel::Model> CM = None,
                            CodeGenOpt::Level OL = CodeGenOpt::Default,
                            bool JIT = false) const;



The list of features I showed comes from LLVM's
lib/Target/AArch64/AArch64.td file, processed into this file:
https://github.com/ziglang/zig/blob/c86589a738e5053a26b2be7d156bcfee1565f00b/lib/std/target/aarch64.zig

Next, the "generic" CPU is chosen, the feature corresponding to the
sub-arch (v8_5a) is added to the set given by the CPU, and then the set
is recursively populated with feature dependencies.

I'm trying to find out how to check my work here, and make sure the list
of features matches what LLVM chooses when empty strings are passed for
CPU and Features.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200123/196c20da/attachment.sig>


More information about the llvm-dev mailing list