Add support for iN and uN for all suitable N. (#3868)

`i32` is retained as a special case for now, for bootstrapping purposes,
and maps to `BuiltinIntType`, which is distinct from `Core.Int(32)`.
This will be removed later once we support `Core.BigInt`.

For now this provides both the `iN` types and also the builtins to
support `Core.Int(N)`. The intent is that we'll change the `iN` support
to rewrite to calls here when we do that for the other type literals and
type keywords.

No conversions between integer types are supported yet, and all literals
are of type `i32`, so we can't actually form values of any of these new
types.

---------

Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
Co-authored-by: Carbon Infra Bot <carbon-external-infra@google.com>
This commit is contained in:
authored and GitHub committed 2024-04-08 10:09:02 +00:00
1 parent 895e90e791
commit bb117aea3a
25 files changed
+1234 -56

No files matched your search

+2 -3
View File
@@ -134,11 +134,10 @@ auto TokenizedBuffer::GetStringLiteralValue(TokenIndex token) const
return token_info.string_literal_id;
}
auto TokenizedBuffer::GetTypeLiteralSize(TokenIndex token) const
-> const llvm::APInt& {
auto TokenizedBuffer::GetTypeLiteralSize(TokenIndex token) const -> IntId {
const auto& token_info = GetTokenInfo(token);
CARBON_CHECK(token_info.kind.is_sized_type_literal()) << token_info.kind;
return value_stores_->ints().Get(token_info.int_id);
return token_info.int_id;
}
auto TokenizedBuffer::GetMatchedClosingToken(TokenIndex opening_token) const