public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Is there a way to build part of gcc as a dynamic library?
@ 2020-03-02 12:44 zerons
  0 siblings, 0 replies; only message in thread
From: zerons @ 2020-03-02 12:44 UTC (permalink / raw)
  To: gcc-help

Hi,

I am working on a project that would collect AST info
and use it 'offline'. I wonder if it is possible to
use some parts of gcc as a dynamic library, to parse
the tree nodes and gimple statements.

For example, I have this naive function to get a field offset:

static unsigned long get_field_offset(tree field)
{
	unsigned long ret = 0;
	if (DECL_FIELD_OFFSET(field)) {
		ret += TREE_INT_CST_LOW(DECL_FIELD_OFFSET(field)) * 8;
	}
	if (DECL_FIELD_BIT_OFFSET(field)) {
		ret += TREE_INT_CST_LOW(DECL_FIELD_BIT_OFFSET(field));
	}
	return ret;
}

It may work well for some cases, I doubt that it can handle
all cases.

If I can use part of gcc as a dynamic library, it would be quite
easy to parse these tree nodes and gimple statements by using the
internal functions.

Thanks.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-03-02 12:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-02 12:44 Is there a way to build part of gcc as a dynamic library? zerons

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).