Cleaned up RESTRICT and ATTR_ALIGN usage. (nw)

This commit is contained in:
couriersud 2015-05-24 16:43:47 +02:00
parent 9779dd7bbf
commit 036ce19c55
19 changed files with 80 additions and 76 deletions

View File

@ -48,7 +48,7 @@ public:
protected:
ATTR_COLD virtual void start();
ATTR_COLD virtual void reset();
ATTR_HOT ATTR_ALIGN void update();
ATTR_HOT void update();
netlist_param_model_t m_model;
private:
@ -99,7 +99,7 @@ public:
m_gB(NETLIST_GMIN_DEFAULT), m_gC(NETLIST_GMIN_DEFAULT), m_V(0.0), m_state_on(0) { }
ATTR_HOT ATTR_ALIGN void virtual update();
ATTR_HOT void virtual update();
nld_twoterm m_RB;
nld_twoterm m_RC;
@ -145,7 +145,7 @@ protected:
ATTR_COLD virtual void start();
ATTR_COLD virtual void reset();
ATTR_HOT void update_param();
ATTR_HOT ATTR_ALIGN void virtual update();
ATTR_HOT void virtual update();
NETLIB_UPDATE_TERMINALSI();
netlist_generic_diode m_gD_BC;

View File

@ -59,7 +59,7 @@ protected:
ATTR_COLD virtual void start();
ATTR_COLD virtual void reset();
ATTR_COLD virtual void update_param();
ATTR_HOT ATTR_ALIGN void update();
ATTR_HOT void update();
ATTR_COLD void start_internal(const nl_double def_RI);
@ -115,7 +115,7 @@ protected:
ATTR_COLD virtual void start();
ATTR_COLD virtual void reset();
ATTR_COLD virtual void update_param();
ATTR_HOT ATTR_ALIGN void update();
ATTR_HOT void update();
nl_double m_gfac;
};
@ -159,7 +159,7 @@ protected:
ATTR_COLD virtual void start();
ATTR_COLD virtual void reset();
ATTR_COLD virtual void update_param();
//ATTR_HOT ATTR_ALIGN void update();
//ATTR_HOT void update();
netlist_terminal_t m_OP2;
netlist_terminal_t m_ON2;

View File

@ -36,9 +36,9 @@ protected:
ATTR_HOT void build_LE_A();
ATTR_HOT void build_LE_RHS();
ATTR_HOT void LE_solve();
ATTR_HOT void LE_back_subst(nl_double (* RESTRICT x));
ATTR_HOT nl_double delta(const nl_double (* RESTRICT V));
ATTR_HOT void store(const nl_double (* RESTRICT V), const bool store_RHS);
ATTR_HOT void LE_back_subst(nl_double * RESTRICT x);
ATTR_HOT nl_double delta(const nl_double * RESTRICT V);
ATTR_HOT void store(const nl_double * RESTRICT V, const bool store_RHS);
/* bring the whole system to the current time
* Don't schedule a new calculation time. The recalculation has to be
@ -46,10 +46,10 @@ protected:
*/
ATTR_HOT nl_double compute_next_timestep();
nl_double m_A[_storage_N][((_storage_N + 7) / 8) * 8];
nl_double m_RHS[_storage_N];
nl_double m_last_RHS[_storage_N]; // right hand side - contains currents
nl_double m_last_V[_storage_N];
ATTR_ALIGN nl_double m_A[_storage_N][((_storage_N + 7) / 8) * 8];
ATTR_ALIGN nl_double m_RHS[_storage_N];
ATTR_ALIGN nl_double m_last_RHS[_storage_N]; // right hand side - contains currents
ATTR_ALIGN nl_double m_last_V[_storage_N];
terms_t **m_terms;
terms_t *m_rails_temp;
@ -316,7 +316,7 @@ ATTR_HOT void netlist_matrix_solver_direct_t<m_N, _storage_N>::LE_solve()
template <int m_N, int _storage_N>
ATTR_HOT void netlist_matrix_solver_direct_t<m_N, _storage_N>::LE_back_subst(
nl_double (* RESTRICT x))
nl_double * RESTRICT x)
{
const int kN = N();
@ -345,7 +345,7 @@ ATTR_HOT void netlist_matrix_solver_direct_t<m_N, _storage_N>::LE_back_subst(
template <int m_N, int _storage_N>
ATTR_HOT nl_double netlist_matrix_solver_direct_t<m_N, _storage_N>::delta(
const nl_double (* RESTRICT V))
const nl_double * RESTRICT V)
{
nl_double cerr = 0;
nl_double cerr2 = 0;
@ -362,7 +362,7 @@ ATTR_HOT nl_double netlist_matrix_solver_direct_t<m_N, _storage_N>::delta(
template <int m_N, int _storage_N>
ATTR_HOT void netlist_matrix_solver_direct_t<m_N, _storage_N>::store(
const nl_double (* RESTRICT V), const bool store_RHS)
const nl_double * RESTRICT V, const bool store_RHS)
{
for (int i = 0; i < this->N(); i++)
{

View File

@ -11,7 +11,7 @@
#include "nld_solver.h"
#include "nld_ms_direct.h"
class ATTR_ALIGNED(64) netlist_matrix_solver_direct1_t: public netlist_matrix_solver_direct_t<1,1>
class netlist_matrix_solver_direct1_t: public netlist_matrix_solver_direct_t<1,1>
{
public:

View File

@ -13,7 +13,7 @@
class ATTR_ALIGNED(64) netlist_matrix_solver_direct2_t: public netlist_matrix_solver_direct_t<2,2>
class netlist_matrix_solver_direct2_t: public netlist_matrix_solver_direct_t<2,2>
{
public:

View File

@ -12,7 +12,7 @@
#include "nld_ms_direct.h"
template <int m_N, int _storage_N>
class ATTR_ALIGNED(64) netlist_matrix_solver_SOR_t: public netlist_matrix_solver_direct_t<m_N, _storage_N>
class netlist_matrix_solver_SOR_t: public netlist_matrix_solver_direct_t<m_N, _storage_N>
{
public:

View File

@ -16,7 +16,7 @@
#include "nld_ms_direct.h"
template <int m_N, int _storage_N>
class ATTR_ALIGNED(64) netlist_matrix_solver_SOR_t: public netlist_matrix_solver_direct_t<m_N, _storage_N>
class netlist_matrix_solver_SOR_t: public netlist_matrix_solver_direct_t<m_N, _storage_N>
{
public:

View File

@ -16,7 +16,7 @@
#include "nld_ms_direct.h"
template <int m_N, int _storage_N>
class ATTR_ALIGNED(64) netlist_matrix_solver_SOR_mat_t: public netlist_matrix_solver_direct_t<m_N, _storage_N>
class netlist_matrix_solver_SOR_mat_t: public netlist_matrix_solver_direct_t<m_N, _storage_N>
{
public:

View File

@ -45,7 +45,7 @@ struct netlist_solver_parameters_t
};
class ATTR_ALIGNED(64) terms_t
class terms_t
{
NETLIST_PREVENT_COPYING(terms_t)
@ -164,7 +164,7 @@ private:
class ATTR_ALIGNED(64) NETLIB_NAME(solver) : public netlist_device_t
class NETLIB_NAME(solver) : public netlist_device_t
{
public:
NETLIB_NAME(solver)()

View File

@ -124,7 +124,7 @@ public:
protected:
ATTR_COLD virtual void start();
ATTR_COLD virtual void reset();
ATTR_HOT ATTR_ALIGN void update();
ATTR_HOT void update();
private:
};
@ -146,7 +146,7 @@ public:
protected:
ATTR_COLD virtual void start();
ATTR_COLD virtual void reset();
ATTR_HOT ATTR_ALIGN void update();
ATTR_HOT void update();
};
NETLIB_DEVICE_WITH_PARAMS_DERIVED(R, R_base,
@ -196,7 +196,7 @@ protected:
ATTR_COLD virtual void start();
ATTR_COLD virtual void reset();
ATTR_COLD virtual void update_param();
ATTR_HOT ATTR_ALIGN void update();
ATTR_HOT void update();
netlist_param_double_t m_C;
@ -284,7 +284,7 @@ public:
protected:
ATTR_COLD virtual void start();
ATTR_COLD virtual void update_param();
ATTR_HOT ATTR_ALIGN void update();
ATTR_HOT void update();
netlist_param_model_t m_model;

View File

@ -198,7 +198,7 @@ ATTR_COLD void nld_d_to_a_proxy::reset()
m_is_timestep = m_RV.m_P.net().as_analog().solver()->is_timestep();
}
ATTR_HOT ATTR_ALIGN void nld_d_to_a_proxy::update()
ATTR_HOT void nld_d_to_a_proxy::update()
{
const int state = INPLOGIC(m_I);
if (state != m_last_state)

View File

@ -151,7 +151,7 @@ protected:
{
}
ATTR_HOT ATTR_ALIGN void update()
ATTR_HOT void update()
{
OUTANALOG(m_Q, 0.0);
}
@ -184,7 +184,7 @@ protected:
{
}
ATTR_HOT ATTR_ALIGN void update()
ATTR_HOT void update()
{
}
@ -217,7 +217,7 @@ protected:
{
}
ATTR_HOT ATTR_ALIGN void update()
ATTR_HOT void update()
{
OUTANALOG(m_Q, INPANALOG(m_I));
}
@ -249,8 +249,8 @@ protected:
ATTR_COLD void start();
ATTR_COLD void reset();
ATTR_HOT ATTR_ALIGN void update();
ATTR_HOT ATTR_ALIGN void update_param();
ATTR_HOT void update();
ATTR_HOT void update_param();
private:
UINT8 m_last_state;
@ -317,7 +317,7 @@ protected:
{
}
ATTR_HOT ATTR_ALIGN void update()
ATTR_HOT void update()
{
if (m_I.Q_Analog() > logic_family().m_high_thresh_V)
OUTLOGIC(m_Q, 1, NLTIME_FROM_NS(1));
@ -376,7 +376,7 @@ protected:
ATTR_COLD virtual void reset();
ATTR_HOT ATTR_ALIGN void update();
ATTR_HOT void update();
private:
netlist_analog_output_t m_Q;

View File

@ -206,7 +206,7 @@ public:
}
ATTR_HOT ATTR_ALIGN void update()
ATTR_HOT void update()
{
process<true>();
}

View File

@ -322,7 +322,7 @@ ATTR_COLD void netlist_base_t::reset()
}
ATTR_HOT ATTR_ALIGN void netlist_base_t::process_queue(const netlist_time &delta)
ATTR_HOT void netlist_base_t::process_queue(const netlist_time &delta)
{
m_stop = m_time + delta;
@ -451,7 +451,7 @@ ATTR_COLD void netlist_core_device_t::stop_dev()
stop();
}
ATTR_HOT ATTR_ALIGN netlist_sig_t netlist_core_device_t::INPLOGIC_PASSIVE(netlist_logic_input_t &inp)
ATTR_HOT netlist_sig_t netlist_core_device_t::INPLOGIC_PASSIVE(netlist_logic_input_t &inp)
{
if (inp.state() != netlist_logic_t::STATE_INP_PASSIVE)
return inp.Q();
@ -676,7 +676,7 @@ ATTR_HOT inline void netlist_core_terminal_t::update_dev(const UINT32 mask)
}
}
ATTR_HOT /*ATTR_ALIGN*/ inline void netlist_net_t::update_devs()
ATTR_HOT inline void netlist_net_t::update_devs()
{
//assert(m_num_cons != 0);
nl_assert(this->isRailNet());

View File

@ -189,19 +189,19 @@ typedef void (*net_update_delegate)(netlist_core_device_t *);
#define NETLIB_NAME_STR_S(_s) # _s
#define NETLIB_NAME_STR(_chip) NETLIB_NAME_STR_S(nld_ ## _chip)
#define NETLIB_UPDATE(_chip) ATTR_HOT ATTR_ALIGN void NETLIB_NAME(_chip) :: update(void)
#define NETLIB_UPDATE(_chip) ATTR_HOT void NETLIB_NAME(_chip) :: update(void)
#define NETLIB_START(_chip) ATTR_COLD void NETLIB_NAME(_chip) :: start(void)
#define NETLIB_RESET(_chip) ATTR_COLD void NETLIB_NAME(_chip) :: reset(void)
#define NETLIB_STOP(_chip) ATTR_COLD void NETLIB_NAME(_chip) :: stop(void)
#define NETLIB_UPDATE_PARAM(_chip) ATTR_HOT ATTR_ALIGN void NETLIB_NAME(_chip) :: update_param(void)
#define NETLIB_FUNC_VOID(_chip, _name, _params) ATTR_HOT ATTR_ALIGN void NETLIB_NAME(_chip) :: _name _params
#define NETLIB_UPDATE_PARAM(_chip) ATTR_HOT void NETLIB_NAME(_chip) :: update_param(void)
#define NETLIB_FUNC_VOID(_chip, _name, _params) ATTR_HOT void NETLIB_NAME(_chip) :: _name _params
#define NETLIB_UPDATE_TERMINALS(_chip) ATTR_HOT ATTR_ALIGN void NETLIB_NAME(_chip) :: update_terminals(void)
#define NETLIB_UPDATE_TERMINALSI() ATTR_HOT ATTR_ALIGN void update_terminals(void)
#define NETLIB_UPDATEI() ATTR_HOT ATTR_ALIGN void update(void)
#define NETLIB_UPDATE_TERMINALS(_chip) ATTR_HOT void NETLIB_NAME(_chip) :: update_terminals(void)
#define NETLIB_UPDATE_TERMINALSI() ATTR_HOT void update_terminals(void)
#define NETLIB_UPDATEI() ATTR_HOT void update(void)
#define NETLIB_DEVICE_BASE(_name, _pclass, _extra, _priv) \
class _name : public _pclass \
@ -400,8 +400,8 @@ public:
ATTR_HOT inline bool isType(const type_t atype) const { return (m_objtype == atype); }
ATTR_HOT inline bool isFamily(const family_t afamily) const { return (m_family == afamily); }
ATTR_HOT inline netlist_base_t & RESTRICT netlist() { return *m_netlist; }
ATTR_HOT inline const netlist_base_t & RESTRICT netlist() const { return *m_netlist; }
ATTR_HOT inline netlist_base_t & netlist() { return *m_netlist; }
ATTR_HOT inline const netlist_base_t & netlist() const { return *m_netlist; }
ATTR_COLD void inline do_reset()
{
@ -418,7 +418,7 @@ private:
pstring m_name;
const type_t m_objtype;
const family_t m_family;
netlist_base_t * RESTRICT m_netlist;
netlist_base_t * m_netlist;
};
// -----------------------------------------------------------------------------
@ -433,9 +433,9 @@ public:
ATTR_COLD void init_object(netlist_core_device_t &dev, const pstring &aname);
ATTR_HOT inline netlist_core_device_t & RESTRICT netdev() const { return *m_netdev; }
ATTR_HOT inline netlist_core_device_t &netdev() const { return *m_netdev; }
private:
netlist_core_device_t * RESTRICT m_netdev;
netlist_core_device_t * m_netdev;
};
// -----------------------------------------------------------------------------
@ -469,8 +469,8 @@ public:
ATTR_COLD inline void clear_net() { m_net = NULL; }
ATTR_HOT inline bool has_net() const { return (m_net != NULL); }
ATTR_HOT inline const netlist_net_t & RESTRICT net() const { return *m_net;}
ATTR_HOT inline netlist_net_t & RESTRICT net() { return *m_net;}
ATTR_HOT inline const netlist_net_t & net() const { return *m_net;}
ATTR_HOT inline netlist_net_t & net() { return *m_net;}
ATTR_HOT inline bool is_state(const state_e astate) const { return (m_state == astate); }
ATTR_HOT inline state_e state() const { return m_state; }
@ -491,19 +491,19 @@ protected:
}
private:
netlist_net_t * RESTRICT m_net;
netlist_net_t * m_net;
state_e m_state;
};
NETLIST_SAVE_TYPE(netlist_core_terminal_t::state_e, DT_INT);
class ATTR_ALIGN netlist_terminal_t : public netlist_core_terminal_t
class netlist_terminal_t : public netlist_core_terminal_t
{
NETLIST_PREVENT_COPYING(netlist_terminal_t)
public:
typedef plist_t<netlist_terminal_t * RESTRICT> list_t;
typedef plist_t<netlist_terminal_t *> list_t;
ATTR_COLD netlist_terminal_t();
@ -665,11 +665,11 @@ public:
ATTR_COLD void merge_net(netlist_net_t *othernet);
ATTR_COLD void register_railterminal(netlist_core_terminal_t &mr);
ATTR_HOT inline netlist_logic_net_t & RESTRICT as_logic();
ATTR_HOT inline const netlist_logic_net_t & RESTRICT as_logic() const;
ATTR_HOT inline netlist_logic_net_t & as_logic();
ATTR_HOT inline const netlist_logic_net_t & as_logic() const;
ATTR_HOT inline netlist_analog_net_t & RESTRICT as_analog();
ATTR_HOT inline const netlist_analog_net_t & RESTRICT as_analog() const;
ATTR_HOT inline netlist_analog_net_t & as_analog();
ATTR_HOT inline const netlist_analog_net_t & as_analog() const;
ATTR_HOT void update_devs();
@ -714,7 +714,7 @@ protected: //FIXME: needed by current solver code
private:
netlist_core_terminal_t * RESTRICT m_railterminal;
netlist_core_terminal_t * m_railterminal;
plinkedlist_t<netlist_core_terminal_t> m_list_active;
netlist_time m_time;
@ -1310,25 +1310,25 @@ ATTR_HOT inline void netlist_param_double_t::setTo(const nl_double param)
}
}
ATTR_HOT inline netlist_logic_net_t & RESTRICT netlist_net_t::as_logic()
ATTR_HOT inline netlist_logic_net_t & netlist_net_t::as_logic()
{
nl_assert(family() == LOGIC);
return static_cast<netlist_logic_net_t &>(*this);
}
ATTR_HOT inline const netlist_logic_net_t & RESTRICT netlist_net_t::as_logic() const
ATTR_HOT inline const netlist_logic_net_t & netlist_net_t::as_logic() const
{
nl_assert(family() == LOGIC);
return static_cast<const netlist_logic_net_t &>(*this);
}
ATTR_HOT inline netlist_analog_net_t & RESTRICT netlist_net_t::as_analog()
ATTR_HOT inline netlist_analog_net_t & netlist_net_t::as_analog()
{
nl_assert(family() == ANALOG);
return static_cast<netlist_analog_net_t &>(*this);
}
ATTR_HOT inline const netlist_analog_net_t & RESTRICT netlist_net_t::as_analog() const
ATTR_HOT inline const netlist_analog_net_t & netlist_net_t::as_analog() const
{
nl_assert(family() == ANALOG);
return static_cast<const netlist_analog_net_t &>(*this);

View File

@ -52,7 +52,7 @@ public:
ATTR_HOT inline bool is_empty() const { return (m_end == &m_list[0]); }
ATTR_HOT inline bool is_not_empty() const { return (m_end > &m_list[0]); }
ATTR_HOT /*ATTR_ALIGN*/ void push(const entry_t &e)
ATTR_HOT void push(const entry_t &e)
{
entry_t * i = m_end++;
while ((i > &m_list[0]) && (e.exec_time() > (i - 1)->exec_time()) )

View File

@ -18,6 +18,17 @@
#include <cstddef>
#include <new>
#if defined(__GNUC__) && (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3))
#if !defined(__ppc__) && !defined (__PPC__) && !defined(__ppc64__) && !defined(__PPC64__)
#define ATTR_ALIGN __attribute__ ((aligned(64)))
#else
#define ATTR_ALIGN
#endif
#else
#define ATTR_ALIGN
#endif
void *palloc_raw(const size_t size);
void pfree_raw(void *p);
@ -83,6 +94,9 @@ inline void pfree_array_t(T *p)
#define pfree_array(_ptr) pfree_array_t(_ptr)
#else
#define ATTR_ALIGN
#include "corealloc.h"
#define palloc(T, ...) global_alloc(T(__VA_ARGS__))
#define pfree(_ptr) global_free(_ptr)

View File

@ -12,16 +12,6 @@
#define PSTANDALONE (0)
#endif
#if defined(__GNUC__) && (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3))
#if !defined(__ppc__) && !defined (__PPC__) && !defined(__ppc64__) && !defined(__PPC64__)
#define ATTR_ALIGN __attribute__ ((aligned(64)))
#else
#define ATTR_ALIGN
#endif
#else
#define ATTR_ALIGN
#endif
//============================================================
// Compiling standalone
//============================================================

View File

@ -262,7 +262,7 @@ private:
}
int m_count;
_ListClass * m_list /* ATTR_ALIGN */;
_ListClass * m_list;
int m_capacity;
};