Skip to content

Enable i686 as a Host Platform #19607

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

Merged
merged 7 commits into from
Oct 2, 2018
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
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ else()
set(SWIFT_HOST_VARIANT_ARCH_default "x86_64")
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "IA64")
set(SWIFT_HOST_VARIANT_ARCH_default "itanium")
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86")
elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "(x86|i686)")
set(SWIFT_HOST_VARIANT_ARCH_default "i686")
else()
message(FATAL_ERROR "Unrecognized architecture on host system: ${CMAKE_SYSTEM_PROCESSOR}")
Expand Down Expand Up @@ -647,6 +647,8 @@ if("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "LINUX")
if("${SWIFT_HOST_TRIPLE}" STREQUAL "")
if("${SWIFT_HOST_VARIANT_ARCH}" STREQUAL "x86_64")
set(SWIFT_HOST_TRIPLE "x86_64-unknown-linux-gnu")
elseif("${SWIFT_HOST_VARIANT_ARCH}" STREQUAL "i686")
set(SWIFT_HOST_TRIPLE "i686-unknown-linux-gnu")
elseif("${SWIFT_HOST_VARIANT_ARCH}" STREQUAL "aarch64")
set(SWIFT_HOST_TRIPLE "aarch64-unknown-linux-gnu")
elseif("${SWIFT_HOST_VARIANT_ARCH}" MATCHES "(powerpc64|powerpc64le)")
Expand Down
4 changes: 2 additions & 2 deletions include/swift/AST/Decl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1462,7 +1462,7 @@ class alignas(RequirementRepr) TrailingWhereClause final :
};

// A private class for forcing exact field layout.
class _GenericContext {
class alignas(8) _GenericContext {
// Not really public. See GenericContext.
public:
GenericParamList *GenericParams = nullptr;
Expand Down Expand Up @@ -1599,7 +1599,7 @@ class ImportDecl final : public Decl,

ArrayRef<AccessPathElement> getFullAccessPath() const {
return {getTrailingObjects<AccessPathElement>(),
Bits.ImportDecl.NumPathElements};
static_cast<size_t>(Bits.ImportDecl.NumPathElements)};
}

ArrayRef<AccessPathElement> getModulePath() const {
Expand Down
12 changes: 6 additions & 6 deletions include/swift/AST/Expr.h
Original file line number Diff line number Diff line change
Expand Up @@ -2114,10 +2114,10 @@ class CollectionExpr : public Expr {
/// that trailing commas are currently allowed, and that invalid code may have
/// stray or missing commas.
MutableArrayRef<SourceLoc> getCommaLocs() {
return {getTrailingSourceLocs(), Bits.CollectionExpr.NumCommas};
return {getTrailingSourceLocs(), static_cast<size_t>(Bits.CollectionExpr.NumCommas)};
}
ArrayRef<SourceLoc> getCommaLocs() const {
return {getTrailingSourceLocs(), Bits.CollectionExpr.NumCommas};
return {getTrailingSourceLocs(), static_cast<size_t>(Bits.CollectionExpr.NumCommas)};
}
unsigned getNumCommas() const { return Bits.CollectionExpr.NumCommas; }

Expand Down Expand Up @@ -2911,7 +2911,7 @@ class TupleShuffleExpr final : public ImplicitConversionExpr,

ArrayRef<int> getElementMapping() const {
return {getTrailingObjects<int>(),
Bits.TupleShuffleExpr.NumElementMappings};
static_cast<size_t>(Bits.TupleShuffleExpr.NumElementMappings)};
}

/// What is the type impact of this shuffle?
Expand All @@ -2938,7 +2938,7 @@ class TupleShuffleExpr final : public ImplicitConversionExpr,
/// Retrieve the argument indices for the variadic arguments.
ArrayRef<unsigned> getVariadicArgs() const {
return {getTrailingObjects<unsigned>(),
Bits.TupleShuffleExpr.NumVariadicArgs};
static_cast<size_t>(Bits.TupleShuffleExpr.NumVariadicArgs)};
}

/// Retrieve the owner of the default arguments.
Expand All @@ -2947,13 +2947,13 @@ class TupleShuffleExpr final : public ImplicitConversionExpr,
/// Retrieve the caller-defaulted arguments.
ArrayRef<Expr *> getCallerDefaultArgs() const {
return {getTrailingObjects<Expr*>(),
Bits.TupleShuffleExpr.NumCallerDefaultArgs};
static_cast<size_t>(Bits.TupleShuffleExpr.NumCallerDefaultArgs)};
}

/// Retrieve the caller-defaulted arguments.
MutableArrayRef<Expr *> getCallerDefaultArgs() {
return {getTrailingObjects<Expr*>(),
Bits.TupleShuffleExpr.NumCallerDefaultArgs};
static_cast<size_t>(Bits.TupleShuffleExpr.NumCallerDefaultArgs)};
}

static bool classof(const Expr *E) {
Expand Down
2 changes: 1 addition & 1 deletion include/swift/AST/TypeRepr.h
Original file line number Diff line number Diff line change
Expand Up @@ -1079,7 +1079,7 @@ class SILBoxTypeRepr final : public TypeRepr,
}
ArrayRef<TypeRepr *> getGenericArguments() const {
return {getTrailingObjects<TypeRepr*>(),
Bits.SILBoxTypeRepr.NumGenericArgs};
static_cast<size_t>(Bits.SILBoxTypeRepr.NumGenericArgs)};
}

GenericParamList *getGenericParams() const {
Expand Down
2 changes: 1 addition & 1 deletion include/swift/AST/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -4650,7 +4650,7 @@ class ArchetypeType final : public SubstitutableType,
/// type shall conform.
ArrayRef<ProtocolDecl *> getConformsTo() const {
return { getTrailingObjects<ProtocolDecl *>(),
Bits.ArchetypeType.NumProtocols };
static_cast<size_t>(Bits.ArchetypeType.NumProtocols) };
}

/// requiresClass - True if the type can only be substituted with class types.
Expand Down
4 changes: 2 additions & 2 deletions include/swift/SIL/SILInstruction.h
Original file line number Diff line number Diff line change
Expand Up @@ -1360,12 +1360,12 @@ class AllocStackInst final

ArrayRef<Operand> getAllOperands() const {
return { getTrailingObjects<Operand>(),
SILInstruction::Bits.AllocStackInst.NumOperands };
static_cast<size_t>(SILInstruction::Bits.AllocStackInst.NumOperands) };
}

MutableArrayRef<Operand> getAllOperands() {
return { getTrailingObjects<Operand>(),
SILInstruction::Bits.AllocStackInst.NumOperands };
static_cast<size_t>(SILInstruction::Bits.AllocStackInst.NumOperands) };
}

ArrayRef<Operand> getTypeDependentOperands() const {
Expand Down
8 changes: 6 additions & 2 deletions lib/IRGen/GenType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1557,8 +1557,12 @@ convertPrimitiveBuiltin(IRGenModule &IGM, CanType canTy) {
return RetTy{ llvm::Type::getFloatTy(ctx), Size(4), Alignment(4) };
case BuiltinFloatType::IEEE64:
return RetTy{ llvm::Type::getDoubleTy(ctx), Size(8), Alignment(8) };
case BuiltinFloatType::IEEE80:
return RetTy{ llvm::Type::getX86_FP80Ty(ctx), Size(16), Alignment(16) };
case BuiltinFloatType::IEEE80: {
llvm::Type *floatTy = llvm::Type::getX86_FP80Ty(ctx);
uint64_t ByteSize = IGM.DataLayout.getTypeAllocSize(floatTy);
unsigned align = IGM.DataLayout.getABITypeAlignment(floatTy);
return RetTy{ floatTy, Size(ByteSize), Alignment(align) };
}
case BuiltinFloatType::IEEE128:
return RetTy{ llvm::Type::getFP128Ty(ctx), Size(16), Alignment(16) };
case BuiltinFloatType::PPC128:
Expand Down
3 changes: 2 additions & 1 deletion lib/SIL/SILLocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@

using namespace swift;

static_assert(sizeof(SILLocation) == 3*sizeof(void *),
// 64-bit is 24 bytes, 32-bit is 20 bytes.
static_assert(sizeof(SILLocation) == sizeof(void *) + 4*sizeof(unsigned),
"SILLocation must stay small");

SourceLoc SILLocation::getSourceLoc() const {
Expand Down
2 changes: 1 addition & 1 deletion stdlib/public/SwiftShims/LibcShims.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace swift { extern "C" {

// This declaration is not universally correct. We verify its correctness for
// the current platform in the runtime code.
#if defined(__linux__) && defined (__arm__)
#if defined(__linux__) && (defined(__arm__) || defined(__i386__))
typedef int __swift_ssize_t;
#elif defined(_WIN32)
#if defined(_M_ARM) || defined(_M_IX86)
Expand Down
2 changes: 1 addition & 1 deletion stdlib/public/stubs/MathStubs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ __muloti4(ti_int a, ti_int b, int* overflow)
// lowered to instructions as though MSVC had generated. There does not seem to
// be a MSVC provided multiply with overflow detection that I can see, but this
// avoids an unnecessary dependency on compiler-rt for a single function.
#if (defined(__linux__) && defined(__arm__)) || defined(_WIN32)
#if (defined(__linux__) && (defined(__arm__) || defined(__i386__))) || defined(_WIN32)

// Similar to above, but with mulodi4. Perhaps this is
// something that shouldn't be done, and is a bandaid over
Expand Down
3 changes: 3 additions & 0 deletions utils/build-script-impl
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,9 @@ function set_build_options_for_host() {
linux-x86_64)
SWIFT_HOST_VARIANT_ARCH="x86_64"
;;
linux-i686)
SWIFT_HOST_VARIANT_ARCH="i686"
;;
linux-armv6)
SWIFT_HOST_VARIANT_ARCH="armv6"
SWIFT_HOST_TRIPLE="armv6-unknown-linux-gnueabihf"
Expand Down
3 changes: 3 additions & 0 deletions utils/swift_build_support/swift_build_support/targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ class StdlibDeploymentTarget(object):

Linux = Platform("linux", archs=[
"x86_64",
"i686",
"armv6",
"armv7",
"aarch64",
Expand Down Expand Up @@ -160,6 +161,8 @@ def host_target():
if system == 'Linux':
if machine == 'x86_64':
return StdlibDeploymentTarget.Linux.x86_64
elif machine == 'i686':
return StdlibDeploymentTarget.Linux.i686
elif machine.startswith('armv7'):
# linux-armv7* is canonicalized to 'linux-armv7'
return StdlibDeploymentTarget.Linux.armv7
Expand Down