systemc-clang
systemc-clang copied to clipboard
Member function should contain reference to calling object
Given the following code where bhdr is of type block_header (in z7test):
// calling site
bhdr.set_exp(blockexpt);
// definition
template<typename FP> struct block_header
{
typedef typename FP::expo_t expo_t;
bool zb; //full flag.
expo_t exp; //word
// ...
void set_exp(expo_t _exp) { exp = _exp; }//"fluent" API to set exponent.
};
The generated hFunction for set_exp should contain an argument for bhdr where currently it does not. Note that the member function call itself is correctly generated
// calling site
hMethodCall zhw__block_headerfp_t11_52__set_exp_func_3 [
hVarref bhdr_ms_proc_local_9 NOLIST
hVarref blockexpt_ms_proc_local_12 NOLIST
]
// definition
hFunction zhw__block_headerfp_t11_52__set_exp_func_3 [
hFunctionRetType NONAME [
hTypeinfo NONAME [
hType void NOLIST
]
]
hFunctionParams NONAME [
// we need another parameter to identify the caller
hFunctionParamI _exp [
hTypeinfo NONAME [
hType sc_uint [
hLiteral 11 NOLIST
]
]
]
]
hCStmt NONAME [
hBinop = [
hVarref _exp_actual_scclang_global_9 NOLIST
hVarref _exp NOLIST
]
hBinop = [
hVarref exp NOLIST
hVarref _exp_actual_scclang_global_9 NOLIST
]
]
]
Currently, we do not support the member function feature, C++ code will be modified.