2021-07-27 12:38:38 -07:00
|
|
|
#include <algorithm>
|
|
|
|
#include <iostream>
|
|
|
|
#include "triton/ir/basic_block.h"
|
|
|
|
#include "triton/ir/module.h"
|
|
|
|
#include "triton/ir/type.h"
|
|
|
|
#include "triton/ir/constant.h"
|
|
|
|
#include "triton/ir/function.h"
|
|
|
|
|
|
|
|
namespace triton{
|
|
|
|
namespace ir{
|
|
|
|
|
2022-04-03 20:58:16 -07:00
|
|
|
void module::reset_ret_ty(const std::string& name, type* ty) {
|
|
|
|
get_function(name)->get_fn_type()->reset_ret_ty(ty);
|
|
|
|
}
|
|
|
|
|
2021-07-27 12:38:38 -07:00
|
|
|
/* functions */
|
|
|
|
function *module::get_or_insert_function(const std::string &name, function_type *ty) {
|
|
|
|
function *&fn = (function*&)symbols_[name];
|
2022-04-03 20:58:16 -07:00
|
|
|
if(fn == nullptr){
|
|
|
|
fn = function::create(ty, global_value::external, name, this);
|
|
|
|
}
|
2021-07-27 12:38:38 -07:00
|
|
|
return fn;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|