Skip to content

Revert "[SE-0368] StaticBigInt" #62424

New issue

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

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

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
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
14 changes: 1 addition & 13 deletions include/swift/AST/Builtins.def
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2022 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
Expand Down Expand Up @@ -701,18 +701,6 @@ BUILTIN_MISC_OPERATION(UToUCheckedTrunc, "u_to_u_checked_trunc", "n", Special)
/// IntToFPWithOverflow has type (Integer) -> Float
BUILTIN_MISC_OPERATION(IntToFPWithOverflow, "itofp_with_overflow", "n", Special)

/// Builtin.bitWidth_IntLiteral has type
/// (_ value: Builtin.IntLiteral) -> Builtin.Word
BUILTIN_MISC_OPERATION(BitWidth, "bitWidth", "n", Special)

/// Builtin.isNegative_IntLiteral has type
/// (_ value: Builtin.IntLiteral) -> Builtin.Int1
BUILTIN_MISC_OPERATION(IsNegative, "isNegative", "n", Special)

/// Builtin.wordAtIndex_IntLiteral has type
/// (_ value: Builtin.IntLiteral, _ index: Builtin.Word) -> Builtin.Word
BUILTIN_MISC_OPERATION(WordAtIndex, "wordAtIndex", "n", Special)

/// zeroInitializer has type <T> () -> T
BUILTIN_MISC_OPERATION(ZeroInitializer, "zeroInitializer", "n", Special)

Expand Down
41 changes: 1 addition & 40 deletions lib/AST/Builtins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2022 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
Expand Down Expand Up @@ -1796,33 +1796,6 @@ static ValueDecl *getIntToFPWithOverflowOperation(ASTContext &Context,
return getBuiltinFunction(Id, { InTy }, OutTy);
}

static ValueDecl *getBitWidthOperation(
ASTContext &ctx,
Identifier id,
Type valueTy
) {
if (!valueTy->getAs<BuiltinIntegerLiteralType>()) return nullptr;
return getBuiltinFunction(ctx, id, _thin, _parameters(valueTy), _word);
}

static ValueDecl *getIsNegativeOperation(
ASTContext &ctx,
Identifier id,
Type valueTy
) {
if (!valueTy->getAs<BuiltinIntegerLiteralType>()) return nullptr;
return getBuiltinFunction(ctx, id, _thin, _parameters(valueTy), _int(1));
}

static ValueDecl *getWordAtIndexOperation(
ASTContext &ctx,
Identifier id,
Type valueTy
) {
if (!valueTy->getAs<BuiltinIntegerLiteralType>()) return nullptr;
return getBuiltinFunction(ctx, id, _thin, _parameters(valueTy, _word), _word);
}

static ValueDecl *getUnreachableOperation(ASTContext &Context,
Identifier Id) {
auto NeverTy = Context.getNeverType();
Expand Down Expand Up @@ -2808,18 +2781,6 @@ ValueDecl *swift::getBuiltinValueDecl(ASTContext &Context, Identifier Id) {
if (Types.size() != 2) return nullptr;
return getIntToFPWithOverflowOperation(Context, Id, Types[0], Types[1]);

case BuiltinValueKind::BitWidth:
if (Types.size() != 1) return nullptr;
return getBitWidthOperation(Context, Id, Types[0]);

case BuiltinValueKind::IsNegative:
if (Types.size() != 1) return nullptr;
return getIsNegativeOperation(Context, Id, Types[0]);

case BuiltinValueKind::WordAtIndex:
if (Types.size() != 1) return nullptr;
return getWordAtIndexOperation(Context, Id, Types[0]);

case BuiltinValueKind::GetObjCTypeEncoding:
return getGetObjCTypeEncodingOperation(Context, Id);

Expand Down
20 changes: 1 addition & 19 deletions lib/IRGen/GenBuiltin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2022 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
Expand Down Expand Up @@ -961,24 +961,6 @@ void irgen::emitBuiltinCall(IRGenFunction &IGF, const BuiltinInfo &Builtin,
return;
}

if (Builtin.ID == BuiltinValueKind::BitWidth) {
assert(Builtin.Types[0]->is<BuiltinIntegerLiteralType>());
out.add(emitIntLiteralBitWidth(IGF, args));
return;
}

if (Builtin.ID == BuiltinValueKind::IsNegative) {
assert(Builtin.Types[0]->is<BuiltinIntegerLiteralType>());
out.add(emitIntLiteralIsNegative(IGF, args));
return;
}

if (Builtin.ID == BuiltinValueKind::WordAtIndex) {
assert(Builtin.Types[0]->is<BuiltinIntegerLiteralType>());
out.add(emitIntLiteralWordAtIndex(IGF, args));
return;
}

if (Builtin.ID == BuiltinValueKind::Once
|| Builtin.ID == BuiltinValueKind::OnceWithContext) {
// The input type is statically (Builtin.RawPointer, @convention(thin) () -> ()).
Expand Down
44 changes: 1 addition & 43 deletions lib/IRGen/GenIntegerLiteral.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2022 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
Expand Down Expand Up @@ -401,45 +401,3 @@ llvm::Value *irgen::emitIntegerLiteralToFP(IRGenFunction &IGF,
llvm_unreachable("not a floating-point type");
}
}

llvm::Value *irgen::emitIntLiteralBitWidth(
IRGenFunction &IGF,
Explosion &in
) {
auto data = in.claimNext();
auto flags = in.claimNext();
(void)data; // [[maybe_unused]]
return IGF.Builder.CreateLShr(
flags,
IGF.IGM.getSize(Size(IntegerLiteralFlags::BitWidthShift))
);
}

llvm::Value *irgen::emitIntLiteralIsNegative(
IRGenFunction &IGF,
Explosion &in
) {
auto data = in.claimNext();
auto flags = in.claimNext();
(void)data; // [[maybe_unused]]
static_assert(
IntegerLiteralFlags::IsNegativeFlag == 1,
"hardcoded in this truncation"
);
return IGF.Builder.CreateTrunc(flags, IGF.IGM.Int1Ty);
}

llvm::Value *irgen::emitIntLiteralWordAtIndex(
IRGenFunction &IGF,
Explosion &in
) {
auto data = in.claimNext();
auto flags = in.claimNext();
auto index = in.claimNext();
(void)flags; // [[maybe_unused]]
return IGF.Builder.CreateLoad(
IGF.Builder.CreateInBoundsGEP(IGF.IGM.SizeTy, data, index),
IGF.IGM.SizeTy,
IGF.IGM.getPointerAlignment()
);
}
6 changes: 1 addition & 5 deletions lib/IRGen/GenIntegerLiteral.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2022 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
Expand Down Expand Up @@ -66,10 +66,6 @@ llvm::Value *emitIntegerLiteralToFP(IRGenFunction &IGF,
Explosion &in,
llvm::Type *toType);

llvm::Value *emitIntLiteralBitWidth(IRGenFunction &IGF, Explosion &in);
llvm::Value *emitIntLiteralIsNegative(IRGenFunction &IGF, Explosion &in);
llvm::Value *emitIntLiteralWordAtIndex(IRGenFunction &IGF, Explosion &in);

}
}

Expand Down
5 changes: 1 addition & 4 deletions lib/SIL/IR/OperandOwnership.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2022 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2018 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
Expand Down Expand Up @@ -742,9 +742,6 @@ BUILTIN_OPERAND_OWNERSHIP(InstantaneousUse, ICMP_ULE)
BUILTIN_OPERAND_OWNERSHIP(InstantaneousUse, ICMP_ULT)
BUILTIN_OPERAND_OWNERSHIP(InstantaneousUse, InsertElement)
BUILTIN_OPERAND_OWNERSHIP(InstantaneousUse, IntToFPWithOverflow)
BUILTIN_OPERAND_OWNERSHIP(InstantaneousUse, BitWidth)
BUILTIN_OPERAND_OWNERSHIP(InstantaneousUse, IsNegative)
BUILTIN_OPERAND_OWNERSHIP(InstantaneousUse, WordAtIndex)
BUILTIN_OPERAND_OWNERSHIP(InstantaneousUse, IntToPtr)
BUILTIN_OPERAND_OWNERSHIP(InstantaneousUse, IsOptionalType)
BUILTIN_OPERAND_OWNERSHIP(InstantaneousUse, IsPOD)
Expand Down
5 changes: 1 addition & 4 deletions lib/SIL/IR/ValueOwnership.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2022 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2018 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
Expand Down Expand Up @@ -495,9 +495,6 @@ CONSTANT_OWNERSHIP_BUILTIN(None, SToSCheckedTrunc)
CONSTANT_OWNERSHIP_BUILTIN(None, SToUCheckedTrunc)
CONSTANT_OWNERSHIP_BUILTIN(None, UToUCheckedTrunc)
CONSTANT_OWNERSHIP_BUILTIN(None, IntToFPWithOverflow)
CONSTANT_OWNERSHIP_BUILTIN(None, BitWidth)
CONSTANT_OWNERSHIP_BUILTIN(None, IsNegative)
CONSTANT_OWNERSHIP_BUILTIN(None, WordAtIndex)

// This is surprising, Builtin.unreachable returns a "Never" value which is
// trivially typed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2022 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2018 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
Expand Down Expand Up @@ -129,9 +129,6 @@ static bool isBarrier(SILInstruction *inst) {
case BuiltinValueKind::SToSCheckedTrunc:
case BuiltinValueKind::UToUCheckedTrunc:
case BuiltinValueKind::IntToFPWithOverflow:
case BuiltinValueKind::BitWidth:
case BuiltinValueKind::IsNegative:
case BuiltinValueKind::WordAtIndex:
case BuiltinValueKind::ZeroInitializer:
case BuiltinValueKind::Once:
case BuiltinValueKind::OnceWithContext:
Expand Down
3 changes: 1 addition & 2 deletions stdlib/public/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2022 Apple Inc. and the Swift project authors
# Copyright (c) 2014 - 2019 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.txt for license information
Expand Down Expand Up @@ -226,7 +226,6 @@ set(SWIFTLIB_SOURCES
PlaygroundDisplay.swift
CommandLine.swift
SliceBuffer.swift
StaticBigInt.swift
UnfoldSequence.swift
UnsafeBufferPointerSlice.swift
VarArgs.swift
Expand Down
3 changes: 1 addition & 2 deletions stdlib/public/core/GroupInfo.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,7 @@
"Integers": [
"Integers.swift",
"IntegerTypes.swift",
"IntegerParsing.swift",
"StaticBigInt.swift"],
"IntegerParsing.swift"],
"Floating": [
"FloatingPoint.swift",
"FloatingPointParsing.swift",
Expand Down
Loading