mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 06:34:41 +01:00
Switch to using Core.BigInt as the type of the size of a type literal. (#4450)
This removes one of the few ways in which `i32` is special and gets us closer to removing it as a special case.
This commit is contained in:
@@ -206,8 +206,17 @@ static auto EmitAsConstant(ConstantContext& /*context*/,
|
||||
|
||||
static auto EmitAsConstant(ConstantContext& context, SemIR::IntLiteral inst)
|
||||
-> llvm::Constant* {
|
||||
return llvm::ConstantInt::get(context.GetType(inst.type_id),
|
||||
context.sem_ir().ints().Get(inst.int_id));
|
||||
auto* type = context.GetType(inst.type_id);
|
||||
|
||||
// BigInt is represented as an empty struct. All other integer types are
|
||||
// represented as an LLVM integer type.
|
||||
if (!llvm::isa<llvm::IntegerType>(type)) {
|
||||
auto* struct_type = llvm::dyn_cast<llvm::StructType>(type);
|
||||
CARBON_CHECK(struct_type && struct_type->getNumElements() == 0);
|
||||
return llvm::ConstantStruct::get(struct_type);
|
||||
}
|
||||
|
||||
return llvm::ConstantInt::get(type, context.sem_ir().ints().Get(inst.int_id));
|
||||
}
|
||||
|
||||
static auto EmitAsConstant(ConstantContext& context, SemIR::Namespace inst)
|
||||
|
||||
Reference in New Issue
Block a user