Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Remove SemIR::RealLiteral #4113

Merged
merged 1 commit into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion toolchain/check/eval.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 0 additions & 12 deletions toolchain/lower/constant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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* {
Expand Down
2 changes: 0 additions & 2 deletions toolchain/sem_ir/file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
1 change: 0 additions & 1 deletion toolchain/sem_ir/inst_kind.def
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 0 additions & 8 deletions toolchain/sem_ir/typed_insts.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading