[GNU Tools Cauldron 2014] A proposal for type-safe RTL
Prathamesh Kulkarni
bilbotheelffriend@gmail.com
Mon Aug 4 21:50:00 GMT 2014
Hi,
Please find attached my notes on "A proposal on type-safe RTL".
I would be grateful if you would review it for me.
Thanks,
Prathamesh
-------------- next part --------------
A proposal for type-safe RTL
Author: David Malcolm
RTL is a low-level intermediate langauge used in GCC to perform machine-dependent optimziations and
code generation. The current RTL data strucutures (rtx), is not type-safe, and type checking
cannot be performed during build-time.
The motivation of this project is to make RTL type-safe, so that type errors can be caught at build-time,
and to increase readability of code that operates on RTL.
Representation using C++ class heirarchy:
Currently rtx is used to represent all RTL-types - instructions, expressions, etc.
The idea is to convert rtx into C++ class heirarchy, with rtx_def being base type, rtx_insn representing
instructions, etc. Using C++ class heirarchy makes it type-safe and enables type-errors to be caught at
build-time
Planned Class herirarchy:
class rtx_def;
class rtx_insn; /* (INSN_P (X) || NOTE_P (X)
|| JUMP_TABLE_DATA_P (X) || BARRIER_P (X)
|| LABEL_P (X)) */
class rtx_real_insn; /* INSN_P (X) */
class rtx_debug_insn; /* DEBUG_INSN_P (X) */
class rtx_nonjump_insn; /* NONJUMP_INSN_P (X) */
class rtx_jump_insn; /* JUMP_P (X) */
class rtx_call_insn; /* CALL_P (X) */
class rtx_jump_table_data; /* JUMP_TABLE_DATA_P (X) */
class rtx_barrier; /* BARRIER_P (X) */
class rtx_code_label; /* LABEL_P (X) */
class rtx_note; /* NOTE_P (X) */
Patch-series can be seen at:
http://dmalcolm.fedorapeople.org/gcc/patch-backups/rtx-classes/
Merge proposal for next GCC release:
- rtx_insn to represent RTL "instructions", subclass of rtx_def.
rtx_insn would be a big gain in type-safety.
More information about the Gcc
mailing list