Commit 325f3724 authored by Michael Beck's avatar Michael Beck
Browse files

Added get_signed_mode() and get_unsigned_mode()

[r4097]
parent b6357fed
......@@ -915,6 +915,24 @@ init_mode (void)
mode_P_mach = mode_P;
}
ir_mode *find_unsigned_mode(const ir_mode *mode)
{
ir_mode n = *mode;
assert(mode->sort == irms_int_number);
n.sign = 0;
return find_mode(&n);
}
ir_mode *find_signed_mode(const ir_mode *mode)
{
ir_mode n = *mode;
assert(mode->sort == irms_int_number);
n.sign = 1;
return find_mode(&n);
}
void finish_mode(void) {
obstack_free(&modes, 0);
......
......@@ -425,5 +425,14 @@ int mode_is_int_vector (const ir_mode *mode);
according to firm definiton */
int smaller_mode(const ir_mode *sm, const ir_mode *lm);
/**
* Returns a matching unsigned mode for a given integer signed mode.
*/
ir_mode *find_unsigned_mode(const ir_mode *mode);
/**
* Returns a matching signed mode for a given integer unsigned mode.
*/
ir_mode *find_signed_mode(const ir_mode *mode);
#endif /* _IRMODE_H_ */
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment