rabbitizer/include/common/RabbitizerConfig.h
Anghelo Carvajal b51b62da45
ALLEGREX support (#60)
* setup ALLEGREX

* more setup

* clo

* fix

* Implement SPECIAL_RS and SPECIAL_SA instructions

* more table placeholders

* Implement bshfl instructions

* Rename to R4000Allegrex

* Implement SPECIAL instructions

* Add tests

* Remove some duplicated tests

* Implement SPECIAL3 instructions

* fix bug in test

* update

* Implement COPz

* Implement SPECIAL2 instructions

* Implement COP1

* Yeet cop3

* som tests

* bvf, bvfl, bvt, bvtl

* fix bshfl prefix

* need to implement the vfpu registers

* implement vt_7?

* R4000AllegrexVF -> R4000AllegrexVScalar

* Add test suite to compare with the sn toolchain decoding

* more vfpu test cases

* forgor this

* I can't decide how to name these registers

* Prepare tables for all register types

* Fix typo

* Implement vector scalar register operands

* Implement quad registers

* Fix tests?

* svl.q, svr.q

* Implement a bunch of vfpu0 instructions

* implement registers for `.t` and `.p` instructions

* Implement VFPU1 instructions

* bleh

* VFPU1, VFPU3 and `vcmp.`

* Fix wrong register type on some instructions

* start vfpu3

* Implement VFPU3 instructions

* start categorizing VFPU4

* Categorize VFPU5

* VFPU6 identification

* Identify VFPU7

* COP2 is weird

* organize COP2 a bit

* Add test cases for VFPU4 FMT

* VFPU4 FMT2 stuff

* VFPU4 FMT3 stuff

* VFPU5 stuff

* VFPU6 stuff

* VFPU7 stuff

* Implement COP2 instructions

* Implement vmov, vabs and vneg

* VPFU4 FMT0 FMT0 FMT0 implemented

* VFPU FMT0 FMT0 FMT2

* vnrcp, vnsin, vrexp2

* vrnds, vrndi, vrndf1, vrndf2

* Change tests a bit

* vf2h, vh2f, vsbz, vlgb

* vuc2ifs, vc2i, vus2i, vs2i, vi2uc, vi2c, vi2us, vi2s

* vsrt1, vsrt2, vbfy1, vbfy2, vocp, vsocp, vfad, vavg

* vsrt3, vsrt4, vsgn

* vmfvc and vmtvc placeholders

* vt4444, vt5551, vt5650

* vcst placeholder

* vf2in

* vf2iz

* vf2iu, vf2id, vi2f

* vcmovt, vcmovf

* vwbn.s, viim.s, vfim.s

* vpfxs, vpfxt, vpfxd, vnop, vsync, vflush

* vmmov, vmidt, vmzero, vmone

* vrot

* vmmul, vhtfm2, vtfm2, vhtfm3, vtfm3, vhtfm4, vtfm4, vmscl, vcrsp, vqmul

* Implement matrix operands

* fix matrix operands

* Fix `illegal` tests

* hack out a way to check the test cases are assemblable

* test-fixing: branches

* fix more test cases

* fix vmfvc and vmtvc

* more test fixing

* vdiv and fix operand R323

* more test fixing

* Fix matrix operands

* implement vcmp comparisons

* fix vsync2

* vsqrt and vrndf1 fixes

* Implement "constant" operand for `vcst`

* Add missing operand of vf2in, vf2iz, vf2iu, vf2id, vi2f

* Add missing vcmovt and vcmovf operands

* Add missing vwbn operand

* Tests cases for vmmul

* Fix vtfm2

* Implement "transpose matrix register"

* Add placeholders for the remaining missing operands

* Implement viim operand

* Implement vrot code operand

* placeholders for rp and wp operands

* test cases for vpfxs, vpfxt and vpfxd

* Properly implement rpx, rpy, rpz and rpw

* Properly implement wpx, wpy, wpz and wpw operands

* Implement vfim

* changelog

* readme

* some cleanup

* Restructure some tables

* more table restructure

* fix tests

* more table yeeting

* more cleanup

* more cleanup

* reanming

* moar

* fmt
2024-04-22 13:15:58 -04:00

83 lines
3.0 KiB
C

/* SPDX-FileCopyrightText: © 2022-2024 Decompollaborate */
/* SPDX-License-Identifier: MIT */
#ifndef RABBITIZER_CONFIG_H
#define RABBITIZER_CONFIG_H
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
#include "generated/Abi_enum.h"
RabbitizerAbi RabbitizerAbi_fromStr(const char *name);
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
bool vr4300RspCop0NamedRegisters; // Use named registers for VR4300's RSP's coprocessor 0 registers
bool r4000AllegrexVfpuControlNamedRegisters; // Use named registers for R4000 Allegrex's VFPU control registers
} 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 pseudoNeg;
bool pseudoNegu;
bool pseudoBal;
} RabbitizerConfig_PseudoInstr;
typedef struct RabbitizerConfig_ToolchainTweaks {
bool treatJAsUnconditionalBranch;
/**
* 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
*/
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;
} 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;
} RabbitizerConfig_Misc;
typedef struct RabbitizerConfig {
RabbitizerConfig_RegisterNames regNames;
RabbitizerConfig_PseudoInstr pseudos;
RabbitizerConfig_ToolchainTweaks toolchainTweaks;
RabbitizerConfig_Misc misc;
} RabbitizerConfig;
extern RabbitizerConfig RabbitizerConfig_Cfg;
#ifdef __cplusplus
}
#endif
#endif