Skip to content

Commit

Permalink
Update type_factory.h
Browse files Browse the repository at this point in the history
Modifying TypeFactory class functions to be of const type.
Issue link: #5167
  • Loading branch information
matthewd28 authored Oct 2, 2022
1 parent ed12813 commit b205d5f
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions taichi/ir/type_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,38 +13,38 @@ class TypeFactory {
// TODO(type): maybe it makes sense to let each get_X function return X*
// instead of generic Type*

Type *get_primitive_type(PrimitiveTypeID id);
const Type *get_primitive_type(PrimitiveTypeID id);

PrimitiveType *get_primitive_int_type(int bits, bool is_signed = true);
const PrimitiveType *get_primitive_int_type(int bits, bool is_signed = true);

PrimitiveType *get_primitive_real_type(int bits);
const PrimitiveType *get_primitive_real_type(int bits);

Type *get_tensor_type(std::vector<int> shape, Type *element);
const Type *get_tensor_type(std::vector<int> shape, Type *element);

Type *get_pointer_type(Type *element, bool is_bit_pointer = false);
const Type *get_pointer_type(Type *element, bool is_bit_pointer = false);

Type *get_quant_int_type(int num_bits, bool is_signed, Type *compute_type);
const Type *get_quant_int_type(int num_bits, bool is_signed, Type *compute_type);

Type *get_quant_fixed_type(Type *digits_type,
const Type *get_quant_fixed_type(Type *digits_type,
Type *compute_type,
float64 scale);

Type *get_quant_float_type(Type *digits_type,
const Type *get_quant_float_type(Type *digits_type,
Type *exponent_type,
Type *compute_type);

BitStructType *get_bit_struct_type(
const BitStructType *get_bit_struct_type(
PrimitiveType *physical_type,
const std::vector<Type *> &member_types,
const std::vector<int> &member_bit_offsets,
const std::vector<int> &member_exponents,
const std::vector<std::vector<int>> &member_exponent_users);

Type *get_quant_array_type(PrimitiveType *physical_type,
const Type *get_quant_array_type(PrimitiveType *physical_type,
Type *element_type,
int num_elements);

static DataType create_tensor_type(std::vector<int> shape, DataType element);
static const DataType create_tensor_type(std::vector<int> shape, DataType element);

private:
TypeFactory();
Expand Down

0 comments on commit b205d5f

Please sign in to comment.