GCC source code Analysis, Build_pointer_type () function analysis

Source: Internet
Author: User


function = Build (addr_expr, Build_pointer_type (Tree_type (function)),
function);

Continue to analyze this sentence of the previous article.



/* Constructors for pointer, array and function types.
(Record_type, Union_type and Enumeral_type nodes are
Constructed by Language-dependent code, isn't here.) */

/* Construct, lay out and return the type of pointers to To_type.
If such a type has already been constructed, reuse it. */

Tree
Build_pointer_type (To_type)
Tree To_type;
{
Register Tree t = type_pointer_to (To_type);

/* Below is the result of Debug_tree (To_type);

<function_type 956e8
Type <integer_type 824d0 int permanent SI
Size &LT;INTEGER_CST 8254c literal permanent 4
Align Size_unit 8 sep_unit symtab 0
Sep <integer_cst 8251c literal permanent-2147483648 precision min <integer_cst 8251c-2147483648>
Max &LT;INTEGER_CST 82534 literal permanent 2147483647
Pointer_to_this <pointer_type 88b4c> chain <integer_type 825bc* char>
Permanent EP
Size &LT;INTEGER_CST 82dd8 type <integer_type 82848* unsigned int> literal permanent 8
Align Size_unit 8 sep_unit 0 Symtab 0
Arg-types <tree_list 95698 Permanent
Value <pointer_type 9117c type <integer_type 91130* char>
Permanent unsigned SI size &LT;INTEGER_CST 8254c 4>
Align Size_unit 8 sep_unit symtab 0
Chain <function_type 912c0>
Chain <function_type 959b0>
*/


Register struct Obstack *ambient_obstack = current_obstack;
Register struct Obstack *ambient_saveable_obstack = saveable_obstack;

/* First, if we already has a type for pointers to To_type, use it. */

if (t)
return t;

/* We need a new one.  If To_type is permanent, make this permanent too. */
if (Tree_permanent (To_type))
{
Current_obstack = &permanent_obstack;
Saveable_obstack = &permanent_obstack;
}

t = Make_node (Pointer_type);

/* Below is the result of debug_tree (t);

<pointer_type 98f48 Permanent VOID
Align 1 size_unit 1 Sep_unit 0 symtab 0
*/

Tree_type (t) = To_type;

/* Below is the result of debug_tree (t);

<pointer_type 98f48
Type <function_type 956e8
Type <integer_type 824d0 int permanent SI
Size &LT;INTEGER_CST 8254c literal permanent 4
Align Size_unit 8 sep_unit symtab 0
Sep <integer_cst 8251c literal permanent-2147483648 precision min <integer_cst 8251c-2147483648>
Max &LT;INTEGER_CST 82534 literal permanent 2147483647
Pointer_to_this <pointer_type 88b4c> chain <integer_type 825bc* char>
Permanent EP
Size &LT;INTEGER_CST 82DD8 literal permanent 8
Align Size_unit 8 sep_unit 0 Symtab 0
Arg-types <tree_list 95698 Permanent value <pointer_type 9117c>
Chain <function_type 959b0>
Permanent VOID
Align 1 size_unit 1 Sep_unit 0 symtab 0

*/
/* Record This type as the pointer to To_type. */
Type_pointer_to (To_type) = t;

/*

<function_type 956e8
Type <integer_type 824d0 int permanent SI
Size &LT;INTEGER_CST 8254c literal permanent 4
Align Size_unit 8 sep_unit symtab 0
Sep <integer_cst 8251c literal permanent-2147483648 precision min <integer_cst 8251c-2147483648>
Max &LT;INTEGER_CST 82534 literal permanent 2147483647
Pointer_to_this <pointer_type 88b4c> chain <integer_type 825bc* char>
Permanent EP
Size &LT;INTEGER_CST 82dd8 type <integer_type 82848* unsigned int> literal permanent 8
Align Size_unit 8 sep_unit 0 Symtab 0
Arg-types <tree_list 95698 Permanent
Value <pointer_type 9117c type <integer_type 91130* char>
Permanent unsigned SI size &LT;INTEGER_CST 8254c 4>
Align Size_unit 8 sep_unit symtab 0
Chain <function_type 912c0>
pointer_to_this <pointer_type 98f48>Chain <function_type 959b0>

*/



/* Lay out the type. This function have many callers that is concerned
With Expression-construction, and this simplifies them all.
Also, it guarantees the type_size is permanent if the TYPE is. */
Layout_type (t);

Current_obstack = Ambient_obstack;
Saveable_obstack = Ambient_saveable_obstack;
return t;
}


<pointer_type 98f48
Type <function_type 956e8
Type <integer_type 824d0 int permanent SI
Size &LT;INTEGER_CST 8254c literal permanent 4
Align Size_unit 8 sep_unit symtab 0
Sep <integer_cst 8251c literal permanent-2147483648 precision min <integer_cst 8251c-2147483648>
Max &LT;INTEGER_CST 82534 literal permanent 2147483647
Pointer_to_this <pointer_type 88b4c> chain <integer_type 825bc* char>
Permanent EP
Size &LT;INTEGER_CST 82DD8 literal permanent 8
Align Size_unit 8 sep_unit 0 Symtab 0
Arg-types <tree_list 95698 Permanent value <pointer_type 9117c>
pointer_to_this <pointer_type 98f48> chain <function_type 959b0>
Permanent unsigned SI size &LT;INTEGER_CST 8254c 4>
Align Size_unit 8 sep_unit symtab 0


GCC source code Analysis, Build_pointer_type () function analysis

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.