Skip to content
This repository was archived by the owner on Nov 1, 2021. It is now read-only.

Commit 7d12379

Browse files
committed
Revert "[OpenCL] Pipe builtin functions"
This reverts commit r258773, it broke the build bots: http://bb.pgr.jp/builders/cmake-clang-x86_64-linux/builds/43853 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258775 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent cfba42f commit 7d12379

File tree

8 files changed

+1
-510
lines changed

8 files changed

+1
-510
lines changed

Diff for: include/clang/Basic/Builtins.def

-26
Original file line numberDiff line numberDiff line change
@@ -1252,32 +1252,6 @@ BUILTIN(__builtin___get_unsafe_stack_ptr, "v*", "Fn")
12521252
BUILTIN(__builtin_nontemporal_store, "v.", "t")
12531253
BUILTIN(__builtin_nontemporal_load, "v.", "t")
12541254

1255-
// OpenCL v2.0 s6.13.16, s9.17.3.5 - Pipe functions.
1256-
// We need the generic prototype, since the packet type could be anything.
1257-
LANGBUILTIN(read_pipe, "i.", "tn", OCLC_LANG)
1258-
LANGBUILTIN(write_pipe, "i.", "tn", OCLC_LANG)
1259-
1260-
LANGBUILTIN(reserve_read_pipe, "i.", "tn", OCLC_LANG)
1261-
LANGBUILTIN(reserve_write_pipe, "i.", "tn", OCLC_LANG)
1262-
1263-
LANGBUILTIN(commit_write_pipe, "v.", "tn", OCLC_LANG)
1264-
LANGBUILTIN(commit_read_pipe, "v.", "tn", OCLC_LANG)
1265-
1266-
LANGBUILTIN(sub_group_reserve_read_pipe, "i.", "tn", OCLC_LANG)
1267-
LANGBUILTIN(sub_group_reserve_write_pipe, "i.", "tn", OCLC_LANG)
1268-
1269-
LANGBUILTIN(sub_group_commit_read_pipe, "v.", "tn", OCLC_LANG)
1270-
LANGBUILTIN(sub_group_commit_write_pipe, "v.", "tn", OCLC_LANG)
1271-
1272-
LANGBUILTIN(work_group_reserve_read_pipe, "i.", "tn", OCLC_LANG)
1273-
LANGBUILTIN(work_group_reserve_write_pipe, "i.", "tn", OCLC_LANG)
1274-
1275-
LANGBUILTIN(work_group_commit_read_pipe, "v.", "tn", OCLC_LANG)
1276-
LANGBUILTIN(work_group_commit_write_pipe, "v.", "tn", OCLC_LANG)
1277-
1278-
LANGBUILTIN(get_pipe_num_packets, "Ui.", "tn", OCLC_LANG)
1279-
LANGBUILTIN(get_pipe_max_packets, "Ui.", "tn", OCLC_LANG)
1280-
12811255
#undef BUILTIN
12821256
#undef LIBBUILTIN
12831257
#undef LANGBUILTIN

Diff for: include/clang/Basic/Builtins.h

-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ enum LanguageID {
3636
CXX_LANG = 0x4, // builtin for cplusplus only.
3737
OBJC_LANG = 0x8, // builtin for objective-c and objective-c++
3838
MS_LANG = 0x10, // builtin requires MS mode.
39-
OCLC_LANG = 0x20,// builtin for OpenCL C only.
4039
ALL_LANGUAGES = C_LANG | CXX_LANG | OBJC_LANG, // builtin for all languages.
4140
ALL_GNU_LANGUAGES = ALL_LANGUAGES | GNU_LANG, // builtin requires GNU mode.
4241
ALL_MS_LANGUAGES = ALL_LANGUAGES | MS_LANG // builtin requires MS mode.

Diff for: include/clang/Basic/DiagnosticSemaKinds.td

-10
Original file line numberDiff line numberDiff line change
@@ -7680,16 +7680,6 @@ def err_atomic_init_constant : Error<
76807680
def err_opencl_implicit_vector_conversion : Error<
76817681
"implicit conversions between vector types (%0 and %1) are not permitted">;
76827682

7683-
// OpenCL v2.0 s6.13.6 -- Builtin Pipe Functions
7684-
def err_opencl_builtin_pipe_first_arg : Error<
7685-
"first argument to %0 must be a pipe type">;
7686-
def err_opencl_builtin_pipe_arg_num : Error<
7687-
"invalid number of arguments to function: %0">;
7688-
def err_opencl_builtin_pipe_invalid_arg : Error<
7689-
"invalid argument type to function %0 (expecting %1)">;
7690-
def err_opencl_builtin_pipe_invalid_access_modifier : Error<
7691-
"invalid pipe access modifier (expecting %0)">;
7692-
76937683
// OpenCL Section 6.8.g
76947684
def err_opencl_unknown_type_specifier : Error<
76957685
"OpenCL does not support the '%0' %select{type qualifier|storage class specifier}1">;

Diff for: lib/Basic/Builtins.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ bool Builtin::Context::builtinIsSupported(const Builtin::Info &BuiltinInfo,
6969
bool MSModeUnsupported =
7070
!LangOpts.MicrosoftExt && (BuiltinInfo.Langs & MS_LANG);
7171
bool ObjCUnsupported = !LangOpts.ObjC1 && BuiltinInfo.Langs == OBJC_LANG;
72-
bool OclCUnsupported = !LangOpts.OpenCL && BuiltinInfo.Langs == OCLC_LANG;
73-
return !BuiltinsUnsupported && !MathBuiltinsUnsupported && !OclCUnsupported &&
72+
return !BuiltinsUnsupported && !MathBuiltinsUnsupported &&
7473
!GnuModeUnsupported && !MSModeUnsupported && !ObjCUnsupported;
7574
}
7675

Diff for: lib/CodeGen/CGBuiltin.cpp

-135
Original file line numberDiff line numberDiff line change
@@ -3341,141 +3341,6 @@ Value *CodeGenFunction::EmitCommonNeonBuiltinExpr(
33413341
}
33423342
return SV;
33433343
}
3344-
3345-
// OpenCL v2.0 s6.13.16.2, Built-in pipe read and write functions
3346-
case Builtin::BIread_pipe:
3347-
case Builtin::BIwrite_pipe: {
3348-
Value *Arg0 = EmitScalarExpr(E->getArg(0)),
3349-
*Arg1 = EmitScalarExpr(E->getArg(1));
3350-
3351-
// Type of the generic packet parameter.
3352-
unsigned GenericAS =
3353-
getContext().getTargetAddressSpace(LangAS::opencl_generic);
3354-
llvm::Type *I8PTy = llvm::PointerType::get(
3355-
llvm::Type::getInt8Ty(getLLVMContext()), GenericAS);
3356-
3357-
// Testing which overloaded version we should generate the call for.
3358-
if (2U == E->getNumArgs()) {
3359-
const char *Name = (BuiltinID == Builtin::BIread_pipe) ? "__read_pipe_2"
3360-
: "__write_pipe_2";
3361-
// Creating a generic function type to be able to call with any builtin or
3362-
// user defined type.
3363-
llvm::Type *ArgTys[] = {Arg0->getType(), I8PTy};
3364-
llvm::FunctionType *FTy = llvm::FunctionType::get(
3365-
Int32Ty, llvm::ArrayRef<llvm::Type *>(ArgTys), false);
3366-
Value *BCast = Builder.CreatePointerCast(Arg1, I8PTy);
3367-
return RValue::get(Builder.CreateCall(
3368-
CGM.CreateRuntimeFunction(FTy, Name), {Arg0, BCast}));
3369-
} else {
3370-
assert(4 == E->getNumArgs() &&
3371-
"Illegal number of parameters to pipe function");
3372-
const char *Name = (BuiltinID == Builtin::BIread_pipe) ? "__read_pipe_4"
3373-
: "__write_pipe_4";
3374-
3375-
llvm::Type *ArgTys[] = {Arg0->getType(), Arg1->getType(), Int32Ty, I8PTy};
3376-
Value *Arg2 = EmitScalarExpr(E->getArg(2)),
3377-
*Arg3 = EmitScalarExpr(E->getArg(3));
3378-
llvm::FunctionType *FTy = llvm::FunctionType::get(
3379-
Int32Ty, llvm::ArrayRef<llvm::Type *>(ArgTys), false);
3380-
Value *BCast = Builder.CreatePointerCast(Arg3, I8PTy);
3381-
// We know the third argument is an integer type, but we may need to cast
3382-
// it to i32.
3383-
if (Arg2->getType() != Int32Ty)
3384-
Arg2 = Builder.CreateZExtOrTrunc(Arg2, Int32Ty);
3385-
return RValue::get(Builder.CreateCall(
3386-
CGM.CreateRuntimeFunction(FTy, Name), {Arg0, Arg1, Arg2, BCast}));
3387-
}
3388-
}
3389-
// OpenCL v2.0 s6.13.16 ,s9.17.3.5 - Built-in pipe reserve read and write
3390-
// functions
3391-
case Builtin::BIreserve_read_pipe:
3392-
case Builtin::BIreserve_write_pipe:
3393-
case Builtin::BIwork_group_reserve_read_pipe:
3394-
case Builtin::BIwork_group_reserve_write_pipe:
3395-
case Builtin::BIsub_group_reserve_read_pipe:
3396-
case Builtin::BIsub_group_reserve_write_pipe: {
3397-
// Composing the mangled name for the function.
3398-
const char *Name;
3399-
if (BuiltinID == Builtin::BIreserve_read_pipe)
3400-
Name = "__reserve_read_pipe";
3401-
else if (BuiltinID == Builtin::BIreserve_write_pipe)
3402-
Name = "__reserve_write_pipe";
3403-
else if (BuiltinID == Builtin::BIwork_group_reserve_read_pipe)
3404-
Name = "__work_group_reserve_read_pipe";
3405-
else if (BuiltinID == Builtin::BIwork_group_reserve_write_pipe)
3406-
Name = "__work_group_reserve_write_pipe";
3407-
else if (BuiltinID == Builtin::BIsub_group_reserve_read_pipe)
3408-
Name = "__sub_group_reserve_read_pipe";
3409-
else
3410-
Name = "__sub_group_reserve_write_pipe";
3411-
3412-
Value *Arg0 = EmitScalarExpr(E->getArg(0)),
3413-
*Arg1 = EmitScalarExpr(E->getArg(1));
3414-
llvm::Type *ReservedIDTy = ConvertType(getContext().OCLReserveIDTy);
3415-
3416-
// Building the generic function prototype.
3417-
llvm::Type *ArgTys[] = {Arg0->getType(), Int32Ty};
3418-
llvm::FunctionType *FTy = llvm::FunctionType::get(
3419-
ReservedIDTy, llvm::ArrayRef<llvm::Type *>(ArgTys), false);
3420-
// We know the second argument is an integer type, but we may need to cast
3421-
// it to i32.
3422-
if (Arg1->getType() != Int32Ty)
3423-
Arg1 = Builder.CreateZExtOrTrunc(Arg1, Int32Ty);
3424-
return RValue::get(
3425-
Builder.CreateCall(CGM.CreateRuntimeFunction(FTy, Name), {Arg0, Arg1}));
3426-
}
3427-
// OpenCL v2.0 s6.13.16 ,s9.17.3.5 - Built-in pipe commit read and write
3428-
// functions
3429-
case Builtin::BIcommit_read_pipe:
3430-
case Builtin::BIcommit_write_pipe:
3431-
case Builtin::BIwork_group_commit_read_pipe:
3432-
case Builtin::BIwork_group_commit_write_pipe:
3433-
case Builtin::BIsub_group_commit_read_pipe:
3434-
case Builtin::BIsub_group_commit_write_pipe: {
3435-
const char *Name;
3436-
if (BuiltinID == Builtin::BIcommit_read_pipe)
3437-
Name = "__commit_read_pipe";
3438-
else if (BuiltinID == Builtin::BIcommit_write_pipe)
3439-
Name = "__commit_write_pipe";
3440-
else if (BuiltinID == Builtin::BIwork_group_commit_read_pipe)
3441-
Name = "__work_group_commit_read_pipe";
3442-
else if (BuiltinID == Builtin::BIwork_group_commit_write_pipe)
3443-
Name = "__work_group_commit_write_pipe";
3444-
else if (BuiltinID == Builtin::BIsub_group_commit_read_pipe)
3445-
Name = "__sub_group_commit_read_pipe";
3446-
else
3447-
Name = "__sub_group_commit_write_pipe";
3448-
3449-
Value *Arg0 = EmitScalarExpr(E->getArg(0)),
3450-
*Arg1 = EmitScalarExpr(E->getArg(1));
3451-
3452-
// Building the generic function prototype.
3453-
llvm::Type *ArgTys[] = {Arg0->getType(), Arg1->getType()};
3454-
llvm::FunctionType *FTy =
3455-
llvm::FunctionType::get(llvm::Type::getVoidTy(getLLVMContext()),
3456-
llvm::ArrayRef<llvm::Type *>(ArgTys), false);
3457-
3458-
return RValue::get(
3459-
Builder.CreateCall(CGM.CreateRuntimeFunction(FTy, Name), {Arg0, Arg1}));
3460-
}
3461-
// OpenCL v2.0 s6.13.16.4 Built-in pipe query functions
3462-
case Builtin::BIget_pipe_num_packets:
3463-
case Builtin::BIget_pipe_max_packets: {
3464-
const char *Name;
3465-
if (BuiltinID == Builtin::BIget_pipe_num_packets)
3466-
Name = "__get_pipe_num_packets";
3467-
else
3468-
Name = "__get_pipe_max_packets";
3469-
3470-
// Building the generic function prototype.
3471-
Value *Arg0 = EmitScalarExpr(E->getArg(0));
3472-
llvm::Type *ArgTys[] = {Arg0->getType()};
3473-
llvm::FunctionType *FTy = llvm::FunctionType::get(
3474-
Int32Ty, llvm::ArrayRef<llvm::Type *>(ArgTys), false);
3475-
3476-
return RValue::get(
3477-
Builder.CreateCall(CGM.CreateRuntimeFunction(FTy, Name), {Arg0}));
3478-
}
34793344
}
34803345

34813346
assert(Int && "Expected valid intrinsic number");

0 commit comments

Comments
 (0)