Movatterモバイル変換


[0]ホーム

URL:


Next:, Previous:, Up:GENERIC   [Contents][Index]


10.2 Overview

The central data structure used by the internal representation is thetree. These nodes, while all of the C typetree, are ofmany varieties. Atree is a pointer type, but the object towhich it points may be of a variety of types. From this point forward,we will refer to trees in ordinary type, rather than inthisfont, except when talking about the actual C typetree.

You can tell what kind of node a particular tree is by using theTREE_CODE macro. Many, many macros take trees as input andreturn trees as output. However, most macros require a certain kind oftree node as input. In other words, there is a type-system for trees,but it is not reflected in the C type-system.

For safety, it is useful to configure GCC with--enable-checking.Although this results in a significant performance penalty (since alltree types are checked at run-time), and is therefore inappropriate in arelease version, it is extremely helpful during the development process.

Many macros behave as predicates. Many, although not all, of thesepredicates end in ‘_P’. Do not rely on the result type of thesemacros being of any particular type. You may, however, rely on the factthat the type can be compared to0, so that statements like

if (TEST_P (t) && !TEST_P (y))  x = 1;

and

int i = (TEST_P (t) != 0);

are legal. Macros that returnint values now may be changed toreturntree values, or other pointers in the future. Even thosethat continue to returnint may return multiple nonzero codeswhere previously they returned only zero and one. Therefore, you shouldnot write code like

if (TEST_P (t) == 1)

as this code is not guaranteed to work correctly in the future.

You should not take the address of values returned by the macros orfunctions described here. In particular, no guarantee is given that thevalues are lvalues.

In general, the names of macros are all in uppercase, while the names offunctions are entirely in lowercase. There are rare exceptions to thisrule. You should assume that any macro or function whose name is madeup entirely of uppercase letters may evaluate its arguments more thanonce. You may assume that a macro or function whose name is made upentirely of lowercase letters will evaluate its arguments only once.

Theerror_mark_node is a special tree. Its tree code isERROR_MARK, but since there is only ever one node with that code,the usual practice is to compare the tree againsterror_mark_node. (This test is just a test for pointerequality.) If an error has occurred during front-end processing theflagerrorcount will be set. If the front end has encounteredcode it cannot handle, it will issue a message to the user and setsorrycount. When these flags are set, any macro or functionwhich normally returns a tree of a particular kind may instead returntheerror_mark_node. Thus, if you intend to do any processing oferroneous code, you must be prepared to deal with theerror_mark_node.

Occasionally, a particular tree slot (like an operand to an expression,or a particular field in a declaration) will be referred to as“reserved for the back end”. These slots are used to store RTL whenthe tree is converted to RTL for use by the GCC back end. However, ifthat process is not taking place (e.g., if the front end is being hookedup to an intelligent editor), then those slots may be used by theback end presently in use.

If you encounter situations that do not match this documentation, suchas tree nodes of types not mentioned here, or macros documented toreturn entities of a particular kind that instead return entities ofsome different kind, you have found a bug, either in the front end or inthe documentation. Please report these bugs as you would any otherbug.


Next:Types, Previous:Deficiencies, Up:GENERIC   [Contents][Index]


[8]ページ先頭

©2009-2026 Movatter.jp