static struct ir3_instruction * instr_cp_fanin(struct ir3_instruction *instr) { unsigned i; /* we need to handle fanin specially, to detect cases * when we need to keep a mov */ for (i = 1; i < instr->regs_count; i++) { struct ir3_register *src = instr->regs[i]; if (src->flags & IR3_REG_SSA) { struct ir3_instruction *cand = instr_cp(src->instr, false); /* if the candidate is a fanout, then keep * the move. * * This is a bit, um, fragile, but it should * catch the extra mov's that the front-end * puts in for us already in these cases. */ if (is_meta(cand) && (cand->opc == OPC_META_FO)) cand = instr_cp(src->instr, true); src->instr = cand; } } walk_children(instr, false); return instr; }
////////////////////////////////////////////////////////////////////////// // DataNode* from Entity ////////////////////////////////////////////////////////////////////////// path::DataNode& get_data_node_from_entity(Entity & entity, path::RootSchemaNode & root_schema) { EntityPath root_path = get_entity_path(entity, nullptr); auto & root_data_node = root_schema.create_datanode(root_path.path); if(is_set(entity.yfilter)) { add_annotation_to_datanode(entity, root_data_node); } YLOG_DEBUG("Root entity: {}", root_path.path); populate_name_values(root_data_node, root_path); walk_children(entity, root_data_node); return root_data_node; }
static void populate_data_node(Entity & entity, path::DataNode & parent_data_node) { EntityPath path = get_entity_path(entity, entity.parent); path::DataNode* data_node = &parent_data_node.create_datanode(path.path); YLOG_DEBUG("Created child datanode '{}'", path.path); if(is_set(entity.yfilter)) { add_annotation_to_datanode(entity, *data_node); } populate_name_values(*data_node, path); walk_children(entity, *data_node); }
static struct ir3_instruction * instr_cp(struct ir3_instruction *instr, bool keep) { /* if we've already visited this instruction, bail now: */ if (ir3_instr_check_mark(instr)) return instr; if (is_meta(instr) && (instr->opc == OPC_META_FI)) return instr_cp_fanin(instr); if (is_eligible_mov(instr) && !keep) { struct ir3_register *src = instr->regs[1]; return instr_cp(src->instr, false); } walk_children(instr, false); return instr; }
static void __init walk_children(struct device_node *dp, struct sbus_dev *parent, struct sbus_bus *sbus) { dp = dp->child; while (dp) { struct sbus_dev *sdev; sdev = kzalloc(sizeof(struct sbus_dev), GFP_ATOMIC); if (sdev) { sdev_insert(sdev, &parent->child); sdev->bus = sbus; sdev->parent = parent; fill_sbus_device(dp, sdev); walk_children(dp, sdev, sbus); } dp = dp->sibling; } }
static void __init build_one_sbus(struct device_node *dp, int num_sbus) { struct sbus_bus *sbus; unsigned int sbus_clock; struct device_node *dev_dp; sbus = kzalloc(sizeof(struct sbus_bus), GFP_ATOMIC); if (!sbus) return; sbus_insert(sbus, &sbus_root); sbus->prom_node = dp->node; sbus_setup_iommu(sbus, dp); printk("sbus%d: ", num_sbus); sbus_clock = of_getintprop_default(dp, "clock-frequency", (25*1000*1000)); sbus->clock_freq = sbus_clock; printk("Clock %d.%d MHz\n", (int) ((sbus_clock/1000)/1000), (int) (((sbus_clock/1000)%1000 != 0) ? (((sbus_clock/1000)%1000) + 1000) : 0)); strcpy(sbus->prom_name, dp->name); sbus_setup_arch_props(sbus, dp); sbus_bus_ranges_init(dp, sbus); sbus->ofdev.node = dp; sbus->ofdev.dev.parent = NULL; sbus->ofdev.dev.bus = &sbus_bus_type; sprintf(sbus->ofdev.dev.bus_id, "sbus%d", num_sbus); if (of_device_register(&sbus->ofdev) != 0) printk(KERN_DEBUG "sbus: device registration error for %s!\n", sbus->ofdev.dev.bus_id); dev_dp = dp->child; while (dev_dp) { struct sbus_dev *sdev; sdev = kzalloc(sizeof(struct sbus_dev), GFP_ATOMIC); if (sdev) { sdev_insert(sdev, &sbus->devices); sdev->bus = sbus; sdev->parent = NULL; fill_sbus_device(dev_dp, sdev); walk_children(dev_dp, sdev, sbus); } dev_dp = dev_dp->sibling; } sbus_fixup_all_regs(sbus->devices); dvma_init(sbus); }
int internal_function __libdw_visit_scopes (unsigned int depth, struct Dwarf_Die_Chain *root, struct Dwarf_Die_Chain *imports, int (*previsit) (unsigned int, struct Dwarf_Die_Chain *, void *), int (*postvisit) (unsigned int, struct Dwarf_Die_Chain *, void *), void *arg) { struct Dwarf_Die_Chain child; int ret; child.parent = root; if ((ret = INTUSE(dwarf_child) (&root->die, &child.die)) != 0) return ret < 0 ? -1 : 0; // Having zero children is legal. inline int recurse (void) { return __libdw_visit_scopes (depth + 1, &child, imports, previsit, postvisit, arg); } /* Checks the given DIE hasn't been imported yet to prevent cycles. */ inline bool imports_contains (Dwarf_Die *die) { for (struct Dwarf_Die_Chain *import = imports; import != NULL; import = import->parent) if (import->die.addr == die->addr) return true; return false; } inline int walk_children (void) { do { /* For an imported unit, it is logically as if the children of that unit are siblings of the other children. So don't do a full recursion into the imported unit, but just walk the children in place before moving to the next real child. */ while (INTUSE(dwarf_tag) (&child.die) == DW_TAG_imported_unit) { Dwarf_Die orig_child_die = child.die; Dwarf_Attribute attr_mem; Dwarf_Attribute *attr = INTUSE(dwarf_attr) (&child.die, DW_AT_import, &attr_mem); if (INTUSE(dwarf_formref_die) (attr, &child.die) != NULL && INTUSE(dwarf_child) (&child.die, &child.die) == 0) { if (imports_contains (&orig_child_die)) { __libdw_seterrno (DWARF_E_INVALID_DWARF); return -1; } struct Dwarf_Die_Chain *orig_imports = imports; struct Dwarf_Die_Chain import = { .die = orig_child_die, .parent = orig_imports }; imports = &import; int result = walk_children (); imports = orig_imports; if (result != DWARF_CB_OK) return result; } /* Any "real" children left? */ if ((ret = INTUSE(dwarf_siblingof) (&orig_child_die, &child.die)) != 0) return ret < 0 ? -1 : 0; }; child.prune = false; /* previsit is declared NN */ int result = (*previsit) (depth + 1, &child, arg); if (result != DWARF_CB_OK) return result; if (!child.prune && may_have_scopes (&child.die) && INTUSE(dwarf_haschildren) (&child.die)) { result = recurse (); if (result != DWARF_CB_OK) return result; } if (postvisit != NULL) { result = (*postvisit) (depth + 1, &child, arg); if (result != DWARF_CB_OK) return result; } } while ((ret = INTUSE(dwarf_siblingof) (&child.die, &child.die)) == 0); return ret < 0 ? -1 : 0; } return walk_children (); }