GCC Middle and Back End API Reference
asm-toplevel.cc File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "tree.h"
#include "tree-pass.h"
#include "cgraph.h"
Include dependency graph for asm-toplevel.cc:

Data Structures

class  constraint_data

Functions

static void mark_fragile_ref_by_asm (symtab_node *node, bool maybe_local=false)
static tree walk_through_constraints (tree *t, int *, void *dat)
void analyze_toplevel_extended_asm ()
void ipa_asm_heuristics ()
ipa_opt_pass_dmake_pass_ipa_asm_lgen (gcc::context *ctxt)
ipa_opt_pass_dmake_pass_ipa_asm_wpa (gcc::context *ctxt)

Function Documentation

◆ analyze_toplevel_extended_asm()

void analyze_toplevel_extended_asm ( void )

◆ ipa_asm_heuristics()

void ipa_asm_heuristics ( )
Checks all toplevel assembly contents and compares them with known symbols.
Marks those symbols with relevant flags.
Heuristics: Detects anything in assembly that looks like an identifer.

This pass must be in WPA, otherwise we will not see all possibly referenced
symbols - if a symbol is only declared, it will not be in the callgraph if
it is only referenced from toplevel assembly.
However in WPA there may be multiple symbols with the same identifier.
The chosen solution is to handle local symbols in LGEN pass first.   

References symtab_node::asm_name(), asm_node::asm_str, symtab_node::decl, dump_file, FOR_EACH_SYMBOL, i, map, mark_fragile_ref_by_asm(), toplevel_node::next, safe_as_a(), symtab, TREE_CODE, TREE_PUBLIC, TREE_STRING_LENGTH, and TREE_STRING_POINTER.

◆ make_pass_ipa_asm_lgen()

ipa_opt_pass_d * make_pass_ipa_asm_lgen ( gcc::context * ctxt)

◆ make_pass_ipa_asm_wpa()

ipa_opt_pass_d * make_pass_ipa_asm_wpa ( gcc::context * ctxt)

◆ mark_fragile_ref_by_asm()

void mark_fragile_ref_by_asm ( symtab_node * node,
bool maybe_local = false )
static
Toplevel assembly.
   Copyright (C) 2025 Free Software Foundation, Inc.
   Contributed by Michal Jires <mjires@suse.cz>

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3.  If not see
<http://www.gnu.org/licenses/>.   
This symbol must be available and cannot be renamed.
Marks the symbol and symbols that reference it.   

References dyn_cast(), symtab_node::must_remain_in_tu_body, ipa_ref::referring, and TREE_PUBLIC.

Referenced by ipa_asm_heuristics(), and walk_through_constraints().

◆ walk_through_constraints()

tree walk_through_constraints ( tree * t,
int * ,
void * dat )
static