Skip to content

Commit ab8e5fe

Browse files
baderromanovvlad
authored andcommitted
[SYCL][NFC] Remove SYCL specific TargetInfo types (#965)
This workaround is not needed anymore. Signed-off-by: Alexey Bader <[email protected]>
1 parent 8ebfecf commit ab8e5fe

File tree

2 files changed

+12
-58
lines changed

2 files changed

+12
-58
lines changed

clang/lib/Basic/Targets.cpp

+8-26
Original file line numberDiff line numberDiff line change
@@ -564,19 +564,10 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple,
564564
case llvm::Triple::spir: {
565565
if (Triple.getEnvironment() == llvm::Triple::SYCLDevice) {
566566
llvm::Triple HT(Opts.HostTriple);
567-
switch (HT.getOS()) {
568-
case llvm::Triple::Win32:
569-
switch (HT.getEnvironment()) {
570-
default: // Assume MSVC for unknown environments
571-
case llvm::Triple::MSVC:
572-
assert(HT.getArch() == llvm::Triple::x86 &&
573-
"Unsupported host architecture");
574-
return new MicrosoftX86_32SPIRTargetInfo(Triple, Opts);
575-
}
576-
case llvm::Triple::Linux:
577-
return new LinuxTargetInfo<SPIR32SYCLDeviceTargetInfo>(Triple, Opts);
578-
default:
579-
return new SPIR32SYCLDeviceTargetInfo(Triple, Opts);
567+
if (HT.getOS() == llvm::Triple::Win32) {
568+
assert(HT.getArch() == llvm::Triple::x86 &&
569+
"Unsupported host architecture");
570+
return new MicrosoftX86_32SPIRTargetInfo(Triple, Opts);
580571
}
581572
}
582573
return new SPIR32TargetInfo(Triple, Opts);
@@ -585,19 +576,10 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple,
585576
case llvm::Triple::spir64: {
586577
if (Triple.getEnvironment() == llvm::Triple::SYCLDevice) {
587578
llvm::Triple HT(Opts.HostTriple);
588-
switch (HT.getOS()) {
589-
case llvm::Triple::Win32:
590-
switch (HT.getEnvironment()) {
591-
default: // Assume MSVC for unknown environments
592-
case llvm::Triple::MSVC:
593-
assert(HT.getArch() == llvm::Triple::x86_64 &&
594-
"Unsupported host architecture");
595-
return new MicrosoftX86_64_SPIR64TargetInfo(Triple, Opts);
596-
}
597-
case llvm::Triple::Linux:
598-
return new LinuxTargetInfo<SPIR64SYCLDeviceTargetInfo>(Triple, Opts);
599-
default:
600-
return new SPIR64SYCLDeviceTargetInfo(Triple, Opts);
579+
if (HT.getOS() == llvm::Triple::Win32) {
580+
assert(HT.getArch() == llvm::Triple::x86_64 &&
581+
"Unsupported host architecture");
582+
return new MicrosoftX86_64_SPIR64TargetInfo(Triple, Opts);
601583
}
602584
}
603585
return new SPIR64TargetInfo(Triple, Opts);

clang/lib/Basic/Targets/SPIR.h

+4-32
Original file line numberDiff line numberDiff line change
@@ -153,40 +153,12 @@ class LLVM_LIBRARY_VISIBILITY SPIR64TargetInfo : public SPIRTargetInfo {
153153
MacroBuilder &Builder) const override;
154154
};
155155

156-
class LLVM_LIBRARY_VISIBILITY SPIR32SYCLDeviceTargetInfo
157-
: public SPIR32TargetInfo {
158-
public:
159-
SPIR32SYCLDeviceTargetInfo(const llvm::Triple &Triple,
160-
const TargetOptions &Opts)
161-
: SPIR32TargetInfo(Triple, Opts) {
162-
// This is workaround for exception_ptr class.
163-
// Exceptions is not allowed in sycl device code but we should be able
164-
// to parse host code. So we allow compilation of exception_ptr but
165-
// if exceptions are used in device code we should emit a diagnostic.
166-
MaxAtomicInlineWidth = 32;
167-
}
168-
};
169-
170-
class LLVM_LIBRARY_VISIBILITY SPIR64SYCLDeviceTargetInfo
171-
: public SPIR64TargetInfo {
172-
public:
173-
SPIR64SYCLDeviceTargetInfo(const llvm::Triple &Triple,
174-
const TargetOptions &Opts)
175-
: SPIR64TargetInfo(Triple, Opts) {
176-
// This is workaround for exception_ptr class.
177-
// Exceptions is not allowed in sycl device code but we should be able
178-
// to parse host code. So we allow compilation of exception_ptr but
179-
// if exceptions are used in device code we should emit a diagnostic.
180-
MaxAtomicInlineWidth = 64;
181-
}
182-
};
183-
184156
// x86-32 SPIR Windows target
185157
class LLVM_LIBRARY_VISIBILITY WindowsX86_32SPIRTargetInfo
186-
: public WindowsTargetInfo<SPIR32SYCLDeviceTargetInfo> {
158+
: public WindowsTargetInfo<SPIR32TargetInfo> {
187159
public:
188160
WindowsX86_32SPIRTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
189-
: WindowsTargetInfo<SPIR32SYCLDeviceTargetInfo>(Triple, Opts) {
161+
: WindowsTargetInfo<SPIR32TargetInfo>(Triple, Opts) {
190162
DoubleAlign = LongLongAlign = 64;
191163
WCharType = UnsignedShort;
192164
}
@@ -229,10 +201,10 @@ class LLVM_LIBRARY_VISIBILITY MicrosoftX86_32SPIRTargetInfo
229201

230202
// x86-64 SPIR64 Windows target
231203
class LLVM_LIBRARY_VISIBILITY WindowsX86_64_SPIR64TargetInfo
232-
: public WindowsTargetInfo<SPIR64SYCLDeviceTargetInfo> {
204+
: public WindowsTargetInfo<SPIR64TargetInfo> {
233205
public:
234206
WindowsX86_64_SPIR64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
235-
: WindowsTargetInfo<SPIR64SYCLDeviceTargetInfo>(Triple, Opts) {
207+
: WindowsTargetInfo<SPIR64TargetInfo>(Triple, Opts) {
236208
LongWidth = LongAlign = 32;
237209
DoubleAlign = LongLongAlign = 64;
238210
IntMaxType = SignedLongLong;

0 commit comments

Comments
 (0)