type
stringclasses
5 values
content
stringlengths
9
163k
functions
void fwprop_set_lattice_val (tree name, tree val) { if (TREE_CODE (name) == SSA_NAME) { if (SSA_NAME_VERSION (name) >= lattice.length ()) { lattice.reserve (num_ssa_names - lattice.length ()); lattice.quick_grow_cleared (num_ssa_names); }
functions
void fwprop_invalidate_lattice (tree name) { if (name && TREE_CODE (name) == SSA_NAME && SSA_NAME_VERSION (name) < lattice.length ()) lattice[SSA_NAME_VERSION (name)] = NULL_TREE; }
functions
gimple get_prop_source_stmt (tree name, bool single_use_only, bool *single_use_p) { bool single_use = true; do { gimple def_stmt = SSA_NAME_DEF_STMT (name); if (!has_single_use (name)) { single_use = false; if (single_use_only) return NULL; }
functions
bool can_propagate_from (gimple def_stmt) { gcc_assert (is_gimple_assign (def_stmt)); /* If the rhs has side-effects we cannot propagate from it. */ if (gimple_has_volatile_ops (def_stmt)) return false; /* If the rhs is a load we cannot propagate from it. */ if (TREE_CODE_CLASS (gimple_assign_rhs_code...
functions
bool remove_prop_source_from_use (tree name) { gimple_stmt_iterator gsi; gimple stmt; bool cfg_changed = false; do { basic_block bb; if (SSA_NAME_IN_FREE_LIST (name) || SSA_NAME_IS_DEFAULT_DEF (name) || !has_zero_uses (name)) return cfg_changed; stmt = SSA_NAME_DEF_STMT (name); if (gi...
functions
tree rhs_to_tree (tree type, gimple stmt) { location_t loc = gimple_location (stmt); enum tree_code code = gimple_assign_rhs_code (stmt); if (get_gimple_rhs_class (code) == GIMPLE_TERNARY_RHS) return fold_build3_loc (loc, code, type, gimple_assign_rhs1 (stmt), gimple_assign_rhs2 (stmt), gimple_a...
functions
tree combine_cond_expr_cond (gimple stmt, enum tree_code code, tree type, tree op0, tree op1, bool invariant_only) { tree t; gcc_assert (TREE_CODE_CLASS (code) == tcc_comparison); fold_defer_overflow_warnings (); t = fold_binary_loc (gimple_location (stmt), code, type, op0, op1); if (!t) { fold...
functions
tree forward_propagate_into_comparison_1 (gimple stmt, enum tree_code code, tree type, tree op0, tree op1) { tree tmp = NULL_TREE; tree rhs0 = NULL_TREE, rhs1 = NULL_TREE; bool single_use0_p = false, single_use1_p = false; /* For comparisons use the first operand, that is likely to simpl...
functions
int forward_propagate_into_comparison (gimple_stmt_iterator *gsi) { gimple stmt = gsi_stmt (*gsi); tree tmp; bool cfg_changed = false; tree type = TREE_TYPE (gimple_assign_lhs (stmt)); tree rhs1 = gimple_assign_rhs1 (stmt); tree rhs2 = gimple_assign_rhs2 (stmt); /* Combine the comparison with defining s...
functions
int forward_propagate_into_gimple_cond (gcond *stmt) { tree tmp; enum tree_code code = gimple_cond_code (stmt); bool cfg_changed = false; tree rhs1 = gimple_cond_lhs (stmt); tree rhs2 = gimple_cond_rhs (stmt); /* We can do tree combining on SSA_NAME and comparison expressions. */ if (TREE_CODE_CLASS (gi...
functions
bool forward_propagate_into_cond (gimple_stmt_iterator *gsi_p) { gimple stmt = gsi_stmt (*gsi_p); tree tmp = NULL_TREE; tree cond = gimple_assign_rhs1 (stmt); enum tree_code code = gimple_assign_rhs_code (stmt); /* We can do tree combining on SSA_NAME and comparison expressions. */ if (COMPARISON_CLASS_P ...
functions
void tidy_after_forward_propagate_addr (gimple stmt) { /* We may have turned a trapping insn into a non-trapping insn. */ if (maybe_clean_or_replace_eh_stmt (stmt, stmt)) bitmap_set_bit (to_purge, gimple_bb (stmt)->index); if (TREE_CODE (gimple_assign_rhs1 (stmt)) == ADDR_EXPR) recompute_tree_invariant...
functions
bool forward_propagate_addr_expr_1 (tree name, tree def_rhs, gimple_stmt_iterator *use_stmt_gsi, bool single_use_p) { tree lhs, rhs, rhs2, array_ref; gimple use_stmt = gsi_stmt (*use_stmt_gsi); enum tree_code rhs_code; bool res = true; gcc_assert (TREE_CODE (def_rhs) == ADDR_EXPR); lhs...
functions
bool forward_propagate_addr_expr (tree name, tree rhs, bool parent_single_use_p) { imm_use_iterator iter; gimple use_stmt; bool all = true; bool single_use_p = parent_single_use_p && has_single_use (name); FOR_EACH_IMM_USE_STMT (use_stmt, iter, name) { bool result; tree use_rhs; /* If ...
functions
void simplify_gimple_switch_label_vec (gswitch *stmt, tree index_type) { unsigned int branch_num = gimple_switch_num_labels (stmt); auto_vec<tree> labels (branch_num); unsigned int i, len; /* Collect the existing case labels in a VEC, and preprocess it as if we are gimplifying a GENERIC SWITCH_EXPR. */ ...
functions
bool simplify_gimple_switch (gswitch *stmt) { /* The optimization that we really care about is removing unnecessary casts. That will let us do much better in propagating the inferred constant at the switch target. */ tree cond = gimple_switch_index (stmt); if (TREE_CODE (cond) == SSA_NAME) { ...
functions
tree constant_pointer_difference (tree p1, tree p2) { int i, j; tree exps[2][CPD_ITERATIONS]; tree offs[2][CPD_ITERATIONS]; int cnt[2]; for (i = 0; i < 2; i++) { tree p = i ? p1 : p2; tree off = size_zero_node; gimple stmt; enum tree_code code; /* For each of p1 and p2 we ...
functions
bool simplify_builtin_call (gimple_stmt_iterator *gsi_p, tree callee2) { gimple stmt1, stmt2 = gsi_stmt (*gsi_p); tree vuse = gimple_vuse (stmt2); if (vuse == NULL) return false; stmt1 = SSA_NAME_DEF_STMT (vuse); switch (DECL_FUNCTION_CODE (callee2)) { case BUILT_IN_MEMSET: if (gimple_call_...
functions
void defcodefor_name (tree name, enum tree_code *code, tree *arg1, tree *arg2) { gimple def; enum tree_code code1; tree arg11; tree arg21; tree arg31; enum gimple_rhs_class grhs_class; code1 = TREE_CODE (name); arg11 = name; arg21 = NULL_TREE; grhs_class = get_gimple_rhs_class (code1); if (code1...
functions
bool simplify_rotate (gimple_stmt_iterator *gsi) { gimple stmt = gsi_stmt (*gsi); tree arg[2], rtype, rotcnt = NULL_TREE; tree def_arg1[2], def_arg2[2]; enum tree_code def_code[2]; tree lhs; int i; bool swapped_p = false; gimple g; arg[0] = gimple_assign_rhs1 (stmt); arg[1] = gimple_assign_rhs2 (st...
functions
bool simplify_bitfield_ref (gimple_stmt_iterator *gsi) { gimple stmt = gsi_stmt (*gsi); gimple def_stmt; tree op, op0, op1, op2; tree elem_type; unsigned idx, n, size; enum tree_code code; op = gimple_assign_rhs1 (stmt); gcc_checking_assert (TREE_CODE (op) == BIT_FIELD_REF); op0 = TREE_OPERAND (op, ...
functions
int is_combined_permutation_identity (tree mask1, tree mask2) { tree mask; unsigned int nelts, i, j; bool maybe_identity1 = true; bool maybe_identity2 = true; gcc_checking_assert (TREE_CODE (mask1) == VECTOR_CST && TREE_CODE (mask2) == VECTOR_CST); mask = fold_ternary (VEC_PERM_EXPR, TREE_TYPE (ma...
functions
int simplify_permutation (gimple_stmt_iterator *gsi) { gimple stmt = gsi_stmt (*gsi); gimple def_stmt; tree op0, op1, op2, op3, arg0, arg1; enum tree_code code; bool single_use_op0 = false; gcc_checking_assert (gimple_assign_rhs_code (stmt) == VEC_PERM_EXPR); op0 = gimple_assign_rhs1 (stmt); op1 = gim...
functions
else if (code == CONSTRUCTOR || code == VECTOR_CST) { tree opt; bool ret = false; if (op0 != op1) { if (TREE_CODE (op0) == SSA_NAME && !single_use_op0) return 0; if (TREE_CODE (op1) == VECTOR_CST) arg1 = op1; else if (TREE_CODE (op1) == SSA_NAME) { enum tree_code c...
functions
bool simplify_vector_constructor (gimple_stmt_iterator *gsi) { gimple stmt = gsi_stmt (*gsi); gimple def_stmt; tree op, op2, orig, type, elem_type; unsigned elem_size, nelts, i; enum tree_code code; constructor_elt *elt; unsigned char *sel; bool maybe_ident; gcc_checking_assert (gimple_assign_rhs_cod...
functions
tree fwprop_ssa_val (tree name) { /* First valueize NAME. */ if (TREE_CODE (name) == SSA_NAME && SSA_NAME_VERSION (name) < lattice.length ()) { tree val = lattice[SSA_NAME_VERSION (name)]; if (val) name = val; }
functions
bool gate (function *) { return flag_tree_forwprop; }
functions
else if (code == POINTER_PLUS_EXPR) { tree off = gimple_assign_rhs2 (stmt); if (TREE_CODE (off) == INTEGER_CST && can_propagate_from (stmt) && !simple_iv_increment_p (stmt) /* ??? Better adjust the interface to that function instead of building new trees here. */ && forward_p...
functions
else if (code == COMPLEX_EXPR) { /* Rewrite stores of a single-use complex build expression to component-wise stores. */ use_operand_p use_p; gimple use_stmt; if (single_imm_use (lhs, &use_p, &use_stmt) && gimple_store_p (use_stmt) && !gimple_has_volatile_ops (use_stm...
functions
else if (code == VEC_PERM_EXPR) { int did_something = simplify_permutation (&gsi); if (did_something == 2) cfg_changed = true; changed = did_something != 0; }
includes
#include <linux/module.h>
includes
#include <linux/sched.h>
includes
#include <linux/string.h>
includes
#include <linux/errno.h>
includes
#include <linux/delay.h>
includes
#include <linux/types.h>
includes
#include <linux/pci.h>
includes
#include <linux/etherdevice.h>
includes
#include <linux/skbuff.h>
includes
#include <linux/crc32.h>
includes
#include <linux/ethtool.h>
includes
#include <linux/mii.h>
includes
#include <linux/bitops.h>
includes
#include <linux/workqueue.h>
includes
#include <linux/of.h>
includes
#include <linux/of_net.h>
includes
#include <linux/slab.h>
includes
#include <asm/processor.h>
includes
#include <asm/io.h>
includes
#include <asm/dma.h>
includes
#include <asm/uaccess.h>
includes
#include <asm/dcr.h>
includes
#include <asm/dcr-regs.h>
defines
#define DRV_NAME "emac"
defines
#define DRV_VERSION "3.54"
defines
#define DRV_DESC "PPC 4xx OCP EMAC driver"
defines
#define cacheable_memcpy(d,s,n) memcpy((d),(s),(n))
defines
#define EMAC_TX_WAKEUP_THRESH (NUM_TX_BUFF / 4)
defines
#define EMAC_RX_COPY_THRESH CONFIG_IBM_EMAC_RX_COPY_THRESHOLD
defines
#define EMAC_BOOT_LIST_SIZE 4
defines
#define EMAC_PROBE_DEP_TIMEOUT (HZ * 5)
defines
#define PHY_POLL_LINK_ON HZ
defines
#define PHY_POLL_LINK_OFF (HZ / 5)
defines
#define STOP_TIMEOUT_10 1230
defines
#define STOP_TIMEOUT_100 124
defines
#define STOP_TIMEOUT_1000 13
defines
#define STOP_TIMEOUT_1000_JUMBO 73
defines
#define EMAC_DEP_MAL_IDX 0
defines
#define EMAC_DEP_ZMII_IDX 1
defines
#define EMAC_DEP_RGMII_IDX 2
defines
#define EMAC_DEP_TAH_IDX 3
defines
#define EMAC_DEP_MDIO_IDX 4
defines
#define EMAC_DEP_PREV_IDX 5
defines
#define EMAC_DEP_COUNT 6
structs
struct emac_depentry { u32 phandle; struct device_node *node; struct platform_device *ofdev; void *drvdata; };
functions
void emac_report_timeout_error(struct emac_instance *dev, const char *error) { if (emac_has_feature(dev, EMAC_FTR_440GX_PHY_CLK_FIX | EMAC_FTR_460EX_PHY_CLK_FIX | EMAC_FTR_440EP_PHY_CLK_FIX)) DBG(dev, "%s" NL, error); else if (net_ratelimit()) printk(KERN_ERR "%s: %s\n", dev->ofdev->dev.of_n...
functions
void emac_rx_clk_tx(struct emac_instance *dev) { #ifdef CONFIG_PPC_DCR_NATIVE if (emac_has_feature(dev, EMAC_FTR_440EP_PHY_CLK_FIX)) dcri_clrset(SDR0, SDR0_MFR, 0, SDR0_MFR_ECS >> dev->cell_index); #endif }
functions
void emac_rx_clk_default(struct emac_instance *dev) { #ifdef CONFIG_PPC_DCR_NATIVE if (emac_has_feature(dev, EMAC_FTR_440EP_PHY_CLK_FIX)) dcri_clrset(SDR0, SDR0_MFR, SDR0_MFR_ECS >> dev->cell_index, 0); #endif }
functions
int emac_phy_supports_gige(int phy_mode) { return phy_mode == PHY_MODE_GMII || phy_mode == PHY_MODE_RGMII || phy_mode == PHY_MODE_SGMII || phy_mode == PHY_MODE_TBI || phy_mode == PHY_MODE_RTBI; }
functions
int emac_phy_gpcs(int phy_mode) { return phy_mode == PHY_MODE_SGMII || phy_mode == PHY_MODE_TBI || phy_mode == PHY_MODE_RTBI; }
functions
void emac_tx_enable(struct emac_instance *dev) { struct emac_regs __iomem *p = dev->emacp; u32 r; DBG(dev, "tx_enable" NL); r = in_be32(&p->mr0); if (!(r & EMAC_MR0_TXE)) out_be32(&p->mr0, r | EMAC_MR0_TXE); }
functions
void emac_tx_disable(struct emac_instance *dev) { struct emac_regs __iomem *p = dev->emacp; u32 r; DBG(dev, "tx_disable" NL); r = in_be32(&p->mr0); if (r & EMAC_MR0_TXE) { int n = dev->stop_timeout; out_be32(&p->mr0, r & ~EMAC_MR0_TXE); while (!(in_be32(&p->mr0) & EMAC_MR0_TXI) && n) { udelay(1); --n...
functions
void emac_rx_enable(struct emac_instance *dev) { struct emac_regs __iomem *p = dev->emacp; u32 r; if (unlikely(test_bit(MAL_COMMAC_RX_STOPPED, &dev->commac.flags))) goto out; DBG(dev, "rx_enable" NL); r = in_be32(&p->mr0); if (!(r & EMAC_MR0_RXE)) { if (unlikely(!(r & EMAC_MR0_RXI))) { /* Wait if previo...
functions
void emac_rx_disable(struct emac_instance *dev) { struct emac_regs __iomem *p = dev->emacp; u32 r; DBG(dev, "rx_disable" NL); r = in_be32(&p->mr0); if (r & EMAC_MR0_RXE) { int n = dev->stop_timeout; out_be32(&p->mr0, r & ~EMAC_MR0_RXE); while (!(in_be32(&p->mr0) & EMAC_MR0_RXI) && n) { udelay(1); --n...
functions
void emac_netif_stop(struct emac_instance *dev) { netif_tx_lock_bh(dev->ndev); netif_addr_lock(dev->ndev); dev->no_mcast = 1; netif_addr_unlock(dev->ndev); netif_tx_unlock_bh(dev->ndev); dev->ndev->trans_start = jiffies; /* prevent tx timeout */ mal_poll_disable(dev->mal, &dev->commac); netif_tx_disable(dev->nd...
functions
void emac_netif_start(struct emac_instance *dev) { netif_tx_lock_bh(dev->ndev); netif_addr_lock(dev->ndev); dev->no_mcast = 0; if (dev->mcast_pending && netif_running(dev->ndev)) __emac_set_multicast_list(dev); netif_addr_unlock(dev->ndev); netif_tx_unlock_bh(dev->ndev); netif_wake_queue(dev->ndev); /* NOTE...
functions
void emac_rx_disable_async(struct emac_instance *dev) { struct emac_regs __iomem *p = dev->emacp; u32 r; DBG(dev, "rx_disable_async" NL); r = in_be32(&p->mr0); if (r & EMAC_MR0_RXE) out_be32(&p->mr0, r & ~EMAC_MR0_RXE); }
functions
int emac_reset(struct emac_instance *dev) { struct emac_regs __iomem *p = dev->emacp; int n = 20; DBG(dev, "reset" NL); if (!dev->reset_failed) { /* 40x erratum suggests stopping RX channel before reset, * we stop TX as well */ emac_rx_disable(dev); emac_tx_disable(dev); }
functions
endif if (n) { dev->reset_failed = 0; return 0; }
functions
void emac_hash_mc(struct emac_instance *dev) { const int regs = EMAC_XAHT_REGS(dev); u32 *gaht_base = emac_gaht_base(dev); u32 gaht_temp[regs]; struct netdev_hw_addr *ha; int i; DBG(dev, "hash_mc %d" NL, netdev_mc_count(dev->ndev)); memset(gaht_temp, 0, sizeof (gaht_temp)); netdev_for_each_mc_addr(ha, dev->n...
functions
u32 emac_iff2rmr(struct net_device *ndev) { struct emac_instance *dev = netdev_priv(ndev); u32 r; r = EMAC_RMR_SP | EMAC_RMR_SFCS | EMAC_RMR_IAE | EMAC_RMR_BAE; if (emac_has_feature(dev, EMAC_FTR_EMAC4)) r |= EMAC4_RMR_BASE; else r |= EMAC_RMR_BASE; if (ndev->flags & IFF_PROMISC) r |= EMAC_RMR_PME;...
functions
u32 __emac_calc_base_mr1(struct emac_instance *dev, int tx_size, int rx_size) { u32 ret = EMAC_MR1_VLE | EMAC_MR1_IST | EMAC_MR1_TR0_MULT; DBG2(dev, "__emac_calc_base_mr1" NL); switch(tx_size) { case 2048: ret |= EMAC_MR1_TFS_2K; break; default: printk(KERN_WARNING "%s: Unknown Tx FIFO size %d\n", ...
functions
u32 __emac4_calc_base_mr1(struct emac_instance *dev, int tx_size, int rx_size) { u32 ret = EMAC_MR1_VLE | EMAC_MR1_IST | EMAC4_MR1_TR | EMAC4_MR1_OBCI(dev->opb_bus_freq / 1000000); DBG2(dev, "__emac4_calc_base_mr1" NL); switch(tx_size) { case 16384: ret |= EMAC4_MR1_TFS_16K; break; case 4096: ret |= EMAC...
functions
u32 emac_calc_base_mr1(struct emac_instance *dev, int tx_size, int rx_size) { return emac_has_feature(dev, EMAC_FTR_EMAC4) ? __emac4_calc_base_mr1(dev, tx_size, rx_size) : __emac_calc_base_mr1(dev, tx_size, rx_size); }
functions
u32 emac_calc_trtr(struct emac_instance *dev, unsigned int size) { if (emac_has_feature(dev, EMAC_FTR_EMAC4)) return ((size >> 6) - 1) << EMAC_TRTR_SHIFT_EMAC4; else return ((size >> 6) - 1) << EMAC_TRTR_SHIFT; }
functions
u32 emac_calc_rwmr(struct emac_instance *dev, unsigned int low, unsigned int high) { if (emac_has_feature(dev, EMAC_FTR_EMAC4)) return (low << 22) | ( (high & 0x3ff) << 6); else return (low << 23) | ( (high & 0x1ff) << 7); }
functions
int emac_configure(struct emac_instance *dev) { struct emac_regs __iomem *p = dev->emacp; struct net_device *ndev = dev->ndev; int tx_size, rx_size, link = netif_carrier_ok(dev->ndev); u32 r, mr1 = 0; DBG(dev, "configure" NL); if (!link) { out_be32(&p->mr1, in_be32(&p->mr1) | EMAC_MR1_FDE | EMAC_MR1_ILE);...
functions
void emac_reinitialize(struct emac_instance *dev) { DBG(dev, "reinitialize" NL); emac_netif_stop(dev); if (!emac_configure(dev)) { emac_tx_enable(dev); emac_rx_enable(dev); }
functions
void emac_full_tx_reset(struct emac_instance *dev) { DBG(dev, "full_tx_reset" NL); emac_tx_disable(dev); mal_disable_tx_channel(dev->mal, dev->mal_tx_chan); emac_clean_tx_ring(dev); dev->tx_cnt = dev->tx_slot = dev->ack_slot = 0; emac_configure(dev); mal_enable_tx_channel(dev->mal, dev->mal_tx_chan); emac_tx...
functions
void emac_reset_work(struct work_struct *work) { struct emac_instance *dev = container_of(work, struct emac_instance, reset_work); DBG(dev, "reset_work" NL); mutex_lock(&dev->link_lock); if (dev->opened) { emac_netif_stop(dev); emac_full_tx_reset(dev); emac_netif_start(dev); }