Przeglądaj źródła

Remove SemIR::RealLiteral (#4113)

I think this was obsoleted around #3897, it's essentially unused.
Jon Ross-Perkins 1 rok temu
rodzic
commit
f3a4178083

+ 0 - 1
toolchain/check/eval.cpp

@@ -1134,7 +1134,6 @@ auto TryEvalInst(Context& context, SemIR::InstId inst_id, SemIR::Inst inst)
     case SemIR::BoolLiteral::Kind:
     case SemIR::FloatLiteral::Kind:
     case SemIR::IntLiteral::Kind:
-    case SemIR::RealLiteral::Kind:
     case SemIR::StringLiteral::Kind:
       // Promote literals to the constant block.
       // TODO: Convert literals into a canonical form. Currently we can form two

+ 0 - 12
toolchain/lower/constant.cpp

@@ -205,18 +205,6 @@ static auto EmitNamespaceAsConstant(ConstantContext& context,
   return context.GetUnusedConstant(inst.type_id);
 }
 
-static auto EmitRealLiteralAsConstant(ConstantContext& context,
-                                      SemIR::RealLiteral inst)
-    -> llvm::Constant* {
-  const Real& real = context.sem_ir().reals().Get(inst.real_id);
-  // TODO: This will probably have overflow issues, and should be fixed.
-  double val =
-      real.mantissa.getZExtValue() *
-      std::pow((real.is_decimal ? 10 : 2), real.exponent.getSExtValue());
-  llvm::APFloat llvm_val(val);
-  return llvm::ConstantFP::get(context.GetType(inst.type_id), llvm_val);
-}
-
 static auto EmitStringLiteralAsConstant(ConstantContext& /*context*/,
                                         SemIR::StringLiteral inst)
     -> llvm::Constant* {

+ 0 - 2
toolchain/sem_ir/file.cpp

@@ -465,7 +465,6 @@ static auto StringifyTypeExprImpl(const SemIR::File& outer_sem_ir,
       case IntLiteral::Kind:
       case Namespace::Kind:
       case Param::Kind:
-      case RealLiteral::Kind:
       case Return::Kind:
       case ReturnExpr::Kind:
       case SpliceBlock::Kind:
@@ -595,7 +594,6 @@ auto GetExprCategory(const File& file, InstId inst_id) -> ExprCategory {
       case IntType::Kind:
       case Param::Kind:
       case PointerType::Kind:
-      case RealLiteral::Kind:
       case StringLiteral::Kind:
       case StructValue::Kind:
       case StructType::Kind:

+ 0 - 1
toolchain/sem_ir/inst_kind.def

@@ -131,7 +131,6 @@ CARBON_SEM_IR_INST_KIND_IMPL(NameRef, TYPE_NEVER, CONSTANT_NEVER)
 CARBON_SEM_IR_INST_KIND_IMPL(Namespace, TYPE_NEVER, CONSTANT_ALWAYS)
 CARBON_SEM_IR_INST_KIND_IMPL(Param, TYPE_NEVER, CONSTANT_NEVER)
 CARBON_SEM_IR_INST_KIND_IMPL(PointerType, TYPE_ALWAYS, CONSTANT_CONDITIONAL)
-CARBON_SEM_IR_INST_KIND_IMPL(RealLiteral, TYPE_NEVER, CONSTANT_ALWAYS)
 CARBON_SEM_IR_INST_KIND_IMPL(ReturnExpr, TYPE_NEVER, CONSTANT_NEVER)
 CARBON_SEM_IR_INST_KIND_IMPL(Return, TYPE_NEVER, CONSTANT_NEVER)
 CARBON_SEM_IR_INST_KIND_IMPL(SpliceBlock, TYPE_NEVER, CONSTANT_NEVER)

+ 0 - 8
toolchain/sem_ir/typed_insts.h

@@ -703,14 +703,6 @@ struct PointerType {
   TypeId pointee_id;
 };
 
-struct RealLiteral {
-  static constexpr auto Kind =
-      InstKind::RealLiteral.Define<Parse::RealLiteralId>("real_literal");
-
-  TypeId type_id;
-  RealId real_id;
-};
-
 struct Return {
   static constexpr auto Kind =
       InstKind::Return.Define<Parse::NodeIdOneOf<Parse::FunctionDefinitionId,