X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fir%2Firphase_t.h;h=a9ccd6af5825a934e9280df5b42ce3ffed5c42a0;hb=014643c20bee2345c928105e06c815d4f083753a;hp=26f55993141844073445f8bc4caa02590a4ab4ae;hpb=cb27b668ff641b07ea3a92f18cec67407563663e;p=libfirm diff --git a/ir/ir/irphase_t.h b/ir/ir/irphase_t.h index 26f559931..a9ccd6af5 100644 --- a/ir/ir/irphase_t.h +++ b/ir/ir/irphase_t.h @@ -120,6 +120,15 @@ void phase_reinit_irn_data(phase_t *phase); */ #define phase_get_or_set_irn_data(ph, irn) _phase_get_or_set_irn_data((ph), (irn)) +/** + * Set the data for an irn. + * @param ph The phase. + * @param irn The node. + * @param data The data. + * @return The old data or NULL if there was none. + */ +#define phase_set_irn_data(ph, irn, data) _phase_set_irn_data((ph), (irn), (data)) + /** * This is private and just here for performance reasons. */ @@ -151,6 +160,21 @@ static INLINE void *_phase_get_irn_data(const phase_t *ph, const ir_node *irn) return idx < ph->n_data_ptr ? ph->data_ptr[idx] : NULL; } +static INLINE void *_phase_set_irn_data(phase_t *ph, const ir_node *irn, void *data) +{ + unsigned idx = get_irn_idx(irn); + void *res; + + /* Assure that there's a sufficient amount of slots. */ + _private_phase_assure_capacity(ph, idx); + + res = ph->data_ptr[idx]; + ph->data_ptr[idx] = data; + + return res; +} + + static INLINE void *_phase_get_or_set_irn_data(phase_t *ph, ir_node *irn) { unsigned idx = get_irn_idx(irn);