X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fadt%2Fpdeq.h;h=3f422fe0e8ab3590b079a08fe349565370a61825;hb=5ed60b9196d8f50c2426ae27d59817e813f00f0c;hp=e2107bc1ca7f7f5878047b6328609616ea240633;hpb=b719ba15ad4119f474743595aaa7e22723b06911;p=libfirm diff --git a/ir/adt/pdeq.h b/ir/adt/pdeq.h index e2107bc1c..3f422fe0e 100644 --- a/ir/adt/pdeq.h +++ b/ir/adt/pdeq.h @@ -182,6 +182,13 @@ typedef pdeq waitq; */ #define new_waitq() new_pdeq() +/** + * Delete a wait queue (fifo) + * + * @param wq The wait queue. + */ +#define del_waitq(wq) del_pdeq(wq) + /** * Retrieve a pointer from the wait queue (fifo). * @@ -212,4 +219,47 @@ typedef pdeq waitq; */ #define waitq_empty(wq) pdeq_empty(wq) +/** + * The pdeq can be used as a stack. A helper + * type to support this. + */ +typedef pdeq stack; + +/** + * Creates a new pointer stack (lifo). + * + * @return A new stack. + */ +#define new_stack() new_pdeq() + +/** + * Pop a pointer from the stack (lifo). + * + * @param st The stack. + * + * @return The pointer element. + * + * @remark This function will fail if the stack is empty. + */ +#define stack_pop(st) pdeq_getr(st) + +/** + * Push a pointer to the stack (lifo). + * + * @param st The stack. + * @param x The pointer element to be added + * + * @return The stack. + */ +#define stack_push(st, x) pdeq_putr((st), (x)) + +/** + * Checks if a stack is empty. + * + * @param st The stack. + * + * @return non-zero if the stack is empty. + */ +#define stack_empty(st) pdeq_empty(wq) + #endif /* _PDEQ_H_ */