mirror of
https://github.com/pound-emu/pound.git
synced 2025-12-12 01:36:57 +00:00
jit/ir: remove the prefix p_ from pointers
Although this is mandated in the Barr C style guide, I find this specific rule uneccesarry and tedious. Signed-off-by: Ronald Caesar <github43132@proton.me>
This commit is contained in:
parent
d61fbe3514
commit
0011bb7825
2 changed files with 78 additions and 78 deletions
|
|
@ -10,50 +10,50 @@ namespace pound::jit::ir {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
value_init (value_t *p_value)
|
value_init (value_t *value)
|
||||||
{
|
{
|
||||||
PVM_ASSERT(nullptr != p_value);
|
PVM_ASSERT(nullptr != value);
|
||||||
p_value->type = IR_TYPE_VOID;
|
value->type = IR_TYPE_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
value_init_from_u64 (value_t *p_value, const uint64_t u64)
|
value_init_from_u64 (value_t *value, const uint64_t u64)
|
||||||
{
|
{
|
||||||
PVM_ASSERT(nullptr != p_value);
|
PVM_ASSERT(nullptr != value);
|
||||||
p_value->type = IR_TYPE_U64;
|
value->type = IR_TYPE_U64;
|
||||||
p_value->inner.immediate_u64 = u64;
|
value->inner.immediate_u64 = u64;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
value_init_from_u32 (value_t *p_value, const uint32_t u32)
|
value_init_from_u32 (value_t *value, const uint32_t u32)
|
||||||
{
|
{
|
||||||
PVM_ASSERT(nullptr != p_value);
|
PVM_ASSERT(nullptr != value);
|
||||||
p_value->type = IR_TYPE_U32;
|
value->type = IR_TYPE_U32;
|
||||||
p_value->inner.immediate_u32 = u32;
|
value->inner.immediate_u32 = u32;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
value_init_from_u8 (value_t *p_value, const uint8_t u8)
|
value_init_from_u8 (value_t *value, const uint8_t u8)
|
||||||
{
|
{
|
||||||
PVM_ASSERT(nullptr != p_value);
|
PVM_ASSERT(nullptr != value);
|
||||||
p_value->type = IR_TYPE_U8;
|
value->type = IR_TYPE_U8;
|
||||||
p_value->inner.immediate_u8 = u8;
|
value->inner.immediate_u8 = u8;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
value_init_from_u1 (value_t *p_value, const bool u1)
|
value_init_from_u1 (value_t *value, const bool u1)
|
||||||
{
|
{
|
||||||
PVM_ASSERT(nullptr != p_value);
|
PVM_ASSERT(nullptr != value);
|
||||||
p_value->type = IR_TYPE_U1;
|
value->type = IR_TYPE_U1;
|
||||||
p_value->inner.immediate_u1 = u1;
|
value->inner.immediate_u1 = u1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
value_init_from_a32_register (value_t *p_value, const a32_register_t reg)
|
value_init_from_a32_register (value_t *value, const a32_register_t reg)
|
||||||
{
|
{
|
||||||
PVM_ASSERT(nullptr != p_value);
|
PVM_ASSERT(nullptr != value);
|
||||||
p_value->type = IR_TYPE_A32_REGISTER;
|
value->type = IR_TYPE_A32_REGISTER;
|
||||||
p_value->inner.immediate_a32_register = reg;
|
value->inner.immediate_a32_register = reg;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -63,37 +63,37 @@ value_init_from_a32_register (value_t *p_value, const a32_register_t reg)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
uint64_t
|
uint64_t
|
||||||
value_get_u64 (const value_t *p_value)
|
value_get_u64 (const value_t *value)
|
||||||
{
|
{
|
||||||
PVM_ASSERT(IR_TYPE_U64 == p_value->type);
|
PVM_ASSERT(IR_TYPE_U64 == value->type);
|
||||||
return p_value->inner.immediate_u64;
|
return value->inner.immediate_u64;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t
|
uint32_t
|
||||||
value_get_u32 (const value_t *p_value)
|
value_get_u32 (const value_t *value)
|
||||||
{
|
{
|
||||||
PVM_ASSERT(IR_TYPE_U32 == p_value->type);
|
PVM_ASSERT(IR_TYPE_U32 == value->type);
|
||||||
return p_value->inner.immediate_u32;
|
return value->inner.immediate_u32;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t
|
uint8_t
|
||||||
value_get_u8 (const value_t *p_value)
|
value_get_u8 (const value_t *value)
|
||||||
{
|
{
|
||||||
PVM_ASSERT(IR_TYPE_U8 == p_value->type);
|
PVM_ASSERT(IR_TYPE_U8 == value->type);
|
||||||
return p_value->inner.immediate_u8;
|
return value->inner.immediate_u8;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
value_get_u1 (const value_t *p_value)
|
value_get_u1 (const value_t *value)
|
||||||
{
|
{
|
||||||
PVM_ASSERT(IR_TYPE_U1 == p_value->type);
|
PVM_ASSERT(IR_TYPE_U1 == value->type);
|
||||||
return p_value->inner.immediate_u1;
|
return value->inner.immediate_u1;
|
||||||
}
|
}
|
||||||
|
|
||||||
pound::jit::a32_register_t
|
pound::jit::a32_register_t
|
||||||
value_get_a32_register (const value_t *p_value)
|
value_get_a32_register (const value_t *value)
|
||||||
{
|
{
|
||||||
PVM_ASSERT(IR_TYPE_A32_REGISTER == p_value->type);
|
PVM_ASSERT(IR_TYPE_A32_REGISTER == value->type);
|
||||||
return p_value->inner.immediate_a32_register;
|
return value->inner.immediate_a32_register;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,56 +46,56 @@ typedef struct
|
||||||
/*!
|
/*!
|
||||||
* @brief Initializes a `value_t` instance to a default/void state.
|
* @brief Initializes a `value_t` instance to a default/void state.
|
||||||
*
|
*
|
||||||
* @param p_value Pointer to the `value_t` instance to initialize.
|
* @param value Pointer to the `value_t` instance to initialize.
|
||||||
* @post The `p_value`'s `type` will be set to `IR_TYPE_VOID`.
|
* @post The `value`'s `type` will be set to `IR_TYPE_VOID`.
|
||||||
* The contents of its `inner` union are considered undefined
|
* The contents of its `inner` union are considered undefined
|
||||||
* for a void value.
|
* for a void value.
|
||||||
*/
|
*/
|
||||||
void value_init(value_t *p_value);
|
void value_init(value_t *value);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Initializes a `value_t` instance to hold an unsigned 64-bit immediate
|
* @brief Initializes a `value_t` instance to hold an unsigned 64-bit immediate
|
||||||
* value.
|
* value.
|
||||||
*
|
*
|
||||||
* @param p_value Pointer to the `value_t` instance to initialize.
|
* @param value Pointer to the `value_t` instance to initialize.
|
||||||
* @param u64 The 64-bit unsigned immediate value to store.
|
* @param u64 The 64-bit unsigned immediate value to store.
|
||||||
* @post The `p_value`'s `type` will be set to `IR_TYPE_U64` and its
|
* @post The `value`'s `type` will be set to `IR_TYPE_U64` and its
|
||||||
* `inner.immediate_u64` member will contain `u64`.
|
* `inner.immediate_u64` member will contain `u64`.
|
||||||
*/
|
*/
|
||||||
void value_init_from_u64(value_t *p_value, uint64_t u64);
|
void value_init_from_u64(value_t *value, uint64_t u64);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Initializes a `value_t` instance to hold an unsigned 32-bit immediate
|
* @brief Initializes a `value_t` instance to hold an unsigned 32-bit immediate
|
||||||
* value.
|
* value.
|
||||||
*
|
*
|
||||||
* @param p_value Pointer to the `value_t` instance to initialize.
|
* @param value Pointer to the `value_t` instance to initialize.
|
||||||
* @param u32 The 32-bit unsigned immediate value to store.
|
* @param u32 The 32-bit unsigned immediate value to store.
|
||||||
* @post The `p_value`'s `type` will be set to `IR_TYPE_U32` and its
|
* @post The `value`'s `type` will be set to `IR_TYPE_U32` and its
|
||||||
* `inner.immediate_u32` member will contain `u32`.
|
* `inner.immediate_u32` member will contain `u32`.
|
||||||
*/
|
*/
|
||||||
void value_init_from_u32(value_t *p_value, uint32_t u32);
|
void value_init_from_u32(value_t *value, uint32_t u32);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Initializes a `value_t` instance to hold an unsigned 8-bit immediate
|
* @brief Initializes a `value_t` instance to hold an unsigned 8-bit immediate
|
||||||
* value.
|
* value.
|
||||||
*
|
*
|
||||||
* @param p_value Pointer to the `value_t` instance to initialize.
|
* @param value Pointer to the `value_t` instance to initialize.
|
||||||
* @param u8 The 8-bit unsigned immediate value to store.
|
* @param u8 The 8-bit unsigned immediate value to store.
|
||||||
* @post The `p_value`'s `type` will be set to `IR_TYPE_U8` and its
|
* @post The `value`'s `type` will be set to `IR_TYPE_U8` and its
|
||||||
* `inner.immediate_u8` member will contain `u8`.
|
* `inner.immediate_u8` member will contain `u8`.
|
||||||
*/
|
*/
|
||||||
void value_init_from_u8(value_t *p_value, uint8_t u8);
|
void value_init_from_u8(value_t *value, uint8_t u8);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Initializes a `value_t` instance to hold a 1-bit boolean immediate
|
* @brief Initializes a `value_t` instance to hold a 1-bit boolean immediate
|
||||||
* value.
|
* value.
|
||||||
*
|
*
|
||||||
* @param p_value Pointer to the `value_t` instance to initialize.
|
* @param value Pointer to the `value_t` instance to initialize.
|
||||||
* @param u1 The boolean (1-bit) immediate value to store.
|
* @param u1 The boolean (1-bit) immediate value to store.
|
||||||
* @post The `p_value`'s `type` will be set to `IR_TYPE_U1` and its
|
* @post The `value`'s `type` will be set to `IR_TYPE_U1` and its
|
||||||
* `inner.immediate_u1` member will contain `u1`.
|
* `inner.immediate_u1` member will contain `u1`.
|
||||||
*/
|
*/
|
||||||
void value_init_from_u1(value_t *p_value, bool u1);
|
void value_init_from_u1(value_t *value, bool u1);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Initializes a `value_t` instance to hold an A32 register identifier.
|
* @brief Initializes a `value_t` instance to hold an A32 register identifier.
|
||||||
|
|
@ -103,67 +103,67 @@ void value_init_from_u1(value_t *p_value, bool u1);
|
||||||
* This function stores the *identity* of an A32 register (e.g., R0, SP, PC)
|
* This function stores the *identity* of an A32 register (e.g., R0, SP, PC)
|
||||||
* within the `value_t`. It does not store the *content* of that register.
|
* within the `value_t`. It does not store the *content* of that register.
|
||||||
*
|
*
|
||||||
* @param p_value Pointer to the `value_t` instance to initialize.
|
* @param value Pointer to the `value_t` instance to initialize.
|
||||||
* @param reg The A32 register identifier (of type `a32_register_t`) to store.
|
* @param reg The A32 register identifier (of type `a32_register_t`) to store.
|
||||||
* @post The `p_value`'s `type` will be set to `IR_TYPE_A32_REGISTER` and its
|
* @post The `value`'s `type` will be set to `IR_TYPE_A32_REGISTER` and its
|
||||||
* `inner.immediate_a32_register` member will contain `reg`.
|
* `inner.immediate_a32_register` member will contain `reg`.
|
||||||
*/
|
*/
|
||||||
void value_init_from_a32_register(value_t *p_value, a32_register_t reg);
|
void value_init_from_a32_register(value_t *value, a32_register_t reg);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Retrieves an unsigned 64-bit immediate value from a `value_t`.
|
* @brief Retrieves an unsigned 64-bit immediate value from a `value_t`.
|
||||||
*
|
*
|
||||||
* @pre The `p_value` must be of type `IR_TYPE_U64`.
|
* @pre The `value` must be of type `IR_TYPE_U64`.
|
||||||
* @param p_value Pointer to the `value_t` instance.
|
* @param value Pointer to the `value_t` instance.
|
||||||
* @retval uint64_t The 64-bit unsigned immediate value stored in `p_value`.
|
* @retval uint64_t The 64-bit unsigned immediate value stored in `value`.
|
||||||
* @warning Calling this function on a `value_t` not of type `IR_TYPE_U64`
|
* @warning Calling this function on a `value_t` not of type `IR_TYPE_U64`
|
||||||
* results in undefined behavior.
|
* results in undefined behavior.
|
||||||
*/
|
*/
|
||||||
uint64_t value_get_u64(const value_t *p_value);
|
uint64_t value_get_u64(const value_t *value);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Retrieves an unsigned 32-bit immediate value from a `value_t`.
|
* @brief Retrieves an unsigned 32-bit immediate value from a `value_t`.
|
||||||
*
|
*
|
||||||
* @pre The `p_value` must be of type `IR_TYPE_U32`.
|
* @pre The `value` must be of type `IR_TYPE_U32`.
|
||||||
* @param p_value Pointer to the `value_t` instance.
|
* @param value Pointer to the `value_t` instance.
|
||||||
* @retval uint32_t The 32-bit unsigned immediate value stored in `p_value`.
|
* @retval uint32_t The 32-bit unsigned immediate value stored in `value`.
|
||||||
* @warning Calling this function on a `value_t` not of type `IR_TYPE_U32`
|
* @warning Calling this function on a `value_t` not of type `IR_TYPE_U32`
|
||||||
* results in undefined behavior.
|
* results in undefined behavior.
|
||||||
*/
|
*/
|
||||||
uint32_t value_get_u32(const value_t *p_value);
|
uint32_t value_get_u32(const value_t *value);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Retrieves an unsigned 8-bit immediate value from a `value_t`.
|
* @brief Retrieves an unsigned 8-bit immediate value from a `value_t`.
|
||||||
*
|
*
|
||||||
* @pre The `p_value` must be of type `IR_TYPE_U8`.
|
* @pre The `value` must be of type `IR_TYPE_U8`.
|
||||||
* @param p_value Pointer to the `value_t` instance.
|
* @param value Pointer to the `value_t` instance.
|
||||||
* @retval uint8_t The 8-bit unsigned immediate value stored in `p_value`.
|
* @retval uint8_t The 8-bit unsigned immediate value stored in `value`.
|
||||||
* @warning Calling this function on a `value_t` not of type `IR_TYPE_U8`
|
* @warning Calling this function on a `value_t` not of type `IR_TYPE_U8`
|
||||||
* results in undefined behavior.
|
* results in undefined behavior.
|
||||||
*/
|
*/
|
||||||
uint8_t value_get_u8(const value_t *p_value);
|
uint8_t value_get_u8(const value_t *value);
|
||||||
|
|
||||||
/**
|
/*!
|
||||||
* @brief Retrieves an unsigned 1-bit immediate value from a `value_t`.
|
* @brief Retrieves an unsigned 1-bit immediate value from a `value_t`.
|
||||||
*
|
*
|
||||||
* @pre The `p_value` must be of type `IR_TYPE_U1`.
|
* @pre The `value` must be of type `IR_TYPE_U1`.
|
||||||
* @param p_value Pointer to the `value_t` instance.
|
* @param value Pointer to the `value_t` instance.
|
||||||
* @retval bool The 1-bit unsigned immediate value stored in `p_value`.
|
* @retval bool The 1-bit unsigned immediate value stored in `value`.
|
||||||
* @warning Calling this function on a `value_t` not of type `IR_TYPE_U1`
|
* @warning Calling this function on a `value_t` not of type `IR_TYPE_U1`
|
||||||
* results in undefined behavior.
|
* results in undefined behavior.
|
||||||
*/
|
*/
|
||||||
bool value_get_u1(const value_t *p_value);
|
bool value_get_u1(const value_t *value);
|
||||||
|
|
||||||
/**
|
/*!
|
||||||
* @brief Retrieves an A32 register identifier from a `value_t`.
|
* @brief Retrieves an A32 register identifier from a `value_t`.
|
||||||
*
|
*
|
||||||
* @pre The `p_value` must be of type `IR_TYPE_A32_REGISTER`.
|
* @pre The `value` must be of type `IR_TYPE_A32_REGISTER`.
|
||||||
* @param p_value Pointer to the `value_t` instance.
|
* @param value Pointer to the `value_t` instance.
|
||||||
* @retval pound::jit::a32_register_t The A32 register identifier stored in
|
* @retval pound::jit::a32_register_t The A32 register identifier stored in
|
||||||
* `p_value`.
|
* `value`.
|
||||||
* @warning Calling this function on a `value_t` not of type
|
* @warning Calling this function on a `value_t` not of type
|
||||||
* `IR_TYPE_A32_REGISTER` results in undefined behavior.
|
* `IR_TYPE_A32_REGISTER` results in undefined behavior.
|
||||||
*/
|
*/
|
||||||
pound::jit::a32_register_t value_get_a32_register(const value_t *p_value);
|
pound::jit::a32_register_t value_get_a32_register(const value_t *value);
|
||||||
} // namespace pound:::jit::ir
|
} // namespace pound:::jit::ir
|
||||||
#endif // POUND_JIT_IR_TYPE_H
|
#endif // POUND_JIT_IR_TYPE_H
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue