Hi all, Is it possible, in the arch.opt file, to have GCC generate a bitmask relative to a user-defined variable without an associated name? To illustrate my problem, consider the following option file snippet:
... Variable HOST_WIDE_INT riscv_bitmanip_flags = 0 ... mbmi-zbb Target Mask(BITMANIP_ZBB) Var(riscv_bitmanip_flags) Support the base subset of the Bitmanip extension. ... This generates the following lines in the build/gcc/options.h (marker added by me for clarity): ... #define OPTION_MASK_BITMANIP_ZBB (HOST_WIDE_INT_1U << 0) // <<<< #define OPTION_MASK_BITMANIP_ZBC (HOST_WIDE_INT_1U << 1) #define OPTION_MASK_BITMANIP_ZBE (HOST_WIDE_INT_1U << 2) #define OPTION_MASK_BITMANIP_ZBF (HOST_WIDE_INT_1U << 3) #define OPTION_MASK_BITMANIP_ZBM (HOST_WIDE_INT_1U << 4) #define OPTION_MASK_BITMANIP_ZBP (HOST_WIDE_INT_1U << 5) #define OPTION_MASK_BITMANIP_ZBR (HOST_WIDE_INT_1U << 6) #define OPTION_MASK_BITMANIP_ZBS (HOST_WIDE_INT_1U << 7) #define OPTION_MASK_BITMANIP_ZBT (HOST_WIDE_INT_1U << 8) #define MASK_DIV (1U << 0) #define MASK_EXPLICIT_RELOCS (1U << 1) #define MASK_FDIV (1U << 2) #define MASK_SAVE_RESTORE (1U << 3) #define MASK_STRICT_ALIGN (1U << 4) #define MASK_64BIT (1U << 5) #define MASK_ATOMIC (1U << 6) #define MASK_BITMANIP (1U << 7) #define MASK_DOUBLE_FLOAT (1U << 8) #define MASK_HARD_FLOAT (1U << 9) #define MASK_MUL (1U << 10) #define MASK_RVC (1U << 11) #define MASK_RVE (1U << 12) ... But, I don't want the user to be able to pass "-mbmi-zbb" or "-mno-bmi-zbb" on the command line: I only want the generation of the `x_riscv_bitmanip_flags` variable, and the associated bitmasks so that I can use them elsewhere in the backend code. So, I remove the name and description from the entry, like so: ... Target Mask(BITMANIP_ZBB) Var(riscv_bitmanip_flags) ... But now, in the build/gcc/options.h file, the bitmask becomes relative to the generic `x_target_flags` variable: #define OPTION_MASK_BITMANIP_ZBC (HOST_WIDE_INT_1U << 0) #define OPTION_MASK_BITMANIP_ZBE (HOST_WIDE_INT_1U << 1) #define OPTION_MASK_BITMANIP_ZBF (HOST_WIDE_INT_1U << 2) #define OPTION_MASK_BITMANIP_ZBM (HOST_WIDE_INT_1U << 3) #define OPTION_MASK_BITMANIP_ZBP (HOST_WIDE_INT_1U << 4) #define OPTION_MASK_BITMANIP_ZBR (HOST_WIDE_INT_1U << 5) #define OPTION_MASK_BITMANIP_ZBS (HOST_WIDE_INT_1U << 6) #define OPTION_MASK_BITMANIP_ZBT (HOST_WIDE_INT_1U << 7) #define MASK_DIV (1U << 0) #define MASK_EXPLICIT_RELOCS (1U << 1) #define MASK_FDIV (1U << 2) #define MASK_SAVE_RESTORE (1U << 3) #define MASK_STRICT_ALIGN (1U << 4) #define MASK_64BIT (1U << 5) #define MASK_ATOMIC (1U << 6) #define MASK_BITMANIP (1U << 7) #define MASK_DOUBLE_FLOAT (1U << 8) #define MASK_HARD_FLOAT (1U << 9) #define MASK_MUL (1U << 10) #define MASK_RVC (1U << 11) #define MASK_RVE (1U << 12) #define MASK_BITMANIP_ZBB (1U << 13) // <<<< Could someone suggest as to a way to get around this problem in the .opt file? Best Regards, Maxim