rabbitizer/include/common/RabbitizerConfig.h

81 lines
2.9 KiB
C
Raw Normal View History

2023-05-02 20:41:02 +00:00
/* SPDX-FileCopyrightText: © 2022-2023 Decompollaborate */
2022-06-05 04:45:20 +00:00
/* SPDX-License-Identifier: MIT */
#ifndef RABBITIZER_CONFIG_H
#define RABBITIZER_CONFIG_H
#include <stdbool.h>
2022-10-04 11:31:02 +00:00
#ifdef __cplusplus
extern "C" {
#endif
2022-06-05 04:45:20 +00:00
#include "generated/Abi_enum.h"
2022-06-10 02:58:31 +00:00
RabbitizerAbi RabbitizerAbi_fromStr(const char *name);
2022-06-05 04:45:20 +00:00
typedef struct RabbitizerConfig_RegisterNames {
bool namedRegisters; // Enables using named registers. This option takes precedence over the other named register options
RabbitizerAbi gprAbiNames; // The ABI names to be used for general purpose registers when disassembling the main processor's instructions
RabbitizerAbi fprAbiNames; // The ABI names to be used for floating point registers when disassembling the floating point (coprocessor 1) instructions
bool userFpcCsr; // Use FpcCsr as register $31 for the FP control/status register
bool vr4300Cop0NamedRegisters; // Use named registers for VR4300's coprocessor 0 registers
2022-06-05 05:57:22 +00:00
bool vr4300RspCop0NamedRegisters; // Use named registers for VR4300's RSP's coprocessor 0 registers
2022-06-05 04:45:20 +00:00
} RabbitizerConfig_RegisterNames;
typedef struct RabbitizerConfig_PseudoInstr {
bool enablePseudos; // Produce pseudo instructions (like `move` or `b`) whenever those may match the desired original instruction
bool pseudoBeqz;
bool pseudoBnez;
bool pseudoB;
bool pseudoMove;
bool pseudoNot;
bool pseudoNegu;
2022-09-28 01:52:57 +00:00
bool pseudoBal;
2022-06-05 04:45:20 +00:00
} RabbitizerConfig_PseudoInstr;
typedef struct RabbitizerConfig_ToolchainTweaks {
bool treatJAsUnconditionalBranch; //! @deprecated
/**
* Enables a few fixes for SN64's assembler related to div/divu instructions
*
* - SN64's assembler doesn't like assembling `div $0, a, b` with .set noat active.
* Removing the $0 fixes this issue (but not for handwritten asm)
*
* - SN64's assembler expands div to have break if dividing by zero
* However, the break it generates is different than the one it generates with `break N`
* So we replace break instrutions for SN64 with the exact word that the assembler generates when expanding div
*/
2023-04-16 14:35:47 +00:00
bool sn64DivFix;
/**
* Enables various tweaks to allow building matching with GNU as which
* break original compiler behavior and what's specified in the manuals.
*/
bool gnuMode;
2022-06-05 04:45:20 +00:00
} RabbitizerConfig_ToolchainTweaks;
typedef struct RabbitizerConfig_Misc {
int opcodeLJust; // The minimal number of characters to left-align the opcode name
bool unknownInstrComment; // Generate a pseudo-disassembly comment when disassembling non implemented instructions
bool omit0XOnSmallImm;
bool upperCaseImm;
2022-06-05 04:45:20 +00:00
} RabbitizerConfig_Misc;
typedef struct RabbitizerConfig {
RabbitizerConfig_RegisterNames regNames;
RabbitizerConfig_PseudoInstr pseudos;
RabbitizerConfig_ToolchainTweaks toolchainTweaks;
RabbitizerConfig_Misc misc;
} RabbitizerConfig;
extern RabbitizerConfig RabbitizerConfig_Cfg;
2022-10-04 11:31:02 +00:00
#ifdef __cplusplus
}
#endif
2022-06-05 04:45:20 +00:00
#endif