Skip to content

Commit

Permalink
Fixed some compilation issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
fabrizioferrandi committed Nov 23, 2022
1 parent d6a99e9 commit 5dfc32e
Show file tree
Hide file tree
Showing 17 changed files with 61 additions and 60 deletions.
2 changes: 2 additions & 0 deletions src/HLS/binding/module/fu_binding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1148,10 +1148,12 @@ void fu_binding::add_to_SM(const HLS_managerRef HLSMgr, const hlsRef HLS, struct
if(HLSMgr->Rfuns->has_proxied_shared_functions(f_id))
{
auto proxied_shared_functions = HLSMgr->Rfuns->get_proxied_shared_functions(f_id);
#ifndef NDEBUG
for(const auto& name : proxied_shared_functions)
{
INDENT_DBG_MEX(DEBUG_LEVEL_VERY_PEDANTIC, debug_level, "--- proxy shared function: " + name);
}
#endif
kill_proxy_function_units(wrapped_units, FU, fun_call_sites_rel, reverse_function_units);
}

Expand Down
2 changes: 1 addition & 1 deletion src/HLS/scheduling/schedule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ void Schedule::UpdateTime(const unsigned int operation_index, bool update_cs)
auto starting_time = 0.0;

/// The starting control step
auto starting_cs = ControlStep(0);
ControlStep starting_cs = ControlStep(0);
if(!update_cs)
{
starting_time = clock_period * from_strongtype_cast<double>(op_starting_cycle.at(operation_index));
Expand Down
6 changes: 3 additions & 3 deletions src/design_flows/backend/ToHDL/writer/verilog_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ void verilog_writer::write_vector_port_binding(const structural_objectRef& port,
std::string port_binding;
auto* pv = GetPointer<port_o>(port);
bool local_first_port_analyzed = false;
unsigned int msb, lsb;
unsigned long long msb, lsb;
msb = std::numeric_limits<unsigned int>::max();
lsb = std::numeric_limits<unsigned int>::max();
structural_objectRef slice;
Expand Down Expand Up @@ -1663,7 +1663,7 @@ void verilog_writer::write_transition_output_functions(
/// check unique-case condition
bool unique_case_condition = true;
std::string guard_casez_port;
unsigned n_bits_guard_casez_port = 0;
auto n_bits_guard_casez_port = 0ULL;
if(!unique_transition)
{
for(unsigned int i = 0; i < state_transitions.size(); i++)
Expand Down Expand Up @@ -1863,7 +1863,7 @@ void verilog_writer::write_transition_output_functions(
res_or_conditions += port_name;
if((*in_or_conditions_tokens_it)[0] == '&')
{
unsigned n_bits = vec_size == 0 ? port_size : vec_size;
auto n_bits = vec_size == 0 ? port_size : vec_size;
auto pos = boost::lexical_cast<unsigned int>((*in_or_conditions_tokens_it).substr(1));
if(unique_case_condition)
{
Expand Down
3 changes: 2 additions & 1 deletion src/frontend_analysis/IR_analysis/Bit_Value_opt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,8 @@ void Bit_Value_opt::optimize(const function_decl* fd, tree_managerRef TM, tree_m
const auto srcp = ga->include_name + ":" + STR(ga->line_number) + ":" + STR(ga->column_number);
const auto& val_type = ssa->type;
const auto val_type_bw = tree_helper::Size(ssa->type);
const auto shift_offset = TM->CreateUniqueIntegerCst(val_type_bw - bw_op0, val_type);
const auto shift_offset =
TM->CreateUniqueIntegerCst(static_cast<long long>(val_type_bw - bw_op0), val_type);
const auto shl_expr =
IRman->create_binary_operation(val_type, val, shift_offset, srcp, lshift_expr_K);
const auto shl =
Expand Down
8 changes: 4 additions & 4 deletions src/frontend_analysis/IR_analysis/IR_lowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ static CustomUnorderedMap<std::pair<unsigned int, unsigned long long>, std::pair
other field of the returned struct are undefined.
MODE is the machine mode of the multiplication. */
static void synth_mult(struct algorithm& alg_out, unsigned long long t, const struct mult_cost& cost_limit,
unsigned data_bitsize, tree_managerRef& TM)
unsigned long long data_bitsize, tree_managerRef& TM)
{
int m;
struct algorithm alg_in, best_alg;
Expand All @@ -254,7 +254,7 @@ static void synth_mult(struct algorithm& alg_out, unsigned long long t, const st
short op_cost, op_latency;
unsigned long long int orig_t = t;
unsigned long long int q;
int maxm = static_cast<int>(std::min(32u, data_bitsize));
auto maxm = static_cast<int>(std::min(32ull, data_bitsize));
bool cache_hit = false;
enum alg_code cache_alg = alg_zero;
best_alg.cost.cost = std::numeric_limits<short>::max();
Expand Down Expand Up @@ -704,7 +704,7 @@ static void synth_mult(struct algorithm& alg_out, unsigned long long t, const st

Return true if the cheapest of these cost less than MULT_COST,
describing the algorithm in *ALG and final fixup in *VARIANT. */
static bool choose_mult_variant(unsigned int data_bitsize, long long int val, struct algorithm& alg,
static bool choose_mult_variant(unsigned long long data_bitsize, long long int val, struct algorithm& alg,
enum mult_variant& variant, short int Mult_cost, tree_managerRef& TM)
{
struct algorithm alg2;
Expand Down Expand Up @@ -1767,7 +1767,7 @@ tree_nodeRef IR_lowering::array_ref_lowering(array_ref* AR, const std::string& s
{
n_byte *= dims.at(ind);
}
tree_nodeRef coef_node = TM->CreateUniqueIntegerCst(n_byte, offset_type);
tree_nodeRef coef_node = TM->CreateUniqueIntegerCst(static_cast<long long>(n_byte), offset_type);
tree_nodeRef m = tree_man->create_binary_operation(offset_type, offset_node, coef_node, srcp_default, mult_expr_K);
tree_nodeRef m_ga = tree_man->CreateGimpleAssign(offset_type, tree_nodeRef(), tree_nodeRef(), m, function_id,
block.first, srcp_default);
Expand Down
14 changes: 7 additions & 7 deletions src/frontend_analysis/IR_analysis/IR_lowering_exec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1395,7 +1395,7 @@ DesignFlowStep_Status IR_lowering::InternalExec()
type = pt;
}
auto offset_value = tree_helper::Size(tree_helper::CGetType(ipe->op)) / 16;
tree_nodeRef offset = TM->CreateUniqueIntegerCst(offset_value, type);
tree_nodeRef offset = TM->CreateUniqueIntegerCst(static_cast<long long>(offset_value), type);
return tree_man->create_binary_operation(ipe->type, ssa_vd, offset, srcp_default, mem_ref_K);
};
if(code1 == array_ref_K)
Expand Down Expand Up @@ -1725,7 +1725,7 @@ DesignFlowStep_Status IR_lowering::InternalExec()
/// check if there is a misaligned access
auto obj_size = tree_helper::Size(tree_helper::CGetType(ga->op1));
auto bram_size = std::max(8ull, obj_size / 2);
if((((op1_val * 8)) % bram_size) != 0)
if((((op1_val * 8)) % static_cast<long long>(bram_size)) != 0)
{
function_behavior->set_unaligned_accesses(true);
}
Expand Down Expand Up @@ -2669,8 +2669,8 @@ DesignFlowStep_Status IR_lowering::InternalExec()
{
auto type_index = tree_helper::get_type_index(TM, GET_INDEX_NODE(op0));
tree_nodeRef op0_type = TM->GetTreeReindex(type_index);
tree_nodeRef right_shift_value =
TM->CreateUniqueIntegerCst(tree_helper::Size(op0) - 1, op0_type);
tree_nodeRef right_shift_value = TM->CreateUniqueIntegerCst(
static_cast<long long>(tree_helper::Size(op0) - 1), op0_type);
tree_nodeRef rshift1 = tree_man->create_binary_operation(
op0_type, op0, right_shift_value, srcp_default, rshift_expr_K);
tree_nodeRef rshift1_ga =
Expand Down Expand Up @@ -2738,8 +2738,8 @@ DesignFlowStep_Status IR_lowering::InternalExec()
{
auto type_index = tree_helper::get_type_index(TM, GET_INDEX_NODE(op0));
tree_nodeRef op0_type = TM->GetTreeReindex(type_index);
tree_nodeRef right_shift_value =
TM->CreateUniqueIntegerCst(tree_helper::Size(op0) - 1, op0_type);
tree_nodeRef right_shift_value = TM->CreateUniqueIntegerCst(
static_cast<long long>(tree_helper::Size(op0) - 1), op0_type);
tree_nodeRef rshift1 = tree_man->create_binary_operation(
op0_type, op0, right_shift_value, srcp_default, rshift_expr_K);
tree_nodeRef rshift1_ga =
Expand Down Expand Up @@ -2920,7 +2920,7 @@ DesignFlowStep_Status IR_lowering::InternalExec()
implicit_memset = type_node->get_kind() == array_type_K;
}
}
if(!implicit_memset && ((((op1_val * 8)) % bram_size) != 0))
if(!implicit_memset && ((((op1_val * 8)) % static_cast<long long>(bram_size)) != 0))
{
function_behavior->set_unaligned_accesses(true);
}
Expand Down
24 changes: 13 additions & 11 deletions src/frontend_analysis/IR_analysis/InterfaceInfer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ DesignFlowStep_Status InterfaceInfer::Exec()
return tree_helper::Size(ptd_type);
}();
THROW_ASSERT(input_bw, "unexpected condition");
unsigned long long n_resources;
unsigned int n_resources;
unsigned long long alignment;
ComputeResourcesAlignment(n_resources, alignment, input_bw, is_acType, is_signed, is_fixed);

Expand Down Expand Up @@ -879,7 +879,8 @@ void InterfaceInfer::create_Read_function(tree_nodeRef origStmt, const std::stri
{
const auto sel_value = TM->CreateUniqueIntegerCst(0, boolean_type);
args.push_back(sel_value);
const auto size_value = TM->CreateUniqueIntegerCst(tree_helper::Size(readType), bit_size_type);
const auto size_value =
TM->CreateUniqueIntegerCst(static_cast<long long>(tree_helper::Size(readType)), bit_size_type);
args.push_back(size_value);
tree_nodeRef data_value;
if(GET_NODE(readType)->get_kind() == integer_type_K || GET_NODE(readType)->get_kind() == enumeral_type_K ||
Expand Down Expand Up @@ -940,7 +941,8 @@ void InterfaceInfer::create_Write_function(const std::string& arg_name, tree_nod
tree_helper::get_mangled_fname(fd, fname);
tree_nodeRef boolean_type;
const auto bit_size_type = tree_man->GetUnsignedIntegerType();
const auto size_value = TM->CreateUniqueIntegerCst(tree_helper::Size(writeType), bit_size_type);
const auto size_value =
TM->CreateUniqueIntegerCst(static_cast<long long>(tree_helper::Size(writeType)), bit_size_type);

/// create the function_decl
std::vector<tree_nodeRef> argsT;
Expand Down Expand Up @@ -996,8 +998,8 @@ void InterfaceInfer::create_Write_function(const std::string& arg_name, tree_nod

void InterfaceInfer::create_resource_Read_simple(const std::set<std::string>& operations, const std::string& arg_name,
const std::string& interfaceType, unsigned long long input_bw,
bool IO_port, unsigned long long n_resources,
unsigned long long rwBWsize, unsigned int top_id) const
bool IO_port, unsigned int n_resources, unsigned long long rwBWsize,
unsigned int top_id) const
{
const std::string ResourceName = ENCODE_FDNAME(arg_name, "_Read_", interfaceType);
auto HLSMgr = GetPointer<HLS_manager>(AppM);
Expand Down Expand Up @@ -1155,8 +1157,8 @@ void InterfaceInfer::create_resource_Read_simple(const std::set<std::string>& op

void InterfaceInfer::create_resource_Write_simple(const std::set<std::string>& operations, const std::string& arg_name,
const std::string& interfaceType, unsigned long long input_bw,
bool IO_port, bool isDiffSize, unsigned long long n_resources,
bool is_real, unsigned long long rwBWsize, unsigned int top_id) const
bool IO_port, bool isDiffSize, unsigned int n_resources, bool is_real,
unsigned long long rwBWsize, unsigned int top_id) const
{
const std::string ResourceName = ENCODE_FDNAME(arg_name, "_Write_", interfaceType);
auto HLSMgr = GetPointer<HLS_manager>(AppM);
Expand Down Expand Up @@ -1508,7 +1510,7 @@ void InterfaceInfer::create_resource_array(const std::set<std::string>& operatio
void InterfaceInfer::create_resource_m_axi(const std::set<std::string>& operationsR,
const std::set<std::string>& operationsW, const std::string& arg_name,
const std::string& bundle_name, const std::string& interfaceType,
unsigned long long input_bw, unsigned long long n_resources, m_axi_type mat,
unsigned long long input_bw, unsigned int n_resources, m_axi_type mat,
unsigned long long rwBWsize, unsigned int top_id) const
{
const auto ResourceName = ENCODE_FDNAME(bundle_name, "", "");
Expand Down Expand Up @@ -1813,7 +1815,7 @@ void InterfaceInfer::create_resource_m_axi(const std::set<std::string>& operatio
void InterfaceInfer::create_resource(const std::set<std::string>& operationsR, const std::set<std::string>& operationsW,
const std::string& arg_name, const std::string& interfaceType,
unsigned long long input_bw, bool isDiffSize, const std::string& fname,
unsigned long long n_resources, unsigned long long alignment, bool isReal,
unsigned int n_resources, unsigned long long alignment, bool isReal,
unsigned long long rwBWsize, unsigned int top_id) const
{
if(interfaceType == "none" || interfaceType == "none_registered" || interfaceType == "acknowledge" ||
Expand Down Expand Up @@ -1903,7 +1905,7 @@ void InterfaceInfer::create_resource(const std::set<std::string>& operationsR, c
}
}

void InterfaceInfer::ComputeResourcesAlignment(unsigned long long& n_resources, unsigned long long& alignment,
void InterfaceInfer::ComputeResourcesAlignment(unsigned int& n_resources, unsigned long long& alignment,
unsigned long long input_bw, bool is_acType, bool is_signed,
bool is_fixed)
{
Expand All @@ -1914,7 +1916,7 @@ void InterfaceInfer::ComputeResourcesAlignment(unsigned long long& n_resources,
}
else if(input_bw > 128)
{
n_resources = input_bw / 32 + (input_bw % 32 ? 1 : 0);
n_resources = static_cast<unsigned>(input_bw / 32 + (input_bw % 32 ? 1 : 0));
if(!is_signed && input_bw % 32 == 0 && !is_fixed)
{
++n_resources;
Expand Down
16 changes: 7 additions & 9 deletions src/frontend_analysis/IR_analysis/InterfaceInfer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,11 @@ class InterfaceInfer : public ApplicationFrontendFlowStep

void create_resource_Read_simple(const std::set<std::string>& operations, const std::string& arg_name,
const std::string& interfaceType, unsigned long long input_bw, bool IO_port,
unsigned long long n_resources, unsigned long long rwBWsize,
unsigned int top_id) const;
unsigned int n_resources, unsigned long long rwBWsize, unsigned int top_id) const;

void create_resource_Write_simple(const std::set<std::string>& operations, const std::string& arg_name,
const std::string& interfaceType, unsigned long long input_bw, bool IO_port,
bool isDiffSize, unsigned long long n_resources, bool is_real,
bool isDiffSize, unsigned int n_resources, bool is_real,
unsigned long long rwBWsize, unsigned int top_id) const;

void create_resource_array(const std::set<std::string>& operationsR, const std::set<std::string>& operationsW,
Expand All @@ -111,18 +110,17 @@ class InterfaceInfer : public ApplicationFrontendFlowStep

void create_resource_m_axi(const std::set<std::string>& operationsR, const std::set<std::string>& operationsW,
const std::string& arg_name, const std::string& bundle_name,
const std::string& interfaceType, unsigned long long input_bw,
unsigned long long n_resources, m_axi_type mat, unsigned long long rwBWsize,
unsigned int top_id) const;
const std::string& interfaceType, unsigned long long input_bw, unsigned int n_resources,
m_axi_type mat, unsigned long long rwBWsize, unsigned int top_id) const;

void create_resource(const std::set<std::string>& operationsR, const std::set<std::string>& operationsW,
const std::string& arg_name, const std::string& interfaceType, unsigned long long input_bw,
bool isDiffSize, const std::string& fname, unsigned long long n_resources,
bool isDiffSize, const std::string& fname, unsigned int n_resources,
unsigned long long alignment, bool isReal, unsigned long long rwBWsize,
unsigned int top_id) const;

void ComputeResourcesAlignment(unsigned long long& n_resources, unsigned long long& alignment,
unsigned long long input_bw, bool is_acType, bool is_signed, bool is_fixed);
void ComputeResourcesAlignment(unsigned int& n_resources, unsigned long long& alignment, unsigned long long input_bw,
bool is_acType, bool is_signed, bool is_fixed);

void FixReadWriteCall(const gimple_assign* ga, gimple_node* newGN, const tree_manipulationRef tree_man,
tree_nodeRef new_call, statement_list* sl, const tree_managerRef TM, tree_nodeRef origStmt,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ void operations_cfg_computation::build_operation_recursive(const tree_managerRef

// Creating node of call
ogc->AddOperation(TM, actual_name, fun_name, bb_index, ce->index);
auto type_external = TYPE_EXTERNAL;
unsigned int type_external = TYPE_EXTERNAL;
if(fd->writing_memory || fd->reading_memory)
{
type_external = type_external | TYPE_RW;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1017,7 +1017,7 @@ bool rebuild_initialization2::look_for_ROMs()
"unexpected condition");
inits[vd_node]
[tree_helper::get_integer_cst_value(GetPointerS<const integer_cst>(ppe_op1)) /
(var_writing_elts_size_relation[vd_index] / 8)] = ga->op1;
static_cast<long long>(var_writing_elts_size_relation[vd_index] / 8)] = ga->op1;
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/frontend_analysis/IR_analysis/soft_float_cg_ext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1957,7 +1957,7 @@ bool soft_float_cg_ext::RecursiveExaminate(const tree_nodeRef& current_statement
THROW_ASSERT(called_function, "The library miss this function " + fu_name);
std::vector<tree_nodeRef> args = {
ue->op,
TreeM->CreateUniqueIntegerCst(static_cast<unsigned long long>(inFF->exception_mode),
TreeM->CreateUniqueIntegerCst(static_cast<long long>(inFF->exception_mode),
tree_man->GetSignedIntegerType()),
TreeM->CreateUniqueIntegerCst(inFF->has_subnorm, tree_man->GetBooleanType())};
TreeM->ReplaceTreeNode(current_statement, current_tree_node,
Expand Down
Loading

0 comments on commit 5dfc32e

Please sign in to comment.