2024-01-28 12:16:11 -03:00
|
|
|
/* SPDX-FileCopyrightText: © 2022-2024 Decompollaborate */
|
2022-06-05 00:45:20 -04:00
|
|
|
/* SPDX-License-Identifier: MIT */
|
|
|
|
|
|
|
|
|
|
#ifndef RABBITIZER_CONFIG_H
|
|
|
|
|
#define RABBITIZER_CONFIG_H
|
|
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
2022-10-04 08:31:02 -03:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2022-06-05 00:45:20 -04:00
|
|
|
|
2023-05-02 19:01:54 -04:00
|
|
|
#include "generated/Abi_enum.h"
|
2022-06-09 22:58:31 -04:00
|
|
|
|
|
|
|
|
RabbitizerAbi RabbitizerAbi_fromStr(const char *name);
|
2022-06-05 00:45:20 -04: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 01:57:22 -04:00
|
|
|
bool vr4300RspCop0NamedRegisters; // Use named registers for VR4300's RSP's coprocessor 0 registers
|
2024-04-22 13:15:58 -04:00
|
|
|
bool r4000AllegrexVfpuControlNamedRegisters; // Use named registers for R4000 Allegrex's VFPU control registers
|
2022-06-05 00:45:20 -04: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;
|
2024-02-18 11:34:07 -03:00
|
|
|
bool pseudoNeg;
|
2022-06-05 00:45:20 -04:00
|
|
|
bool pseudoNegu;
|
2022-09-27 22:52:57 -03:00
|
|
|
bool pseudoBal;
|
2022-06-05 00:45:20 -04:00
|
|
|
} RabbitizerConfig_PseudoInstr;
|
|
|
|
|
|
|
|
|
|
typedef struct RabbitizerConfig_ToolchainTweaks {
|
2023-09-13 11:06:32 -03:00
|
|
|
bool treatJAsUnconditionalBranch;
|
2022-06-05 00:45:20 -04:00
|
|
|
/**
|
|
|
|
|
* 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 10:35:47 -04:00
|
|
|
bool sn64DivFix;
|
2023-04-16 10:05:01 -04:00
|
|
|
/**
|
|
|
|
|
* 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 00:45:20 -04: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
|
2022-07-07 00:44:30 -04:00
|
|
|
bool omit0XOnSmallImm;
|
|
|
|
|
bool upperCaseImm;
|
2024-04-23 11:09:58 -04:00
|
|
|
bool expandJalr;
|
2022-06-05 00:45:20 -04: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 08:31:02 -03:00
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2022-06-05 00:45:20 -04:00
|
|
|
#endif
|