diff --git a/taichi/ir/type_factory.h b/taichi/ir/type_factory.h index a273091579ea9..da4b772c8eb7f 100644 --- a/taichi/ir/type_factory.h +++ b/taichi/ir/type_factory.h @@ -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 shape, Type *element); + const Type *get_tensor_type(std::vector 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 &member_types, const std::vector &member_bit_offsets, const std::vector &member_exponents, const std::vector> &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 shape, DataType element); + static const DataType create_tensor_type(std::vector shape, DataType element); private: TypeFactory();