mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-13 07:32:23 -07:00
follow C type conversion rules in the expression transpiler
This commit is contained in:
+1886
-1375
File diff suppressed because it is too large
Load Diff
@@ -45,6 +45,48 @@ typedef struct D2R_CompUnitContribMap
|
||||
RDIM_Rng1U64ChunkList *voff_range_arr;
|
||||
} D2R_CompUnitContribMap;
|
||||
|
||||
#define D2R_ValueType_IsSigned(x) ((x) == D2R_ValueType_S8 || (x) == D2R_ValueType_S16 || (x) == D2R_ValueType_S32 || (x) == D2R_ValueType_S64 || (x) == D2R_ValueType_S128 || (x) == D2R_ValueType_S256 || (x) == D2R_ValueType_S512)
|
||||
#define D2R_ValueType_IsUnsigned(x) ((x) == D2R_ValueType_U8 || (x) == D2R_ValueType_U16 || (x) == D2R_ValueType_U32 || (x) == D2R_ValueType_U64 || (x) == D2R_ValueType_U128 || (x) == D2R_ValueType_U256 || (x) == D2R_ValueType_U512)
|
||||
#define D2R_ValueType_IsFloat(x) ((x) == D2R_ValueType_F32 || (x) == D2R_ValueType_F64)
|
||||
#define D2R_ValueType_IsInt(x) (D2R_ValueType_IsSigned(x) || D2R_ValueType_IsUnsigned(x) || (x) == D2R_ValueType_Address)
|
||||
typedef enum D2R_ValueType
|
||||
{
|
||||
D2R_ValueType_Generic,
|
||||
D2R_ValueType_U8,
|
||||
D2R_ValueType_U16,
|
||||
D2R_ValueType_U32,
|
||||
D2R_ValueType_U64,
|
||||
D2R_ValueType_U128,
|
||||
D2R_ValueType_U256,
|
||||
D2R_ValueType_U512,
|
||||
D2R_ValueType_S8,
|
||||
D2R_ValueType_S16,
|
||||
D2R_ValueType_S32,
|
||||
D2R_ValueType_S64,
|
||||
D2R_ValueType_S128,
|
||||
D2R_ValueType_S256,
|
||||
D2R_ValueType_S512,
|
||||
D2R_ValueType_F32,
|
||||
D2R_ValueType_F64,
|
||||
D2R_ValueType_Address,
|
||||
D2R_ValueType_ImplicitValue,
|
||||
D2R_ValueType_Bool = D2R_ValueType_S8,
|
||||
} D2R_ValueType;
|
||||
|
||||
typedef struct D2R_ValueTypeNode
|
||||
{
|
||||
D2R_ValueType type;
|
||||
|
||||
struct D2R_ValueTypeNode *next;
|
||||
} D2R_ValueTypeNode;
|
||||
|
||||
typedef struct D2R_ValueTypeStack
|
||||
{
|
||||
U64 count;
|
||||
D2R_ValueTypeNode *top;
|
||||
D2R_ValueTypeNode *free_list;
|
||||
} D2R_ValueTypeStack;
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Enum Conversion Helpers
|
||||
|
||||
@@ -66,10 +108,32 @@ internal RDI_TypeKind d2r_unsigned_type_kind_from_size(U64 byte_size);
|
||||
internal RDI_TypeKind d2r_signed_type_kind_from_size(U64 byte_size);
|
||||
internal RDI_EvalTypeGroup d2r_type_group_from_type_kind(RDI_TypeKind x);
|
||||
|
||||
////////////////////////////////
|
||||
//~ RDIM Bytecode Helpers
|
||||
|
||||
internal B32 rdim_is_bytecode_tls_dependent(RDIM_EvalBytecode bc);
|
||||
internal B32 rdim_is_eval_bytecode_static(RDIM_EvalBytecode bc);
|
||||
internal U64 rdim_virt_off_from_eval_bytecode(RDIM_EvalBytecode bc, U64 image_base);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Bytecode Conversion Helpers
|
||||
|
||||
internal RDIM_EvalBytecode d2r_bytecode_from_expression(Arena *arena, DW_Input *input, U64 image_base, U64 address_size, Arch arch, DW_ListUnit *addr_lu, String8 expr, DW_CompUnit *cu, B32 *is_addr_out);
|
||||
internal D2R_ValueTypeNode * d2r_value_type_stack_push(Arena *arena, D2R_ValueTypeStack *stack, D2R_ValueType type);
|
||||
internal D2R_ValueType d2r_value_type_stack_pop(D2R_ValueTypeStack *stack);
|
||||
internal D2R_ValueType d2r_value_type_stack_peek(D2R_ValueTypeStack *stack);
|
||||
|
||||
internal D2R_ValueType d2r_unsigned_value_type_from_bit_size(U64 bit_size);
|
||||
internal D2R_ValueType d2r_signed_value_type_from_bit_size(U64 bit_size);
|
||||
internal D2R_ValueType d2r_float_type_from_bit_size(U64 bit_size);
|
||||
internal RDI_EvalTypeGroup d2r_value_type_to_rdi(D2R_ValueType v);
|
||||
internal U64 d2r_size_from_value_type(U64 addr_size, D2R_ValueType value_type);
|
||||
internal D2R_ValueType d2r_pick_common_value_type(D2R_ValueType lhs, D2R_ValueType rhs);
|
||||
|
||||
internal D2R_ValueType d2r_apply_usual_arithmetic_conversions(Arena *arena, D2R_ValueType lhs, D2R_ValueType rhs, RDIM_EvalBytecode *bc);
|
||||
internal void d2r_push_arithmetic_op(Arena *arena, D2R_ValueTypeStack *stack, RDIM_EvalBytecode *bc, RDI_EvalOp op);
|
||||
internal void d2r_push_relational_op(Arena *arena, D2R_ValueTypeStack *stack, RDIM_EvalBytecode *bc, RDI_EvalOp op);
|
||||
|
||||
internal RDIM_EvalBytecode d2r_bytecode_from_expression(Arena *arena, DW_Input *input, U64 image_base, U64 address_size, Arch arch, DW_ListUnit *addr_lu, String8 expr, DW_CompUnit *cu, D2R_ValueType *result_type_out);
|
||||
internal RDIM_Location * d2r_transpile_expression(Arena *arena, RDIM_LocationChunkList *locations, DW_Input *input, U64 image_base, U64 address_size, Arch arch, DW_ListUnit *addr_lu, DW_CompUnit *cu, String8 expr);
|
||||
internal RDIM_Location * d2r_location_from_attrib(Arena *arena, RDIM_LocationChunkList *locations, DW_Input *input, DW_CompUnit *cu, U64 image_base, Arch arch, DW_Tag tag, DW_AttribKind kind);
|
||||
internal RDIM_LocationCaseList d2r_locset_from_attrib(Arena *arena, RDIM_ScopeChunkList *scopes, RDIM_Scope *curr_scope, RDIM_LocationChunkList *locations, DW_Input *input, DW_CompUnit *cu, U64 image_base, Arch arch, DW_Tag tag, DW_AttribKind kind);
|
||||
|
||||
Reference in New Issue
Block a user