Compare commits
14 Commits
llvm-test-
...
llvmorg-3.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e6a6b76ef5 | ||
|
|
3f48946bee | ||
|
|
fcab280ff6 | ||
|
|
a6a08e04e1 | ||
|
|
4b546deebf | ||
|
|
21a7129570 | ||
|
|
1de95ce83d | ||
|
|
68813cd78b | ||
|
|
9afea5975a | ||
|
|
23a96ccc5d | ||
|
|
7773e9f439 | ||
|
|
22ffa6296c | ||
|
|
8d13612af6 | ||
|
|
413a2d2642 |
@@ -2051,7 +2051,7 @@ def err_attribute_wrong_decl_type : Error<
|
||||
"variables, functions and tag types|thread-local variables|"
|
||||
"variables and fields|variables, data members and tag types|"
|
||||
"types and namespaces|Objective-C interfaces|"
|
||||
"methods and properties}1">;
|
||||
"methods and properties|struct or union|struct, union or class}1">;
|
||||
def warn_type_attribute_wrong_type : Warning<
|
||||
"'%0' only applies to %select{function|pointer|"
|
||||
"Objective-C object or block pointer}1 types; type here is %2">,
|
||||
@@ -2441,8 +2441,6 @@ def err_ns_bridged_not_interface : Error<
|
||||
// objc_bridge attribute diagnostics.
|
||||
def err_objc_bridge_not_id : Error<
|
||||
"parameter of 'objc_bridge' attribute must be a single name of an Objective-C class">;
|
||||
def err_objc_bridge_attribute : Error<
|
||||
"'objc_bridge' attribute must be applied to a struct%select{|, C++ class}0 or union">;
|
||||
def err_objc_cf_bridged_not_interface : Error<
|
||||
"CF object of type %0 is bridged to '%1', which is not an Objective-C class">;
|
||||
def err_objc_ns_bridged_invalid_cfobject : Error<
|
||||
|
||||
@@ -1647,6 +1647,9 @@ private:
|
||||
AccessSpecifier AS = AS_none,
|
||||
DeclSpecContext DSC = DSC_normal,
|
||||
LateParsedAttrList *LateAttrs = 0);
|
||||
bool DiagnoseMissingSemiAfterTagDefinition(DeclSpec &DS, AccessSpecifier AS,
|
||||
DeclSpecContext DSContext,
|
||||
LateParsedAttrList *LateAttrs = 0);
|
||||
|
||||
void ParseSpecifierQualifierList(DeclSpec &DS, AccessSpecifier AS = AS_none,
|
||||
DeclSpecContext DSC = DSC_normal);
|
||||
|
||||
@@ -461,6 +461,12 @@ public:
|
||||
ThreadStorageClassSpecLoc = SourceLocation();
|
||||
}
|
||||
|
||||
void ClearTypeSpecType() {
|
||||
TypeSpecType = DeclSpec::TST_unspecified;
|
||||
TypeSpecOwned = false;
|
||||
TSTLoc = SourceLocation();
|
||||
}
|
||||
|
||||
// type-specifier
|
||||
TSW getTypeSpecWidth() const { return (TSW)TypeSpecWidth; }
|
||||
TSC getTypeSpecComplex() const { return (TSC)TypeSpecComplex; }
|
||||
@@ -507,6 +513,8 @@ public:
|
||||
return TypeSpecType == TST_auto || TypeSpecType == TST_decltype_auto;
|
||||
}
|
||||
|
||||
bool hasTagDefinition() const;
|
||||
|
||||
/// \brief Turn a type-specifier-type into a string like "_Bool" or "union".
|
||||
static const char *getSpecifierName(DeclSpec::TST T);
|
||||
static const char *getSpecifierName(DeclSpec::TQ Q);
|
||||
|
||||
@@ -2017,6 +2017,8 @@ static bool isMsLayout(const RecordDecl* D) {
|
||||
// * If the last field is a non-zero length bitfield and we have any virtual
|
||||
// bases then some extra padding is added before the virtual bases for no
|
||||
// obvious reason.
|
||||
// * When laying out empty non-virtual bases, an extra byte of padding is added
|
||||
// if the non-virtual base before the empty non-virtual base has a vbptr.
|
||||
|
||||
|
||||
namespace {
|
||||
@@ -2141,6 +2143,8 @@ public:
|
||||
bool LastBaseWasEmpty;
|
||||
/// \brief Lets us know if we're in 64-bit mode
|
||||
bool Is64BitMode;
|
||||
/// \brief True if the last non-virtual base has a vbptr.
|
||||
bool LastNonVirtualBaseHasVBPtr;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
@@ -2304,6 +2308,7 @@ void
|
||||
MicrosoftRecordLayoutBuilder::layoutNonVirtualBases(const CXXRecordDecl *RD) {
|
||||
LazyEmptyBase = 0;
|
||||
LastBaseWasEmpty = false;
|
||||
LastNonVirtualBaseHasVBPtr = false;
|
||||
|
||||
// Lay out the primary base first.
|
||||
if (PrimaryBase)
|
||||
@@ -2331,6 +2336,10 @@ MicrosoftRecordLayoutBuilder::layoutNonVirtualBase(const CXXRecordDecl *RD) {
|
||||
const ASTRecordLayout &LazyLayout =
|
||||
Context.getASTRecordLayout(LazyEmptyBase);
|
||||
Size = Size.RoundUpToAlignment(LazyLayout.getAlignment());
|
||||
// If the last non-virtual base has a vbptr we add a byte of padding for no
|
||||
// obvious reason.
|
||||
if (LastNonVirtualBaseHasVBPtr)
|
||||
Size++;
|
||||
Bases.insert(std::make_pair(LazyEmptyBase, Size));
|
||||
// Empty bases only consume space when followed by another empty base.
|
||||
if (RD && Layout->getNonVirtualSize().isZero()) {
|
||||
@@ -2338,6 +2347,7 @@ MicrosoftRecordLayoutBuilder::layoutNonVirtualBase(const CXXRecordDecl *RD) {
|
||||
Size++;
|
||||
}
|
||||
LazyEmptyBase = 0;
|
||||
LastNonVirtualBaseHasVBPtr = false;
|
||||
}
|
||||
|
||||
// RD is null when flushing the final lazy base.
|
||||
@@ -2356,6 +2366,7 @@ MicrosoftRecordLayoutBuilder::layoutNonVirtualBase(const CXXRecordDecl *RD) {
|
||||
// Note: we don't update alignment here because it was accounted
|
||||
// for during initalization.
|
||||
LastBaseWasEmpty = false;
|
||||
LastNonVirtualBaseHasVBPtr = Layout->hasVBPtr();
|
||||
}
|
||||
|
||||
void MicrosoftRecordLayoutBuilder::layoutVBPtr(const CXXRecordDecl *RD) {
|
||||
|
||||
@@ -399,7 +399,7 @@ public:
|
||||
? 0
|
||||
: Limit - TheLine->Last->TotalLength;
|
||||
|
||||
if (I + 1 == E || (*(I + 1))->Type == LT_Invalid)
|
||||
if (I + 1 == E || I[1]->Type == LT_Invalid)
|
||||
return 0;
|
||||
|
||||
if (TheLine->Last->is(tok::l_brace)) {
|
||||
@@ -424,12 +424,11 @@ private:
|
||||
unsigned Limit) {
|
||||
if (Limit == 0)
|
||||
return 0;
|
||||
if (!(*(I + 1))->InPPDirective || (*(I + 1))->First->HasUnescapedNewline)
|
||||
if (!I[1]->InPPDirective || I[1]->First->HasUnescapedNewline)
|
||||
return 0;
|
||||
if (I + 2 != E && (*(I + 2))->InPPDirective &&
|
||||
!(*(I + 2))->First->HasUnescapedNewline)
|
||||
if (I + 2 != E && I[2]->InPPDirective && !I[2]->First->HasUnescapedNewline)
|
||||
return 0;
|
||||
if (1 + (*(I + 1))->Last->TotalLength > Limit)
|
||||
if (1 + I[1]->Last->TotalLength > Limit)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
@@ -440,23 +439,23 @@ private:
|
||||
if (Limit == 0)
|
||||
return 0;
|
||||
if (Style.BreakBeforeBraces == FormatStyle::BS_Allman &&
|
||||
(*(I + 1))->First->is(tok::l_brace))
|
||||
I[1]->First->is(tok::l_brace))
|
||||
return 0;
|
||||
if ((*(I + 1))->InPPDirective != (*I)->InPPDirective ||
|
||||
((*(I + 1))->InPPDirective && (*(I + 1))->First->HasUnescapedNewline))
|
||||
if (I[1]->InPPDirective != (*I)->InPPDirective ||
|
||||
(I[1]->InPPDirective && I[1]->First->HasUnescapedNewline))
|
||||
return 0;
|
||||
AnnotatedLine &Line = **I;
|
||||
if (Line.Last->isNot(tok::r_paren))
|
||||
return 0;
|
||||
if (1 + (*(I + 1))->Last->TotalLength > Limit)
|
||||
if (1 + I[1]->Last->TotalLength > Limit)
|
||||
return 0;
|
||||
if ((*(I + 1))->First->isOneOf(tok::semi, tok::kw_if, tok::kw_for,
|
||||
if (I[1]->First->isOneOf(tok::semi, tok::kw_if, tok::kw_for,
|
||||
tok::kw_while) ||
|
||||
(*(I + 1))->First->Type == TT_LineComment)
|
||||
I[1]->First->Type == TT_LineComment)
|
||||
return 0;
|
||||
// Only inline simple if's (no nested if or else).
|
||||
if (I + 2 != E && Line.First->is(tok::kw_if) &&
|
||||
(*(I + 2))->First->is(tok::kw_else))
|
||||
I[2]->First->is(tok::kw_else))
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
@@ -480,7 +479,7 @@ private:
|
||||
tok::at, tok::minus, tok::plus))
|
||||
return 0;
|
||||
|
||||
FormatToken *Tok = (*(I + 1))->First;
|
||||
FormatToken *Tok = I[1]->First;
|
||||
if (Tok->is(tok::r_brace) && !Tok->MustBreakBefore &&
|
||||
(Tok->getNextNonComment() == NULL ||
|
||||
Tok->getNextNonComment()->is(tok::semi))) {
|
||||
@@ -490,7 +489,7 @@ private:
|
||||
return 1;
|
||||
} else if (Limit != 0 && Line.First->isNot(tok::kw_namespace)) {
|
||||
// Check that we still have three lines and they fit into the limit.
|
||||
if (I + 2 == E || (*(I + 2))->Type == LT_Invalid)
|
||||
if (I + 2 == E || I[2]->Type == LT_Invalid)
|
||||
return 0;
|
||||
|
||||
if (!nextTwoLinesFitInto(I, Limit))
|
||||
@@ -498,7 +497,7 @@ private:
|
||||
|
||||
// Second, check that the next line does not contain any braces - if it
|
||||
// does, readability declines when putting it into a single line.
|
||||
if ((*(I + 1))->Last->Type == TT_LineComment || Tok->MustBreakBefore)
|
||||
if (I[1]->Last->Type == TT_LineComment || Tok->MustBreakBefore)
|
||||
return 0;
|
||||
do {
|
||||
if (Tok->isOneOf(tok::l_brace, tok::r_brace))
|
||||
@@ -507,7 +506,7 @@ private:
|
||||
} while (Tok != NULL);
|
||||
|
||||
// Last, check that the third line contains a single closing brace.
|
||||
Tok = (*(I + 2))->First;
|
||||
Tok = I[2]->First;
|
||||
if (Tok->getNextNonComment() != NULL || Tok->isNot(tok::r_brace) ||
|
||||
Tok->MustBreakBefore)
|
||||
return 0;
|
||||
@@ -519,9 +518,7 @@ private:
|
||||
|
||||
bool nextTwoLinesFitInto(SmallVectorImpl<AnnotatedLine *>::const_iterator I,
|
||||
unsigned Limit) {
|
||||
return 1 + (*(I + 1))->Last->TotalLength + 1 +
|
||||
(*(I + 2))->Last->TotalLength <=
|
||||
Limit;
|
||||
return 1 + I[1]->Last->TotalLength + 1 + I[2]->Last->TotalLength <= Limit;
|
||||
}
|
||||
|
||||
const FormatStyle &Style;
|
||||
@@ -571,7 +568,7 @@ public:
|
||||
unsigned MergedLines = Joiner.tryFitMultipleLinesInOne(Indent, I, E);
|
||||
if (!DryRun) {
|
||||
for (unsigned i = 0; i < MergedLines; ++i) {
|
||||
join(**(I + i), **(I + i + 1));
|
||||
join(*I[i], *I[i + 1]);
|
||||
}
|
||||
}
|
||||
I += MergedLines;
|
||||
@@ -599,7 +596,7 @@ public:
|
||||
// If everything fits on a single line, just put it there.
|
||||
unsigned ColumnLimit = Style.ColumnLimit;
|
||||
if (I + 1 != E) {
|
||||
AnnotatedLine *NextLine = *(I + 1);
|
||||
AnnotatedLine *NextLine = I[1];
|
||||
if (NextLine->InPPDirective && !NextLine->First->HasUnescapedNewline)
|
||||
ColumnLimit = getColumnLimit(TheLine.InPPDirective);
|
||||
}
|
||||
|
||||
@@ -1401,8 +1401,14 @@ Parser::ParseSimpleDeclaration(StmtVector &Stmts, unsigned Context,
|
||||
// Parse the common declaration-specifiers piece.
|
||||
ParsingDeclSpec DS(*this);
|
||||
|
||||
ParseDeclarationSpecifiers(DS, ParsedTemplateInfo(), AS_none,
|
||||
getDeclSpecContextFromDeclaratorContext(Context));
|
||||
DeclSpecContext DSContext = getDeclSpecContextFromDeclaratorContext(Context);
|
||||
ParseDeclarationSpecifiers(DS, ParsedTemplateInfo(), AS_none, DSContext);
|
||||
|
||||
// If we had a free-standing type definition with a missing semicolon, we
|
||||
// may get this far before the problem becomes obvious.
|
||||
if (DS.hasTagDefinition() &&
|
||||
DiagnoseMissingSemiAfterTagDefinition(DS, AS_none, DSContext))
|
||||
return DeclGroupPtrTy();
|
||||
|
||||
// C99 6.7.2.3p6: Handle "struct-or-union identifier;", "enum { X };"
|
||||
// declaration-specifiers init-declarator-list[opt] ';'
|
||||
@@ -2318,6 +2324,101 @@ void Parser::ParseAlignmentSpecifier(ParsedAttributes &Attrs,
|
||||
AttributeList::AS_Keyword, EllipsisLoc);
|
||||
}
|
||||
|
||||
/// Determine whether we're looking at something that might be a declarator
|
||||
/// in a simple-declaration. If it can't possibly be a declarator, maybe
|
||||
/// diagnose a missing semicolon after a prior tag definition in the decl
|
||||
/// specifier.
|
||||
///
|
||||
/// \return \c true if an error occurred and this can't be any kind of
|
||||
/// declaration.
|
||||
bool
|
||||
Parser::DiagnoseMissingSemiAfterTagDefinition(DeclSpec &DS, AccessSpecifier AS,
|
||||
DeclSpecContext DSContext,
|
||||
LateParsedAttrList *LateAttrs) {
|
||||
assert(DS.hasTagDefinition() && "shouldn't call this");
|
||||
|
||||
bool EnteringContext = (DSContext == DSC_class || DSContext == DSC_top_level);
|
||||
bool HasMissingSemi = false;
|
||||
|
||||
if (getLangOpts().CPlusPlus &&
|
||||
(Tok.is(tok::identifier) || Tok.is(tok::coloncolon) ||
|
||||
Tok.is(tok::kw_decltype) || Tok.is(tok::annot_template_id)) &&
|
||||
TryAnnotateCXXScopeToken(EnteringContext)) {
|
||||
SkipMalformedDecl();
|
||||
return true;
|
||||
}
|
||||
|
||||
// Determine whether the following tokens could possibly be a
|
||||
// declarator.
|
||||
if (Tok.is(tok::identifier) || Tok.is(tok::annot_template_id)) {
|
||||
const Token &Next = NextToken();
|
||||
// These tokens cannot come after the declarator-id in a
|
||||
// simple-declaration, and are likely to come after a type-specifier.
|
||||
HasMissingSemi = Next.is(tok::star) || Next.is(tok::amp) ||
|
||||
Next.is(tok::ampamp) || Next.is(tok::identifier) ||
|
||||
Next.is(tok::annot_cxxscope) ||
|
||||
Next.is(tok::coloncolon);
|
||||
} else if (Tok.is(tok::annot_cxxscope) &&
|
||||
NextToken().is(tok::identifier) &&
|
||||
DS.getStorageClassSpec() != DeclSpec::SCS_typedef) {
|
||||
// We almost certainly have a missing semicolon. Look up the name and
|
||||
// check; if it names a type, we're missing a semicolon.
|
||||
CXXScopeSpec SS;
|
||||
Actions.RestoreNestedNameSpecifierAnnotation(Tok.getAnnotationValue(),
|
||||
Tok.getAnnotationRange(), SS);
|
||||
const Token &Next = NextToken();
|
||||
IdentifierInfo *Name = Next.getIdentifierInfo();
|
||||
Sema::NameClassification Classification =
|
||||
Actions.ClassifyName(getCurScope(), SS, Name, Next.getLocation(),
|
||||
NextToken(), /*IsAddressOfOperand*/false);
|
||||
switch (Classification.getKind()) {
|
||||
case Sema::NC_Error:
|
||||
SkipMalformedDecl();
|
||||
return true;
|
||||
|
||||
case Sema::NC_Keyword:
|
||||
case Sema::NC_NestedNameSpecifier:
|
||||
llvm_unreachable("typo correction and nested name specifiers not "
|
||||
"possible here");
|
||||
|
||||
case Sema::NC_Type:
|
||||
case Sema::NC_TypeTemplate:
|
||||
// Not a previously-declared non-type entity.
|
||||
HasMissingSemi = true;
|
||||
break;
|
||||
|
||||
case Sema::NC_Unknown:
|
||||
case Sema::NC_Expression:
|
||||
case Sema::NC_VarTemplate:
|
||||
case Sema::NC_FunctionTemplate:
|
||||
// Might be a redeclaration of a prior entity.
|
||||
HasMissingSemi = false;
|
||||
break;
|
||||
}
|
||||
} else if (Tok.is(tok::kw_typename) || Tok.is(tok::annot_typename)) {
|
||||
HasMissingSemi = true;
|
||||
}
|
||||
|
||||
if (!HasMissingSemi)
|
||||
return false;
|
||||
|
||||
Diag(PP.getLocForEndOfToken(DS.getRepAsDecl()->getLocEnd()),
|
||||
diag::err_expected_semi_after_tagdecl)
|
||||
<< DeclSpec::getSpecifierName(DS.getTypeSpecType());
|
||||
|
||||
// Try to recover from the typo, by dropping the tag definition and parsing
|
||||
// the problematic tokens as a type.
|
||||
//
|
||||
// FIXME: Split the DeclSpec into pieces for the standalone
|
||||
// declaration and pieces for the following declaration, instead
|
||||
// of assuming that all the other pieces attach to new declaration,
|
||||
// and call ParsedFreeStandingDeclSpec as appropriate.
|
||||
DS.ClearTypeSpecType();
|
||||
ParsedTemplateInfo NotATemplate;
|
||||
ParseDeclarationSpecifiers(DS, NotATemplate, AS, DSContext, LateAttrs);
|
||||
return false;
|
||||
}
|
||||
|
||||
/// ParseDeclarationSpecifiers
|
||||
/// declaration-specifiers: [C99 6.7]
|
||||
/// storage-class-specifier declaration-specifiers[opt]
|
||||
@@ -2586,6 +2687,11 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
|
||||
}
|
||||
|
||||
case tok::annot_typename: {
|
||||
// If we've previously seen a tag definition, we were almost surely
|
||||
// missing a semicolon after it.
|
||||
if (DS.hasTypeSpecifier() && DS.hasTagDefinition())
|
||||
goto DoneWithDeclSpec;
|
||||
|
||||
if (Tok.getAnnotationValue()) {
|
||||
ParsedType T = getTypeAnnotation(Tok);
|
||||
isInvalid = DS.SetTypeSpecType(DeclSpec::TST_typename, Loc, PrevSpec,
|
||||
|
||||
@@ -2077,6 +2077,14 @@ void Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS,
|
||||
ParseDeclarationSpecifiers(DS, TemplateInfo, AS, DSC_class,
|
||||
&CommonLateParsedAttrs);
|
||||
|
||||
// If we had a free-standing type definition with a missing semicolon, we
|
||||
// may get this far before the problem becomes obvious.
|
||||
if (DS.hasTagDefinition() &&
|
||||
TemplateInfo.Kind == ParsedTemplateInfo::NonTemplate &&
|
||||
DiagnoseMissingSemiAfterTagDefinition(DS, AS, DSC_class,
|
||||
&CommonLateParsedAttrs))
|
||||
return;
|
||||
|
||||
MultiTemplateParamsArg TemplateParams(
|
||||
TemplateInfo.TemplateParams? TemplateInfo.TemplateParams->data() : 0,
|
||||
TemplateInfo.TemplateParams? TemplateInfo.TemplateParams->size() : 0);
|
||||
|
||||
@@ -875,6 +875,12 @@ Parser::ParseDeclOrFunctionDefInternal(ParsedAttributesWithRange &attrs,
|
||||
// Parse the common declaration-specifiers piece.
|
||||
ParseDeclarationSpecifiers(DS, ParsedTemplateInfo(), AS, DSC_top_level);
|
||||
|
||||
// If we had a free-standing type definition with a missing semicolon, we
|
||||
// may get this far before the problem becomes obvious.
|
||||
if (DS.hasTagDefinition() &&
|
||||
DiagnoseMissingSemiAfterTagDefinition(DS, AS, DSC_top_level))
|
||||
return DeclGroupPtrTy();
|
||||
|
||||
// C99 6.7.2.3p6: Handle "struct-or-union identifier;", "enum { X };"
|
||||
// declaration-specifiers init-declarator-list[opt] ';'
|
||||
if (Tok.is(tok::semi)) {
|
||||
|
||||
@@ -333,6 +333,12 @@ bool Declarator::isStaticMember() {
|
||||
getName().OperatorFunctionId.Operator);
|
||||
}
|
||||
|
||||
bool DeclSpec::hasTagDefinition() const {
|
||||
if (!TypeSpecOwned)
|
||||
return false;
|
||||
return cast<TagDecl>(getRepAsDecl())->isCompleteDefinition();
|
||||
}
|
||||
|
||||
/// getParsedSpecifiers - Return a bitmask of which flavors of specifiers this
|
||||
/// declaration specifier includes.
|
||||
///
|
||||
|
||||
@@ -55,7 +55,9 @@ enum AttributeDeclKind {
|
||||
ExpectedVariableFieldOrTag,
|
||||
ExpectedTypeOrNamespace,
|
||||
ExpectedObjectiveCInterface,
|
||||
ExpectedMethodOrProperty
|
||||
ExpectedMethodOrProperty,
|
||||
ExpectedStructOrUnion,
|
||||
ExpectedStructOrUnionOrClass
|
||||
};
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
@@ -4392,8 +4394,10 @@ static void handleNSBridgedAttr(Sema &S, Scope *Sc, Decl *D,
|
||||
static void handleObjCBridgeAttr(Sema &S, Scope *Sc, Decl *D,
|
||||
const AttributeList &Attr) {
|
||||
if (!isa<RecordDecl>(D)) {
|
||||
S.Diag(D->getLocStart(), diag::err_objc_bridge_attribute)
|
||||
<< S.getLangOpts().CPlusPlus;
|
||||
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type)
|
||||
<< Attr.getName()
|
||||
<< (S.getLangOpts().CPlusPlus ? ExpectedStructOrUnionOrClass
|
||||
: ExpectedStructOrUnion);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -10619,17 +10619,8 @@ bool Sema::DiagnoseAssignmentResult(AssignConvertType ConvTy,
|
||||
|
||||
switch (ConvTy) {
|
||||
case Compatible:
|
||||
// See if a proper null pointer constant is to be assigned.
|
||||
if (DstType->isAnyPointerType() && !SrcType->isAnyPointerType() &&
|
||||
SrcExpr->isNullPointerConstant(Context,
|
||||
Expr::NPC_NeverValueDependent) ==
|
||||
Expr::NPCK_ZeroExpression &&
|
||||
!isUnevaluatedContext())
|
||||
Diag(SrcExpr->getExprLoc(), diag::warn_non_literal_null_pointer)
|
||||
<< DstType << SrcExpr->getSourceRange();
|
||||
|
||||
DiagnoseAssignmentEnum(DstType, SrcType, SrcExpr);
|
||||
return false;
|
||||
DiagnoseAssignmentEnum(DstType, SrcType, SrcExpr);
|
||||
return false;
|
||||
|
||||
case PointerToInt:
|
||||
DiagKind = diag::ext_typecheck_convert_pointer_int;
|
||||
|
||||
@@ -2990,13 +2990,12 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state,
|
||||
}
|
||||
}
|
||||
|
||||
if (LangOpts.CPlusPlus && D.getDeclSpec().isTypeSpecOwned()) {
|
||||
if (LangOpts.CPlusPlus && D.getDeclSpec().hasTagDefinition()) {
|
||||
// C++ [dcl.fct]p6:
|
||||
// Types shall not be defined in return or parameter types.
|
||||
TagDecl *Tag = cast<TagDecl>(D.getDeclSpec().getRepAsDecl());
|
||||
if (Tag->isCompleteDefinition())
|
||||
S.Diag(Tag->getLocation(), diag::err_type_defined_in_result_type)
|
||||
<< Context.getTypeDeclType(Tag);
|
||||
S.Diag(Tag->getLocation(), diag::err_type_defined_in_result_type)
|
||||
<< Context.getTypeDeclType(Tag);
|
||||
}
|
||||
|
||||
// Exception specs are not allowed in typedefs. Complain, but add it
|
||||
|
||||
216
clang/test/Layout/ms-x86-empty-base-after-base-with-vbptr.cpp
Normal file
216
clang/test/Layout/ms-x86-empty-base-after-base-with-vbptr.cpp
Normal file
@@ -0,0 +1,216 @@
|
||||
// RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple i686-pc-win32 -fdump-record-layouts -cxx-abi microsoft %s 2>/dev/null \
|
||||
// RUN: | FileCheck %s
|
||||
// RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple x86_64-pc-win32 -fdump-record-layouts -cxx-abi microsoft %s 2>/dev/null \
|
||||
// RUN: | FileCheck %s -check-prefix CHECK-X64
|
||||
|
||||
|
||||
struct U { char a; };
|
||||
struct V { };
|
||||
struct W { };
|
||||
struct X : virtual V { char a; };
|
||||
struct Y : virtual V { char a; };
|
||||
struct Z : Y { };
|
||||
|
||||
struct A : X, W { char a; };
|
||||
|
||||
// CHECK: *** Dumping AST Record Layout
|
||||
// CHECK: 0 | struct A
|
||||
// CHECK: 0 | struct X (base)
|
||||
// CHECK: 0 | (X vbtable pointer)
|
||||
// CHECK: 4 | char a
|
||||
// CHECK: 9 | struct W (base) (empty)
|
||||
// CHECK: 9 | char a
|
||||
// CHECK: 12 | struct V (virtual base) (empty)
|
||||
// CHECK: | [sizeof=12, align=4
|
||||
// CHECK: | nvsize=12, nvalign=4]
|
||||
// CHECK-X64: *** Dumping AST Record Layout
|
||||
// CHECK-X64: 0 | struct A
|
||||
// CHECK-X64: 0 | struct X (base)
|
||||
// CHECK-X64: 0 | (X vbtable pointer)
|
||||
// CHECK-X64: 8 | char a
|
||||
// CHECK-X64: 17 | struct W (base) (empty)
|
||||
// CHECK-X64: 17 | char a
|
||||
// CHECK-X64: 24 | struct V (virtual base) (empty)
|
||||
// CHECK-X64: | [sizeof=24, align=8
|
||||
// CHECK-X64: | nvsize=24, nvalign=8]
|
||||
|
||||
struct B : X, U, W { char a; };
|
||||
|
||||
// CHECK: *** Dumping AST Record Layout
|
||||
// CHECK: 0 | struct B
|
||||
// CHECK: 0 | struct X (base)
|
||||
// CHECK: 0 | (X vbtable pointer)
|
||||
// CHECK: 4 | char a
|
||||
// CHECK: 8 | struct U (base)
|
||||
// CHECK: 8 | char a
|
||||
// CHECK: 9 | struct W (base) (empty)
|
||||
// CHECK: 9 | char a
|
||||
// CHECK: 12 | struct V (virtual base) (empty)
|
||||
// CHECK: | [sizeof=12, align=4
|
||||
// CHECK: | nvsize=12, nvalign=4]
|
||||
// CHECK-X64: *** Dumping AST Record Layout
|
||||
// CHECK-X64: 0 | struct B
|
||||
// CHECK-X64: 0 | struct X (base)
|
||||
// CHECK-X64: 0 | (X vbtable pointer)
|
||||
// CHECK-X64: 8 | char a
|
||||
// CHECK-X64: 16 | struct U (base)
|
||||
// CHECK-X64: 16 | char a
|
||||
// CHECK-X64: 17 | struct W (base) (empty)
|
||||
// CHECK-X64: 17 | char a
|
||||
// CHECK-X64: 24 | struct V (virtual base) (empty)
|
||||
// CHECK-X64: | [sizeof=24, align=8
|
||||
// CHECK-X64: | nvsize=24, nvalign=8]
|
||||
|
||||
struct C : X, V, W { char a; };
|
||||
|
||||
// CHECK: *** Dumping AST Record Layout
|
||||
// CHECK: 0 | struct C
|
||||
// CHECK: 0 | struct X (base)
|
||||
// CHECK: 0 | (X vbtable pointer)
|
||||
// CHECK: 4 | char a
|
||||
// CHECK: 9 | struct V (base) (empty)
|
||||
// CHECK: 10 | struct W (base) (empty)
|
||||
// CHECK: 10 | char a
|
||||
// CHECK: 12 | struct V (virtual base) (empty)
|
||||
// CHECK: | [sizeof=12, align=4
|
||||
// CHECK: | nvsize=12, nvalign=4]
|
||||
// CHECK-X64: *** Dumping AST Record Layout
|
||||
// CHECK-X64: 0 | struct C
|
||||
// CHECK-X64: 0 | struct X (base)
|
||||
// CHECK-X64: 0 | (X vbtable pointer)
|
||||
// CHECK-X64: 8 | char a
|
||||
// CHECK-X64: 17 | struct V (base) (empty)
|
||||
// CHECK-X64: 18 | struct W (base) (empty)
|
||||
// CHECK-X64: 18 | char a
|
||||
// CHECK-X64: 24 | struct V (virtual base) (empty)
|
||||
// CHECK-X64: | [sizeof=24, align=8
|
||||
// CHECK-X64: | nvsize=24, nvalign=8]
|
||||
|
||||
struct D : X, U, V, W { char a; };
|
||||
|
||||
// CHECK: *** Dumping AST Record Layout
|
||||
// CHECK: 0 | struct D
|
||||
// CHECK: 0 | struct X (base)
|
||||
// CHECK: 0 | (X vbtable pointer)
|
||||
// CHECK: 4 | char a
|
||||
// CHECK: 8 | struct U (base)
|
||||
// CHECK: 8 | char a
|
||||
// CHECK: 9 | struct V (base) (empty)
|
||||
// CHECK: 10 | struct W (base) (empty)
|
||||
// CHECK: 10 | char a
|
||||
// CHECK: 12 | struct V (virtual base) (empty)
|
||||
// CHECK: | [sizeof=12, align=4
|
||||
// CHECK: | nvsize=12, nvalign=4]
|
||||
// CHECK-X64: *** Dumping AST Record Layout
|
||||
// CHECK-X64: 0 | struct D
|
||||
// CHECK-X64: 0 | struct X (base)
|
||||
// CHECK-X64: 0 | (X vbtable pointer)
|
||||
// CHECK-X64: 8 | char a
|
||||
// CHECK-X64: 16 | struct U (base)
|
||||
// CHECK-X64: 16 | char a
|
||||
// CHECK-X64: 17 | struct V (base) (empty)
|
||||
// CHECK-X64: 18 | struct W (base) (empty)
|
||||
// CHECK-X64: 18 | char a
|
||||
// CHECK-X64: 24 | struct V (virtual base) (empty)
|
||||
// CHECK-X64: | [sizeof=24, align=8
|
||||
// CHECK-X64: | nvsize=24, nvalign=8]
|
||||
|
||||
struct E : X, U, Y, V, W { char a; };
|
||||
|
||||
// CHECK: *** Dumping AST Record Layout
|
||||
// CHECK: 0 | struct E
|
||||
// CHECK: 0 | struct X (base)
|
||||
// CHECK: 0 | (X vbtable pointer)
|
||||
// CHECK: 4 | char a
|
||||
// CHECK: 8 | struct U (base)
|
||||
// CHECK: 8 | char a
|
||||
// CHECK: 12 | struct Y (base)
|
||||
// CHECK: 12 | (Y vbtable pointer)
|
||||
// CHECK: 16 | char a
|
||||
// CHECK: 21 | struct V (base) (empty)
|
||||
// CHECK: 22 | struct W (base) (empty)
|
||||
// CHECK: 22 | char a
|
||||
// CHECK: 24 | struct V (virtual base) (empty)
|
||||
// CHECK: | [sizeof=24, align=4
|
||||
// CHECK: | nvsize=24, nvalign=4]
|
||||
// CHECK-X64: *** Dumping AST Record Layout
|
||||
// CHECK-X64: 0 | struct E
|
||||
// CHECK-X64: 0 | struct X (base)
|
||||
// CHECK-X64: 0 | (X vbtable pointer)
|
||||
// CHECK-X64: 8 | char a
|
||||
// CHECK-X64: 16 | struct U (base)
|
||||
// CHECK-X64: 16 | char a
|
||||
// CHECK-X64: 24 | struct Y (base)
|
||||
// CHECK-X64: 24 | (Y vbtable pointer)
|
||||
// CHECK-X64: 32 | char a
|
||||
// CHECK-X64: 41 | struct V (base) (empty)
|
||||
// CHECK-X64: 42 | struct W (base) (empty)
|
||||
// CHECK-X64: 42 | char a
|
||||
// CHECK-X64: 48 | struct V (virtual base) (empty)
|
||||
// CHECK-X64: | [sizeof=48, align=8
|
||||
// CHECK-X64: | nvsize=48, nvalign=8]
|
||||
|
||||
struct F : Z, W { char a; };
|
||||
|
||||
// CHECK: *** Dumping AST Record Layout
|
||||
// CHECK: 0 | struct F
|
||||
// CHECK: 0 | struct Z (base)
|
||||
// CHECK: 0 | struct Y (base)
|
||||
// CHECK: 0 | (Y vbtable pointer)
|
||||
// CHECK: 4 | char a
|
||||
// CHECK: 9 | struct W (base) (empty)
|
||||
// CHECK: 9 | char a
|
||||
// CHECK: 12 | struct V (virtual base) (empty)
|
||||
// CHECK: | [sizeof=12, align=4
|
||||
// CHECK: | nvsize=12, nvalign=4]
|
||||
// CHECK-X64: *** Dumping AST Record Layout
|
||||
// CHECK-X64: 0 | struct F
|
||||
// CHECK-X64: 0 | struct Z (base)
|
||||
// CHECK-X64: 0 | struct Y (base)
|
||||
// CHECK-X64: 0 | (Y vbtable pointer)
|
||||
// CHECK-X64: 8 | char a
|
||||
// CHECK-X64: 17 | struct W (base) (empty)
|
||||
// CHECK-X64: 17 | char a
|
||||
// CHECK-X64: 24 | struct V (virtual base) (empty)
|
||||
// CHECK-X64: | [sizeof=24, align=8
|
||||
// CHECK-X64: | nvsize=24, nvalign=8]
|
||||
|
||||
struct G : X, W, Y, V { char a; };
|
||||
|
||||
// CHECK: *** Dumping AST Record Layout
|
||||
// CHECK: 0 | struct G
|
||||
// CHECK: 0 | struct X (base)
|
||||
// CHECK: 0 | (X vbtable pointer)
|
||||
// CHECK: 4 | char a
|
||||
// CHECK: 9 | struct W (base) (empty)
|
||||
// CHECK: 12 | struct Y (base)
|
||||
// CHECK: 12 | (Y vbtable pointer)
|
||||
// CHECK: 16 | char a
|
||||
// CHECK: 21 | struct V (base) (empty)
|
||||
// CHECK: 21 | char a
|
||||
// CHECK: 24 | struct V (virtual base) (empty)
|
||||
// CHECK: | [sizeof=24, align=4
|
||||
// CHECK: | nvsize=24, nvalign=4]
|
||||
// CHECK-X64: *** Dumping AST Record Layout
|
||||
// CHECK-X64: 0 | struct G
|
||||
// CHECK-X64: 0 | struct X (base)
|
||||
// CHECK-X64: 0 | (X vbtable pointer)
|
||||
// CHECK-X64: 8 | char a
|
||||
// CHECK-X64: 17 | struct W (base) (empty)
|
||||
// CHECK-X64: 24 | struct Y (base)
|
||||
// CHECK-X64: 24 | (Y vbtable pointer)
|
||||
// CHECK-X64: 32 | char a
|
||||
// CHECK-X64: 41 | struct V (base) (empty)
|
||||
// CHECK-X64: 41 | char a
|
||||
// CHECK-X64: 48 | struct V (virtual base) (empty)
|
||||
// CHECK-X64: | [sizeof=48, align=8
|
||||
// CHECK-X64: | nvsize=48, nvalign=8]
|
||||
|
||||
int a[
|
||||
sizeof(A)+
|
||||
sizeof(B)+
|
||||
sizeof(C)+
|
||||
sizeof(D)+
|
||||
sizeof(E)+
|
||||
sizeof(F)+
|
||||
sizeof(G)];
|
||||
@@ -108,9 +108,9 @@ template<class T>
|
||||
class Class1;
|
||||
|
||||
class Class2 {
|
||||
} // no ;
|
||||
} // expected-error {{expected ';' after class}}
|
||||
|
||||
typedef Class1<Class2> Type1; // expected-error {{cannot combine with previous 'class' declaration specifier}}
|
||||
typedef Class1<Class2> Type1;
|
||||
|
||||
// rdar : // 8307865
|
||||
struct CodeCompleteConsumer {
|
||||
|
||||
@@ -66,3 +66,56 @@ struct Redefined { // expected-note {{previous}}
|
||||
struct Redefined { // expected-error {{redefinition}}
|
||||
Redefined() {}
|
||||
};
|
||||
|
||||
struct MissingSemi5;
|
||||
namespace N {
|
||||
typedef int afterMissingSemi4;
|
||||
extern MissingSemi5 afterMissingSemi5;
|
||||
}
|
||||
|
||||
struct MissingSemi1 {} // expected-error {{expected ';' after struct}}
|
||||
static int afterMissingSemi1();
|
||||
|
||||
class MissingSemi2 {} // expected-error {{expected ';' after class}}
|
||||
MissingSemi1 *afterMissingSemi2;
|
||||
|
||||
enum MissingSemi3 {} // expected-error {{expected ';' after enum}}
|
||||
::MissingSemi1 afterMissingSemi3;
|
||||
|
||||
extern N::afterMissingSemi4 afterMissingSemi4b;
|
||||
union MissingSemi4 { MissingSemi4(int); } // expected-error {{expected ';' after union}}
|
||||
N::afterMissingSemi4 (afterMissingSemi4b);
|
||||
|
||||
int afterMissingSemi5b;
|
||||
struct MissingSemi5 { MissingSemi5(int); } // ok, no missing ';' here
|
||||
N::afterMissingSemi5 (afterMissingSemi5b);
|
||||
|
||||
template<typename T> struct MissingSemiT {
|
||||
} // expected-error {{expected ';' after struct}}
|
||||
MissingSemiT<int> msi;
|
||||
|
||||
struct MissingSemiInStruct {
|
||||
struct Inner1 {} // expected-error {{expected ';' after struct}}
|
||||
static MissingSemi5 ms1;
|
||||
|
||||
struct Inner2 {} // ok, no missing ';' here
|
||||
static MissingSemi1;
|
||||
|
||||
struct Inner3 {} // expected-error {{expected ';' after struct}}
|
||||
static MissingSemi5 *p;
|
||||
};
|
||||
|
||||
void MissingSemiInFunction() {
|
||||
struct Inner1 {} // expected-error {{expected ';' after struct}}
|
||||
if (true) {}
|
||||
|
||||
// FIXME: It would be nice to at least warn on this.
|
||||
struct Inner2 { Inner2(int); } // ok, no missing ';' here
|
||||
k = l;
|
||||
|
||||
struct Inner3 {} // expected-error {{expected ';' after struct}}
|
||||
Inner1 i1;
|
||||
|
||||
struct Inner4 {} // ok, no missing ';' here
|
||||
Inner5;
|
||||
}
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
// RUN: %clang_cc1 %s -verify -fsyntax-only
|
||||
|
||||
// PR10837: warn if a non-pointer-typed expression is folded to a null pointer
|
||||
int *p = 0;
|
||||
int *q = '\0'; // expected-warning{{expression which evaluates to zero treated as a null pointer constant}}
|
||||
int *r = (1 - 1); // expected-warning{{expression which evaluates to zero treated as a null pointer constant}}
|
||||
@@ -7,28 +7,28 @@ typedef struct __attribute__((objc_bridge(12))) __CFMyColor *CFMyColorRef; // e
|
||||
|
||||
typedef struct __attribute__ ((objc_bridge)) __CFArray *CFArrayRef; // expected-error {{parameter of 'objc_bridge' attribute must be a single name of an Objective-C class}}
|
||||
|
||||
typedef void * __attribute__ ((objc_bridge(NSURL))) CFURLRef; // expected-error {{'objc_bridge' attribute must be applied to a struct or union}}
|
||||
typedef void * __attribute__ ((objc_bridge(NSURL))) CFURLRef; // expected-error {{'objc_bridge' attribute only applies to struct or union}}
|
||||
|
||||
typedef void * CFStringRef __attribute__ ((objc_bridge(NSString))); // expected-error {{'objc_bridge' attribute must be applied to a struct or union}}
|
||||
typedef void * CFStringRef __attribute__ ((objc_bridge(NSString))); // expected-error {{'objc_bridge' attribute only applies to struct or union}}
|
||||
|
||||
typedef struct __attribute__((objc_bridge(NSLocale, NSError))) __CFLocale *CFLocaleRef;// expected-error {{use of undeclared identifier 'NSError'}}
|
||||
|
||||
typedef struct __CFData __attribute__((objc_bridge(NSData))) CFDataRef; // expected-error {{'objc_bridge' attribute must be applied to a struct or union}}
|
||||
typedef struct __CFData __attribute__((objc_bridge(NSData))) CFDataRef; // expected-error {{'objc_bridge' attribute only applies to struct or union}}
|
||||
|
||||
typedef struct __attribute__((objc_bridge(NSDictionary))) __CFDictionary * CFDictionaryRef;
|
||||
|
||||
typedef struct __CFSetRef * CFSetRef __attribute__((objc_bridge(NSSet))); // expected-error {{'objc_bridge' attribute must be applied to a struct or union}};
|
||||
typedef struct __CFSetRef * CFSetRef __attribute__((objc_bridge(NSSet))); // expected-error {{'objc_bridge' attribute only applies to struct or union}};
|
||||
|
||||
typedef union __CFUColor __attribute__((objc_bridge(NSUColor))) * CFUColorRef; // expected-error {{'objc_bridge' attribute must be applied to a struct or union}};
|
||||
typedef union __CFUColor __attribute__((objc_bridge(NSUColor))) * CFUColorRef; // expected-error {{'objc_bridge' attribute only applies to struct or union}};
|
||||
|
||||
typedef union __CFUColor __attribute__((objc_bridge(NSUColor))) *CFUColor1Ref; // expected-error {{'objc_bridge' attribute must be applied to a struct or union}};
|
||||
typedef union __CFUColor __attribute__((objc_bridge(NSUColor))) *CFUColor1Ref; // expected-error {{'objc_bridge' attribute only applies to struct or union}};
|
||||
|
||||
typedef union __attribute__((objc_bridge(NSUColor))) __CFUPrimeColor XXX;
|
||||
typedef XXX *CFUColor2Ref;
|
||||
|
||||
@interface I
|
||||
{
|
||||
__attribute__((objc_bridge(NSError))) void * color; // expected-error {{'objc_bridge' attribute must be applied to a struct or union}};
|
||||
__attribute__((objc_bridge(NSError))) void * color; // expected-error {{'objc_bridge' attribute only applies to struct or union}};
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
-*- rst -*-
|
||||
This is a collection of tests to check debugging information generated by
|
||||
compiler. This test suite can be checked out inside clang/test folder. This
|
||||
will enable 'make test' for clang to pick up these tests. Typically, test
|
||||
cases included here includes debugger commands and intended debugger output
|
||||
as comments in source file using DEBUGGER: and CHECK: as prefixes respectively.
|
||||
|
||||
For example::
|
||||
|
||||
define i32 @f1(i32 %i) nounwind ssp {
|
||||
; DEBUGGER: break f1
|
||||
; DEBUGGER: r
|
||||
; DEBUGGER: p i
|
||||
; CHECK: $1 = 42
|
||||
entry:
|
||||
}
|
||||
|
||||
is a testcase where the debugger is asked to break at function 'f1' and
|
||||
print value of argument 'i'. The expected value of 'i' is 42 in this case.
|
||||
@@ -1,32 +0,0 @@
|
||||
// RUN: %clangxx -O0 -g %s -c -o %t.o
|
||||
// RUN: %clangxx %t.o -o %t.out
|
||||
// RUN: %test_debuginfo %s %t.out
|
||||
// Radar 8945514
|
||||
// DEBUGGER: break 22
|
||||
// DEBUGGER: r
|
||||
// DEBUGGER: p v
|
||||
// CHECK: ${{[0-9]+}} = {
|
||||
// CHECK: Data = 0x0{{(0*)}}
|
||||
// CHECK: Kind = 2142
|
||||
|
||||
class SVal {
|
||||
public:
|
||||
~SVal() {}
|
||||
const void* Data;
|
||||
unsigned Kind;
|
||||
};
|
||||
|
||||
void bar(SVal &v) {}
|
||||
class A {
|
||||
public:
|
||||
void foo(SVal v) { bar(v); }
|
||||
};
|
||||
|
||||
int main() {
|
||||
SVal v;
|
||||
v.Data = 0;
|
||||
v.Kind = 2142;
|
||||
A a;
|
||||
a.foo(v);
|
||||
return 0;
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
// RUN: %clang -O0 -g %s -c -o %t.o
|
||||
// RUN: %clang %t.o -o %t.out -framework Foundation
|
||||
// RUN: %test_debuginfo %s %t.out
|
||||
|
||||
// REQUIRES: system-darwin
|
||||
|
||||
// DEBUGGER: break 24
|
||||
// DEBUGGER: r
|
||||
// DEBUGGER: p result
|
||||
// CHECK: $1 = 42
|
||||
|
||||
void doBlock(void (^block)(void))
|
||||
{
|
||||
block();
|
||||
}
|
||||
|
||||
int I(int n)
|
||||
{
|
||||
__block int result;
|
||||
int i = 2;
|
||||
doBlock(^{
|
||||
result = n;
|
||||
});
|
||||
return result + i; /* Check value of 'result' */
|
||||
}
|
||||
|
||||
|
||||
int main (int argc, const char * argv[]) {
|
||||
return I(42);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
// RUN: %clang -O0 -g %s -c -o %t.o
|
||||
// RUN: %clang %t.o -o %t.out -framework Foundation
|
||||
// RUN: %test_debuginfo %s %t.out
|
||||
|
||||
// REQUIRES: system-darwin
|
||||
// Radar 9279956
|
||||
|
||||
// DEBUGGER: break 31
|
||||
// DEBUGGER: r
|
||||
// DEBUGGER: p m2
|
||||
// DEBUGGER: p dbTransaction
|
||||
// DEBUGGER: p master
|
||||
// CHECK: $1 = 1
|
||||
// CHECK: $2 = 0
|
||||
// CHECK: $3 = 0
|
||||
|
||||
#include <Cocoa/Cocoa.h>
|
||||
|
||||
extern void foo(void(^)(void));
|
||||
|
||||
@interface A:NSObject @end
|
||||
@implementation A
|
||||
- (void) helper {
|
||||
int master = 0;
|
||||
__block int m2 = 0;
|
||||
__block int dbTransaction = 0;
|
||||
int (^x)(void) = ^(void) { (void) self;
|
||||
(void) master;
|
||||
(void) dbTransaction;
|
||||
m2++;
|
||||
return m2;
|
||||
};
|
||||
master = x();
|
||||
}
|
||||
@end
|
||||
|
||||
void foo(void(^x)(void)) {}
|
||||
|
||||
int main() {
|
||||
A *a = [A alloc];
|
||||
[a helper];
|
||||
return 0;
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
// RUN: %clangxx -O0 -g %s -c -o %t.o
|
||||
// RUN: %clangxx %t.o -o %t.out
|
||||
// RUN: %test_debuginfo %s %t.out
|
||||
|
||||
|
||||
// DEBUGGER: break 14
|
||||
// DEBUGGER: r
|
||||
// DEBUGGER: p *this
|
||||
// CHECK-NEXT-NOT: Cannot access memory at address
|
||||
|
||||
class A {
|
||||
public:
|
||||
A() : zero(0), data(42)
|
||||
{
|
||||
}
|
||||
private:
|
||||
int zero;
|
||||
int data;
|
||||
};
|
||||
|
||||
int main() {
|
||||
A a;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
// This test case checks debug info during register moves for an argument.
|
||||
// RUN: %clang -arch x86_64 -mllvm -fast-isel=false %s -c -o %t.o
|
||||
// RUN: %clang -arch x86_64 %t.o -o %t.out
|
||||
// RUN: %test_debuginfo %s %t.out
|
||||
//
|
||||
// Radar 8412415
|
||||
|
||||
struct _mtx
|
||||
{
|
||||
long unsigned int ptr;
|
||||
int waiters;
|
||||
struct {
|
||||
int tag;
|
||||
int pad;
|
||||
} mtxi;
|
||||
};
|
||||
|
||||
|
||||
int foobar(struct _mtx *mutex) {
|
||||
int r = 1;
|
||||
int l = 0;
|
||||
int j = 0;
|
||||
do {
|
||||
if (mutex->waiters) {
|
||||
r = 2;
|
||||
}
|
||||
j = bar(r, l);
|
||||
++l;
|
||||
} while (l < j);
|
||||
return r + j;
|
||||
}
|
||||
|
||||
int bar(int i, int j) {
|
||||
return i + j;
|
||||
}
|
||||
|
||||
int main() {
|
||||
struct _mtx m;
|
||||
m.waiters = 0;
|
||||
return foobar(&m);
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
// RUN: %clang -O0 -g %s -c -o %t.o
|
||||
// RUN: %clang %t.o -o %t.out -framework Foundation
|
||||
// RUN: %test_debuginfo %s %t.out
|
||||
//
|
||||
// REQUIRES: system-darwin
|
||||
// Radar 8757124
|
||||
|
||||
// DEBUGGER: break 25
|
||||
// DEBUGGER: r
|
||||
// DEBUGGER: po thing
|
||||
// CHECK: aaa
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
int main (int argc, const char * argv[]) {
|
||||
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
NSArray *things = [NSArray arrayWithObjects:@"one", @"two", @"three" , nil];
|
||||
for (NSString *thing in things) {
|
||||
NSLog (@"%@", thing);
|
||||
}
|
||||
|
||||
things = [NSArray arrayWithObjects:@"aaa", @"bbb", @"ccc" , nil];
|
||||
for (NSString *thing in things) {
|
||||
NSLog (@"%@", thing);
|
||||
}
|
||||
[pool release];
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
// RUN: %clangxx -O0 -g %s -c -o %t.o
|
||||
// RUN: %test_debuginfo %s %t.o
|
||||
// Radar 9168773
|
||||
|
||||
// DEBUGGER: ptype A
|
||||
// Work around a gdb bug where it believes that a class is a
|
||||
// struct if there aren't any methods - even though it's tagged
|
||||
// as a class.
|
||||
// CHECK: type = {{struct|class}} A {
|
||||
// CHECK-NEXT: {{(public:){0,1}}}
|
||||
// CHECK-NEXT: int MyData;
|
||||
// CHECK-NEXT: }
|
||||
class A;
|
||||
class B {
|
||||
public:
|
||||
void foo(const A *p);
|
||||
};
|
||||
|
||||
B iEntry;
|
||||
|
||||
class A {
|
||||
public:
|
||||
int MyData;
|
||||
};
|
||||
|
||||
A irp;
|
||||
|
||||
@@ -1,145 +0,0 @@
|
||||
#!/bin/env python
|
||||
"""
|
||||
A gdb-compatible frontend for lldb that implements just enough
|
||||
commands to run the tests in the debuginfo-tests repository with lldb.
|
||||
"""
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Auto-detect lldb python module.
|
||||
import commands, platform, os, sys
|
||||
try:
|
||||
# Just try for LLDB in case PYTHONPATH is already correctly setup.
|
||||
import lldb
|
||||
except ImportError:
|
||||
lldb_python_dirs = list()
|
||||
# lldb is not in the PYTHONPATH, try some defaults for the current platform.
|
||||
platform_system = platform.system()
|
||||
if platform_system == 'Darwin':
|
||||
# On Darwin, try the currently selected Xcode directory
|
||||
xcode_dir = commands.getoutput("xcode-select --print-path")
|
||||
if xcode_dir:
|
||||
lldb_python_dirs.append(os.path.realpath(xcode_dir +
|
||||
'/../SharedFrameworks/LLDB.framework/Resources/Python'))
|
||||
lldb_python_dirs.append(xcode_dir +
|
||||
'/Library/PrivateFrameworks/LLDB.framework/Resources/Python')
|
||||
lldb_python_dirs.append(
|
||||
'/System/Library/PrivateFrameworks/LLDB.framework/Resources/Python')
|
||||
success = False
|
||||
for lldb_python_dir in lldb_python_dirs:
|
||||
if os.path.exists(lldb_python_dir):
|
||||
if not (sys.path.__contains__(lldb_python_dir)):
|
||||
sys.path.append(lldb_python_dir)
|
||||
try:
|
||||
import lldb
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
print 'imported lldb from: "%s"' % (lldb_python_dir)
|
||||
success = True
|
||||
break
|
||||
if not success:
|
||||
print "error: couldn't locate the 'lldb' module, please set PYTHONPATH correctly"
|
||||
sys.exit(1)
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
# Command line option handling.
|
||||
import argparse
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('--quiet', '-q', action="store_true", help='ignored')
|
||||
parser.add_argument('-batch', action="store_true",
|
||||
help='exit after processing comand line')
|
||||
parser.add_argument('-n', action="store_true", help='ignore .lldb file')
|
||||
parser.add_argument('-x', dest='script', type=file, help='execute commands from file')
|
||||
parser.add_argument("target", help="the program to debug")
|
||||
args = parser.parse_args()
|
||||
|
||||
|
||||
# Create a new debugger instance.
|
||||
debugger = lldb.SBDebugger.Create()
|
||||
debugger.SkipLLDBInitFiles(args.n)
|
||||
|
||||
# Don't return from lldb function calls until the process stops.
|
||||
debugger.SetAsync(False)
|
||||
|
||||
# Create a target from a file and arch.
|
||||
arch = os.popen("file "+args.target).read().split()[-1]
|
||||
target = debugger.CreateTargetWithFileAndArch(args.target, arch)
|
||||
|
||||
if not target:
|
||||
print "Could not create target", args.target
|
||||
sys.exit(1)
|
||||
|
||||
if not args.script:
|
||||
print "Interactive mode is not implemented."
|
||||
sys.exit(1)
|
||||
|
||||
import re
|
||||
for command in args.script:
|
||||
# Strip newline and whitespaces and split into words.
|
||||
cmd = command[:-1].strip().split()
|
||||
if not cmd:
|
||||
continue
|
||||
|
||||
print '> %s'% command[:-1]
|
||||
|
||||
try:
|
||||
if re.match('^r|(run)$', cmd[0]):
|
||||
error = lldb.SBError()
|
||||
launchinfo = lldb.SBLaunchInfo([])
|
||||
launchinfo.SetWorkingDirectory(os.getcwd())
|
||||
process = target.Launch(launchinfo, error)
|
||||
print error
|
||||
if not process or error.fail:
|
||||
state = process.GetState()
|
||||
print "State = %d" % state
|
||||
print """
|
||||
ERROR: Could not launch process.
|
||||
NOTE: There are several resons why this may happen:
|
||||
* Root needs to run "DevToolsSecurity --enable".
|
||||
* We launched ("run") more than one process simultaneously.
|
||||
(cf. rdar://problem/14929651)
|
||||
"""
|
||||
sys.exit(1)
|
||||
|
||||
elif re.match('^b|(break)$', cmd[0]) and len(cmd) == 2:
|
||||
if re.match('[0-9]+', cmd[1]):
|
||||
# b line
|
||||
mainfile = target.FindFunctions('main')[0].compile_unit.file
|
||||
print target.BreakpointCreateByLocation(mainfile, int(cmd[1]))
|
||||
else:
|
||||
# b file:line
|
||||
file, line = cmd[1].split(':')
|
||||
print target.BreakpointCreateByLocation(file, int(line))
|
||||
|
||||
elif re.match('^ptype$', cmd[0]) and len(cmd) == 2:
|
||||
# GDB's ptype has multiple incarnations depending on its
|
||||
# argument (global variable, function, type). The definition
|
||||
# here is for looking up the signature of a function and only
|
||||
# if that fails it looks for a type with that name.
|
||||
# Type lookup in LLDB would be "image lookup --type".
|
||||
for elem in target.FindFunctions(cmd[1]):
|
||||
print elem.function.type
|
||||
continue
|
||||
print target.FindFirstType(cmd[1])
|
||||
|
||||
elif re.match('^po$', cmd[0]) and len(cmd) > 1:
|
||||
opts = lldb.SBExpressionOptions()
|
||||
opts.SetFetchDynamicValue(True)
|
||||
opts.SetCoerceResultToId(True)
|
||||
print target.EvaluateExpression(' '.join(cmd[1:]), opts)
|
||||
|
||||
elif re.match('^p|(print)$', cmd[0]) and len(cmd) > 1:
|
||||
thread = process.GetThreadAtIndex(0)
|
||||
frame = thread.GetFrameAtIndex(0)
|
||||
print frame.EvaluateExpression(' '.join(cmd[1:]))
|
||||
|
||||
elif re.match('^q|(quit)$', cmd[0]):
|
||||
sys.exit(0)
|
||||
|
||||
else:
|
||||
print debugger.HandleCommand(' '.join(cmd))
|
||||
|
||||
except SystemExit, e: raise e
|
||||
except:
|
||||
print 'Could not handle the command "%s"' % ' '.join(cmd)
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
// RUN: %clangxx -O0 -g %s -c -o %t.o
|
||||
// RUN: %test_debuginfo %s %t.o
|
||||
// Radar 9440721
|
||||
// If debug info for my_number() is emitted outside function foo's scope
|
||||
// then a debugger may not be able to handle it. At least one version of
|
||||
// gdb crashes in such cases.
|
||||
|
||||
// DEBUGGER: ptype foo
|
||||
// CHECK: int (void)
|
||||
|
||||
int foo() {
|
||||
struct Local {
|
||||
static int my_number() {
|
||||
return 42;
|
||||
}
|
||||
};
|
||||
|
||||
int i = 0;
|
||||
i = Local::my_number();
|
||||
return i + 1;
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
// RUN: %clangxx -O0 -g %s -c -o %t.o
|
||||
// RUN: %clangxx %t.o -o %t.out
|
||||
// RUN: %test_debuginfo %s %t.out
|
||||
// Radar 8775834
|
||||
// DEBUGGER: break 62
|
||||
// DEBUGGER: r
|
||||
// DEBUGGER: p a
|
||||
// CHECK: ${{[0-9]+}} = {
|
||||
// LLDB does not print artificial members.
|
||||
// CHECK: {{(_vptr\$A =)?.*}}m_int = 12
|
||||
|
||||
class A
|
||||
{
|
||||
public:
|
||||
A (int i=0);
|
||||
A (const A& rhs);
|
||||
const A&
|
||||
operator= (const A& rhs);
|
||||
virtual ~A() {}
|
||||
|
||||
int get_int();
|
||||
|
||||
protected:
|
||||
int m_int;
|
||||
};
|
||||
|
||||
A::A (int i) :
|
||||
m_int(i)
|
||||
{
|
||||
}
|
||||
|
||||
A::A (const A& rhs) :
|
||||
m_int (rhs.m_int)
|
||||
{
|
||||
}
|
||||
|
||||
const A &
|
||||
A::operator =(const A& rhs)
|
||||
{
|
||||
m_int = rhs.m_int;
|
||||
return *this;
|
||||
}
|
||||
|
||||
int A::get_int()
|
||||
{
|
||||
return m_int;
|
||||
}
|
||||
|
||||
class B
|
||||
{
|
||||
public:
|
||||
B () {}
|
||||
|
||||
A AInstance();
|
||||
};
|
||||
|
||||
A
|
||||
B::AInstance()
|
||||
{
|
||||
A a(12);
|
||||
return a;
|
||||
}
|
||||
|
||||
int main (int argc, char const *argv[])
|
||||
{
|
||||
B b;
|
||||
int return_val = b.AInstance().get_int();
|
||||
|
||||
A a(b.AInstance());
|
||||
return return_val;
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
// RUN: %clangxx -O0 -g %s -o %t -c
|
||||
// RUN: %clangxx %t -o %t.out
|
||||
// RUN: %test_debuginfo %s %t.out
|
||||
// XFAIL: darwin
|
||||
|
||||
// DEBUGGER: delete breakpoints
|
||||
// DEBUGGER: break static-member.cpp:33
|
||||
// DEBUGGER: r
|
||||
// DEBUGGER: ptype C
|
||||
// CHECK: {{struct|class}} C {
|
||||
// CHECK: static const int a;
|
||||
// CHECK-NEXT: static int b;
|
||||
// CHECK-NEXT: static int c;
|
||||
// CHECK-NEXT: int d;
|
||||
// CHECK-NEXT: }
|
||||
// DEBUGGER: p C::a
|
||||
// CHECK: $1 = 4
|
||||
// DEBUGGER: p C::c
|
||||
// CHECK: $2 = 15
|
||||
|
||||
// PR14471, PR14734
|
||||
|
||||
class C {
|
||||
public:
|
||||
const static int a = 4;
|
||||
static int b;
|
||||
static int c;
|
||||
int d;
|
||||
};
|
||||
|
||||
int C::c = 15;
|
||||
const int C::a;
|
||||
|
||||
int main() {
|
||||
C instance_C;
|
||||
return C::a;
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
N: Peter Collingbourne
|
||||
E: peter@pcc.me.uk
|
||||
@@ -1,64 +0,0 @@
|
||||
==============================================================================
|
||||
libclc License
|
||||
==============================================================================
|
||||
|
||||
The libclc library is dual licensed under both the University of Illinois
|
||||
"BSD-Like" license and the MIT license. As a user of this code you may choose
|
||||
to use it under either license. As a contributor, you agree to allow your code
|
||||
to be used under both.
|
||||
|
||||
Full text of the relevant licenses is included below.
|
||||
|
||||
==============================================================================
|
||||
|
||||
Copyright (c) 2011-2013 by the contributors listed in CREDITS.TXT
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal with
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimers.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimers in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
* The names of the contributors may not be used to endorse or promote
|
||||
products derived from this Software without specific prior written
|
||||
permission.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
|
||||
SOFTWARE.
|
||||
|
||||
==============================================================================
|
||||
|
||||
Copyright (c) 2011-2013 by the contributors listed in CREDITS.TXT
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
@@ -1,37 +0,0 @@
|
||||
libclc
|
||||
------
|
||||
|
||||
libclc is an open source, BSD licensed implementation of the library
|
||||
requirements of the OpenCL C programming language, as specified by the
|
||||
OpenCL 1.1 Specification. The following sections of the specification
|
||||
impose library requirements:
|
||||
|
||||
* 6.1: Supported Data Types
|
||||
* 6.2.3: Explicit Conversions
|
||||
* 6.2.4.2: Reinterpreting Types Using as_type() and as_typen()
|
||||
* 6.9: Preprocessor Directives and Macros
|
||||
* 6.11: Built-in Functions
|
||||
* 9.3: Double Precision Floating-Point
|
||||
* 9.4: 64-bit Atomics
|
||||
* 9.5: Writing to 3D image memory objects
|
||||
* 9.6: Half Precision Floating-Point
|
||||
|
||||
libclc is intended to be used with the Clang compiler's OpenCL frontend.
|
||||
|
||||
libclc is designed to be portable and extensible. To this end, it provides
|
||||
generic implementations of most library requirements, allowing the target
|
||||
to override the generic implementation at the granularity of individual
|
||||
functions.
|
||||
|
||||
libclc currently only supports the PTX target, but support for more
|
||||
targets is welcome.
|
||||
|
||||
Compiling
|
||||
---------
|
||||
|
||||
./configure.py --with-llvm-config=/path/to/llvm-config && make
|
||||
|
||||
Website
|
||||
-------
|
||||
|
||||
http://www.pcc.me.uk/~peter/libclc/
|
||||
@@ -1,100 +0,0 @@
|
||||
import ninja_syntax
|
||||
import os
|
||||
|
||||
# Simple meta-build system.
|
||||
|
||||
class Make(object):
|
||||
def __init__(self):
|
||||
self.output = open(self.output_filename(), 'w')
|
||||
self.rules = {}
|
||||
self.rule_text = ''
|
||||
self.all_targets = []
|
||||
self.default_targets = []
|
||||
self.clean_files = []
|
||||
self.distclean_files = []
|
||||
self.output.write("""all::
|
||||
|
||||
ifndef VERBOSE
|
||||
Verb = @
|
||||
endif
|
||||
|
||||
""")
|
||||
|
||||
def output_filename(self):
|
||||
return 'Makefile'
|
||||
|
||||
def rule(self, name, command, description=None, depfile=None,
|
||||
generator=False):
|
||||
self.rules[name] = {'command': command, 'description': description,
|
||||
'depfile': depfile, 'generator': generator}
|
||||
|
||||
def build(self, output, rule, inputs=[], implicit=[], order_only=[]):
|
||||
inputs = self._as_list(inputs)
|
||||
implicit = self._as_list(implicit)
|
||||
order_only = self._as_list(order_only)
|
||||
|
||||
output_dir = os.path.dirname(output)
|
||||
if output_dir != '' and not os.path.isdir(output_dir):
|
||||
os.makedirs(output_dir)
|
||||
|
||||
dollar_in = ' '.join(inputs)
|
||||
subst = lambda text: text.replace('$in', dollar_in).replace('$out', output)
|
||||
|
||||
deps = ' '.join(inputs + implicit)
|
||||
if order_only:
|
||||
deps += ' | '
|
||||
deps += ' '.join(order_only)
|
||||
self.output.write('%s: %s\n' % (output, deps))
|
||||
|
||||
r = self.rules[rule]
|
||||
command = subst(r['command'])
|
||||
if r['description']:
|
||||
desc = subst(r['description'])
|
||||
self.output.write('\t@echo %s\n\t$(Verb) %s\n' % (desc, command))
|
||||
else:
|
||||
self.output.write('\t%s\n' % command)
|
||||
if r['depfile']:
|
||||
depfile = subst(r['depfile'])
|
||||
self.output.write('-include '+depfile+'\n')
|
||||
self.output.write('\n')
|
||||
|
||||
self.all_targets.append(output)
|
||||
if r['generator']:
|
||||
self.distclean_files.append(output)
|
||||
if r['depfile']:
|
||||
self.distclean_files.append(depfile)
|
||||
else:
|
||||
self.clean_files.append(output)
|
||||
if r['depfile']:
|
||||
self.distclean_files.append(depfile)
|
||||
|
||||
|
||||
def _as_list(self, input):
|
||||
if isinstance(input, list):
|
||||
return input
|
||||
return [input]
|
||||
|
||||
def default(self, paths):
|
||||
self.default_targets += self._as_list(paths)
|
||||
|
||||
def finish(self):
|
||||
self.output.write('all:: %s\n\n' % ' '.join(self.default_targets or self.all_targets))
|
||||
self.output.write('clean: \n\trm -f %s\n\n' % ' '.join(self.clean_files))
|
||||
self.output.write('distclean: clean\n\trm -f %s\n' % ' '.join(self.distclean_files))
|
||||
|
||||
class Ninja(ninja_syntax.Writer):
|
||||
def __init__(self):
|
||||
ninja_syntax.Writer.__init__(self, open(self.output_filename(), 'w'))
|
||||
|
||||
def output_filename(self):
|
||||
return 'build.ninja'
|
||||
|
||||
def finish(self):
|
||||
pass
|
||||
|
||||
def from_name(name):
|
||||
if name == 'make':
|
||||
return Make()
|
||||
if name == 'ninja':
|
||||
return Ninja()
|
||||
raise LookupError, 'unknown generator: %s; supported generators are make and ninja' % name
|
||||
@@ -1,110 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
"""Python module for generating .ninja files.
|
||||
|
||||
Note that this is emphatically not a required piece of Ninja; it's
|
||||
just a helpful utility for build-file-generation systems that already
|
||||
use Python.
|
||||
"""
|
||||
|
||||
import textwrap
|
||||
|
||||
class Writer(object):
|
||||
def __init__(self, output, width=78):
|
||||
self.output = output
|
||||
self.width = width
|
||||
|
||||
def newline(self):
|
||||
self.output.write('\n')
|
||||
|
||||
def comment(self, text):
|
||||
for line in textwrap.wrap(text, self.width - 2):
|
||||
self.output.write('# ' + line + '\n')
|
||||
|
||||
def variable(self, key, value, indent=0):
|
||||
if value is None:
|
||||
return
|
||||
if isinstance(value, list):
|
||||
value = ' '.join(value)
|
||||
self._line('%s = %s' % (key, value), indent)
|
||||
|
||||
def rule(self, name, command, description=None, depfile=None,
|
||||
generator=False):
|
||||
self._line('rule %s' % name)
|
||||
self.variable('command', command, indent=1)
|
||||
if description:
|
||||
self.variable('description', description, indent=1)
|
||||
if depfile:
|
||||
self.variable('depfile', depfile, indent=1)
|
||||
if generator:
|
||||
self.variable('generator', '1', indent=1)
|
||||
|
||||
def build(self, outputs, rule, inputs=None, implicit=None, order_only=None,
|
||||
variables=None):
|
||||
outputs = self._as_list(outputs)
|
||||
all_inputs = self._as_list(inputs)[:]
|
||||
|
||||
if implicit:
|
||||
all_inputs.append('|')
|
||||
all_inputs.extend(self._as_list(implicit))
|
||||
if order_only:
|
||||
all_inputs.append('||')
|
||||
all_inputs.extend(self._as_list(order_only))
|
||||
|
||||
self._line('build %s: %s %s' % (' '.join(outputs),
|
||||
rule,
|
||||
' '.join(all_inputs)))
|
||||
|
||||
if variables:
|
||||
for key, val in variables:
|
||||
self.variable(key, val, indent=1)
|
||||
|
||||
return outputs
|
||||
|
||||
def include(self, path):
|
||||
self._line('include %s' % path)
|
||||
|
||||
def subninja(self, path):
|
||||
self._line('subninja %s' % path)
|
||||
|
||||
def default(self, paths):
|
||||
self._line('default %s' % ' '.join(self._as_list(paths)))
|
||||
|
||||
def _line(self, text, indent=0):
|
||||
"""Write 'text' word-wrapped at self.width characters."""
|
||||
leading_space = ' ' * indent
|
||||
while len(text) > self.width:
|
||||
# The text is too wide; wrap if possible.
|
||||
|
||||
# Find the rightmost space that would obey our width constraint.
|
||||
available_space = self.width - len(leading_space) - len(' $')
|
||||
space = text.rfind(' ', 0, available_space)
|
||||
if space < 0:
|
||||
# No such space; just use the first space we can find.
|
||||
space = text.find(' ', available_space)
|
||||
if space < 0:
|
||||
# Give up on breaking.
|
||||
break
|
||||
|
||||
self.output.write(leading_space + text[0:space] + ' $\n')
|
||||
text = text[space+1:]
|
||||
|
||||
# Subsequent lines are continuations, so indent them.
|
||||
leading_space = ' ' * (indent+2)
|
||||
|
||||
self.output.write(leading_space + text + '\n')
|
||||
|
||||
def _as_list(self, input):
|
||||
if input is None:
|
||||
return []
|
||||
if isinstance(input, list):
|
||||
return input
|
||||
return [input]
|
||||
|
||||
|
||||
def escape(string):
|
||||
"""Escape a string such that it can be embedded into a Ninja file without
|
||||
further interpretation."""
|
||||
assert '\n' not in string, 'Ninja syntax does not allow newlines'
|
||||
# We only have one special metacharacter: '$'.
|
||||
return string.replace('$', '$$')
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
clang -target nvptx--nvidiacl -Iptx-nvidiacl/include -Igeneric/include -Xclang -mlink-bitcode-file -Xclang nvptx--nvidiacl/lib/builtins.bc -include clc/clc.h -Dcl_clang_storage_class_specifiers -Dcl_khr_fp64 "$@"
|
||||
@@ -1,235 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
def c_compiler_rule(b, name, description, compiler, flags):
|
||||
command = "%s -MMD -MF $out.d %s -c -o $out $in" % (compiler, flags)
|
||||
b.rule(name, command, description + " $out", depfile="$out.d")
|
||||
|
||||
version_major = 0;
|
||||
version_minor = 0;
|
||||
version_patch = 1;
|
||||
|
||||
from optparse import OptionParser
|
||||
import os
|
||||
from subprocess import *
|
||||
import sys
|
||||
|
||||
srcdir = os.path.dirname(sys.argv[0])
|
||||
|
||||
sys.path.insert(0, os.path.join(srcdir, 'build'))
|
||||
import metabuild
|
||||
|
||||
p = OptionParser()
|
||||
p.add_option('--with-llvm-config', metavar='PATH',
|
||||
help='use given llvm-config script')
|
||||
p.add_option('--with-cxx-compiler', metavar='PATH',
|
||||
help='use given C++ compiler')
|
||||
p.add_option('--prefix', metavar='PATH',
|
||||
help='install to given prefix')
|
||||
p.add_option('--libexecdir', metavar='PATH',
|
||||
help='install *.bc to given dir')
|
||||
p.add_option('--includedir', metavar='PATH',
|
||||
help='install include files to given dir')
|
||||
p.add_option('--pkgconfigdir', metavar='PATH',
|
||||
help='install clc.pc to given dir')
|
||||
p.add_option('-g', metavar='GENERATOR', default='make',
|
||||
help='use given generator (default: make)')
|
||||
(options, args) = p.parse_args()
|
||||
|
||||
llvm_config_exe = options.with_llvm_config or "llvm-config"
|
||||
|
||||
prefix = options.prefix
|
||||
if not prefix:
|
||||
prefix = '/usr/local'
|
||||
|
||||
libexecdir = options.libexecdir
|
||||
if not libexecdir:
|
||||
libexecdir = os.path.join(prefix, 'lib/clc')
|
||||
|
||||
includedir = options.includedir
|
||||
if not includedir:
|
||||
includedir = os.path.join(prefix, 'include')
|
||||
|
||||
pkgconfigdir = options.pkgconfigdir
|
||||
if not pkgconfigdir:
|
||||
pkgconfigdir = os.path.join(prefix, 'share/pkgconfig')
|
||||
|
||||
def llvm_config(args):
|
||||
try:
|
||||
proc = Popen([llvm_config_exe] + args, stdout=PIPE)
|
||||
return proc.communicate()[0].rstrip().replace('\n', ' ')
|
||||
except OSError:
|
||||
print "Error executing llvm-config."
|
||||
print "Please ensure that llvm-config is in your $PATH, or use --with-llvm-config."
|
||||
sys.exit(1)
|
||||
|
||||
llvm_bindir = llvm_config(['--bindir'])
|
||||
llvm_core_libs = llvm_config(['--libs', 'core', 'bitreader', 'bitwriter']) + ' ' + \
|
||||
llvm_config(['--ldflags'])
|
||||
llvm_cxxflags = llvm_config(['--cxxflags']) + ' -fno-exceptions -fno-rtti'
|
||||
|
||||
llvm_clang = os.path.join(llvm_bindir, 'clang')
|
||||
llvm_link = os.path.join(llvm_bindir, 'llvm-link')
|
||||
llvm_opt = os.path.join(llvm_bindir, 'opt')
|
||||
|
||||
cxx_compiler = options.with_cxx_compiler
|
||||
if not cxx_compiler:
|
||||
cxx_compiler = os.path.join(llvm_bindir, 'clang++')
|
||||
|
||||
available_targets = {
|
||||
'r600--' : { 'devices' :
|
||||
[{'gpu' : 'cedar', 'aliases' : ['palm', 'sumo', 'sumo2', 'redwood', 'juniper']},
|
||||
{'gpu' : 'cypress', 'aliases' : ['hemlock']},
|
||||
{'gpu' : 'barts', 'aliases' : ['turks', 'caicos']},
|
||||
{'gpu' : 'cayman', 'aliases' : ['aruba']},
|
||||
{'gpu' : 'tahiti', 'aliases' : ['pitcairn', 'verde', 'oland', 'bonaire', 'kabini', 'kaveri', 'hawaii']}]},
|
||||
'nvptx--nvidiacl' : { 'devices' : [{'gpu' : '', 'aliases' : []}] },
|
||||
'nvptx64--nvidiacl' : { 'devices' : [{'gpu' : '', 'aliases' : []}] }
|
||||
}
|
||||
|
||||
default_targets = ['nvptx--nvidiacl', 'nvptx64--nvidiacl', 'r600--']
|
||||
|
||||
targets = args
|
||||
if not targets:
|
||||
targets = default_targets
|
||||
|
||||
b = metabuild.from_name(options.g)
|
||||
|
||||
b.rule("LLVM_AS", "%s -o $out $in" % os.path.join(llvm_bindir, "llvm-as"),
|
||||
'LLVM-AS $out')
|
||||
b.rule("LLVM_LINK", command = llvm_link + " -o $out $in",
|
||||
description = 'LLVM-LINK $out')
|
||||
b.rule("OPT", command = llvm_opt + " -O3 -o $out $in",
|
||||
description = 'OPT $out')
|
||||
|
||||
c_compiler_rule(b, "LLVM_TOOL_CXX", 'CXX', cxx_compiler, llvm_cxxflags)
|
||||
b.rule("LLVM_TOOL_LINK", cxx_compiler + " -o $out $in %s" % llvm_core_libs, 'LINK $out')
|
||||
|
||||
prepare_builtins = os.path.join('utils', 'prepare-builtins')
|
||||
b.build(os.path.join('utils', 'prepare-builtins.o'), "LLVM_TOOL_CXX",
|
||||
os.path.join(srcdir, 'utils', 'prepare-builtins.cpp'))
|
||||
b.build(prepare_builtins, "LLVM_TOOL_LINK",
|
||||
os.path.join('utils', 'prepare-builtins.o'))
|
||||
|
||||
b.rule("PREPARE_BUILTINS", "%s -o $out $in" % prepare_builtins,
|
||||
'PREPARE-BUILTINS $out')
|
||||
b.rule("PYTHON_GEN", "python < $in > $out", "PYTHON_GEN $out")
|
||||
b.build('generic/lib/convert.cl', "PYTHON_GEN", ['generic/lib/gen_convert.py'])
|
||||
|
||||
manifest_deps = set([sys.argv[0], os.path.join(srcdir, 'build', 'metabuild.py'),
|
||||
os.path.join(srcdir, 'build', 'ninja_syntax.py')])
|
||||
|
||||
install_files_bc = []
|
||||
install_deps = []
|
||||
|
||||
# Create libclc.pc
|
||||
clc = open('libclc.pc', 'w')
|
||||
clc.write('includedir=%(inc)s\nlibexecdir=%(lib)s\n\nName: libclc\nDescription: Library requirements of the OpenCL C programming language\nVersion: %(maj)s.%(min)s.%(pat)s\nCflags: -I${includedir}\nLibs: -L${libexecdir}' %
|
||||
{'inc': includedir, 'lib': libexecdir, 'maj': version_major, 'min': version_minor, 'pat': version_patch})
|
||||
clc.close()
|
||||
|
||||
for target in targets:
|
||||
(t_arch, t_vendor, t_os) = target.split('-')
|
||||
archs = [t_arch]
|
||||
if t_arch == 'nvptx' or t_arch == 'nvptx64':
|
||||
archs.append('ptx')
|
||||
archs.append('generic')
|
||||
|
||||
subdirs = []
|
||||
for arch in archs:
|
||||
subdirs.append("%s-%s-%s" % (arch, t_vendor, t_os))
|
||||
subdirs.append("%s-%s" % (arch, t_os))
|
||||
subdirs.append(arch)
|
||||
|
||||
incdirs = filter(os.path.isdir,
|
||||
[os.path.join(srcdir, subdir, 'include') for subdir in subdirs])
|
||||
libdirs = filter(lambda d: os.path.isfile(os.path.join(d, 'SOURCES')),
|
||||
[os.path.join(srcdir, subdir, 'lib') for subdir in subdirs])
|
||||
|
||||
clang_cl_includes = ' '.join(["-I%s" % incdir for incdir in incdirs])
|
||||
|
||||
for device in available_targets[target]['devices']:
|
||||
# The rule for building a .bc file for the specified architecture using clang.
|
||||
clang_bc_flags = "-target %s -I`dirname $in` %s " \
|
||||
"-Dcl_clang_storage_class_specifiers " \
|
||||
"-Dcl_khr_fp64 " \
|
||||
"-Dcles_khr_int64 " \
|
||||
"-D__CLC_INTERNAL " \
|
||||
"-emit-llvm" % (target, clang_cl_includes)
|
||||
if device['gpu'] != '':
|
||||
clang_bc_flags += ' -mcpu=' + device['gpu']
|
||||
clang_bc_rule = "CLANG_CL_BC_" + target
|
||||
c_compiler_rule(b, clang_bc_rule, "LLVM-CC", llvm_clang, clang_bc_flags)
|
||||
|
||||
objects = []
|
||||
sources_seen = set()
|
||||
|
||||
if device['gpu'] == '':
|
||||
full_target_name = target
|
||||
obj_suffix = ''
|
||||
else:
|
||||
full_target_name = device['gpu'] + '-' + target
|
||||
obj_suffix = '.' + device['gpu']
|
||||
|
||||
for libdir in libdirs:
|
||||
subdir_list_file = os.path.join(libdir, 'SOURCES')
|
||||
manifest_deps.add(subdir_list_file)
|
||||
override_list_file = os.path.join(libdir, 'OVERRIDES')
|
||||
|
||||
# Add target overrides
|
||||
if os.path.exists(override_list_file):
|
||||
for override in open(override_list_file).readlines():
|
||||
override = override.rstrip()
|
||||
sources_seen.add(override)
|
||||
|
||||
for src in open(subdir_list_file).readlines():
|
||||
src = src.rstrip()
|
||||
if src not in sources_seen:
|
||||
sources_seen.add(src)
|
||||
obj = os.path.join(target, 'lib', src + obj_suffix + '.bc')
|
||||
objects.append(obj)
|
||||
src_file = os.path.join(libdir, src)
|
||||
ext = os.path.splitext(src)[1]
|
||||
if ext == '.ll':
|
||||
b.build(obj, 'LLVM_AS', src_file)
|
||||
else:
|
||||
b.build(obj, clang_bc_rule, src_file)
|
||||
|
||||
builtins_link_bc = os.path.join(target, 'lib', 'builtins.link' + obj_suffix + '.bc')
|
||||
builtins_opt_bc = os.path.join(target, 'lib', 'builtins.opt' + obj_suffix + '.bc')
|
||||
builtins_bc = os.path.join('built_libs', full_target_name + '.bc')
|
||||
b.build(builtins_link_bc, "LLVM_LINK", objects)
|
||||
b.build(builtins_opt_bc, "OPT", builtins_link_bc)
|
||||
b.build(builtins_bc, "PREPARE_BUILTINS", builtins_opt_bc, prepare_builtins)
|
||||
install_files_bc.append((builtins_bc, builtins_bc))
|
||||
install_deps.append(builtins_bc)
|
||||
for alias in device['aliases']:
|
||||
b.rule("CREATE_ALIAS", "ln -fs %s $out" % os.path.basename(builtins_bc)
|
||||
,"CREATE-ALIAS $out")
|
||||
|
||||
alias_file = os.path.join('built_libs', alias + '-' + target + '.bc')
|
||||
b.build(alias_file, "CREATE_ALIAS", builtins_bc)
|
||||
install_files_bc.append((alias_file, alias_file))
|
||||
install_deps.append(alias_file)
|
||||
b.default(builtins_bc)
|
||||
|
||||
|
||||
install_cmd = ' && '.join(['mkdir -p $(DESTDIR)/%(dst)s && cp -r %(src)s $(DESTDIR)/%(dst)s' %
|
||||
{'src': file,
|
||||
'dst': libexecdir}
|
||||
for (file, dest) in install_files_bc])
|
||||
install_cmd = ' && '.join(['%(old)s && mkdir -p $(DESTDIR)/%(dst)s && cp -r %(srcdir)s/generic/include/clc $(DESTDIR)/%(dst)s' %
|
||||
{'old': install_cmd,
|
||||
'dst': includedir,
|
||||
'srcdir': srcdir}])
|
||||
install_cmd = ' && '.join(['%(old)s && mkdir -p $(DESTDIR)/%(dst)s && cp -r libclc.pc $(DESTDIR)/%(dst)s' %
|
||||
{'old': install_cmd,
|
||||
'dst': pkgconfigdir}])
|
||||
|
||||
b.rule('install', command = install_cmd, description = 'INSTALL')
|
||||
b.build('install', 'install', install_deps)
|
||||
|
||||
b.rule("configure", command = ' '.join(sys.argv), description = 'CONFIGURE',
|
||||
generator = True)
|
||||
b.build(b.output_filename(), 'configure', list(manifest_deps))
|
||||
|
||||
b.finish()
|
||||
@@ -1,68 +0,0 @@
|
||||
#define as_char(x) __builtin_astype(x, char)
|
||||
#define as_uchar(x) __builtin_astype(x, uchar)
|
||||
#define as_short(x) __builtin_astype(x, short)
|
||||
#define as_ushort(x) __builtin_astype(x, ushort)
|
||||
#define as_int(x) __builtin_astype(x, int)
|
||||
#define as_uint(x) __builtin_astype(x, uint)
|
||||
#define as_long(x) __builtin_astype(x, long)
|
||||
#define as_ulong(x) __builtin_astype(x, ulong)
|
||||
#define as_float(x) __builtin_astype(x, float)
|
||||
|
||||
#define as_char2(x) __builtin_astype(x, char2)
|
||||
#define as_uchar2(x) __builtin_astype(x, uchar2)
|
||||
#define as_short2(x) __builtin_astype(x, short2)
|
||||
#define as_ushort2(x) __builtin_astype(x, ushort2)
|
||||
#define as_int2(x) __builtin_astype(x, int2)
|
||||
#define as_uint2(x) __builtin_astype(x, uint2)
|
||||
#define as_long2(x) __builtin_astype(x, long2)
|
||||
#define as_ulong2(x) __builtin_astype(x, ulong2)
|
||||
#define as_float2(x) __builtin_astype(x, float2)
|
||||
|
||||
#define as_char3(x) __builtin_astype(x, char3)
|
||||
#define as_uchar3(x) __builtin_astype(x, uchar3)
|
||||
#define as_short3(x) __builtin_astype(x, short3)
|
||||
#define as_ushort3(x) __builtin_astype(x, ushort3)
|
||||
#define as_int3(x) __builtin_astype(x, int3)
|
||||
#define as_uint3(x) __builtin_astype(x, uint3)
|
||||
#define as_long3(x) __builtin_astype(x, long3)
|
||||
#define as_ulong3(x) __builtin_astype(x, ulong3)
|
||||
#define as_float3(x) __builtin_astype(x, float3)
|
||||
|
||||
#define as_char4(x) __builtin_astype(x, char4)
|
||||
#define as_uchar4(x) __builtin_astype(x, uchar4)
|
||||
#define as_short4(x) __builtin_astype(x, short4)
|
||||
#define as_ushort4(x) __builtin_astype(x, ushort4)
|
||||
#define as_int4(x) __builtin_astype(x, int4)
|
||||
#define as_uint4(x) __builtin_astype(x, uint4)
|
||||
#define as_long4(x) __builtin_astype(x, long4)
|
||||
#define as_ulong4(x) __builtin_astype(x, ulong4)
|
||||
#define as_float4(x) __builtin_astype(x, float4)
|
||||
|
||||
#define as_char8(x) __builtin_astype(x, char8)
|
||||
#define as_uchar8(x) __builtin_astype(x, uchar8)
|
||||
#define as_short8(x) __builtin_astype(x, short8)
|
||||
#define as_ushort8(x) __builtin_astype(x, ushort8)
|
||||
#define as_int8(x) __builtin_astype(x, int8)
|
||||
#define as_uint8(x) __builtin_astype(x, uint8)
|
||||
#define as_long8(x) __builtin_astype(x, long8)
|
||||
#define as_ulong8(x) __builtin_astype(x, ulong8)
|
||||
#define as_float8(x) __builtin_astype(x, float8)
|
||||
|
||||
#define as_char16(x) __builtin_astype(x, char16)
|
||||
#define as_uchar16(x) __builtin_astype(x, uchar16)
|
||||
#define as_short16(x) __builtin_astype(x, short16)
|
||||
#define as_ushort16(x) __builtin_astype(x, ushort16)
|
||||
#define as_int16(x) __builtin_astype(x, int16)
|
||||
#define as_uint16(x) __builtin_astype(x, uint16)
|
||||
#define as_long16(x) __builtin_astype(x, long16)
|
||||
#define as_ulong16(x) __builtin_astype(x, ulong16)
|
||||
#define as_float16(x) __builtin_astype(x, float16)
|
||||
|
||||
#ifdef cl_khr_fp64
|
||||
#define as_double(x) __builtin_astype(x, double)
|
||||
#define as_double2(x) __builtin_astype(x, double2)
|
||||
#define as_double3(x) __builtin_astype(x, double3)
|
||||
#define as_double4(x) __builtin_astype(x, double4)
|
||||
#define as_double8(x) __builtin_astype(x, double8)
|
||||
#define as_double16(x) __builtin_astype(x, double16)
|
||||
#endif
|
||||
@@ -1,3 +0,0 @@
|
||||
#define __CLC_FUNCTION atomic_add
|
||||
#include <clc/atomic/atomic_decl.inc>
|
||||
#undef __CLC_FUNCTION
|
||||
@@ -1 +0,0 @@
|
||||
#define atomic_dec(p) atomic_sub(p, 1);
|
||||
@@ -1,10 +0,0 @@
|
||||
|
||||
#define __CLC_DECLARE_ATOMIC(ADDRSPACE, TYPE) \
|
||||
_CLC_OVERLOAD _CLC_DECL TYPE __CLC_FUNCTION (volatile ADDRSPACE TYPE *, TYPE);
|
||||
|
||||
#define __CLC_DECLARE_ATOMIC_ADDRSPACE(TYPE) \
|
||||
__CLC_DECLARE_ATOMIC(global, TYPE); \
|
||||
__CLC_DECLARE_ATOMIC(local, TYPE);
|
||||
|
||||
__CLC_DECLARE_ATOMIC_ADDRSPACE(int);
|
||||
__CLC_DECLARE_ATOMIC_ADDRSPACE(uint);
|
||||
@@ -1 +0,0 @@
|
||||
#define atomic_inc(p) atomic_add(p, 1);
|
||||
@@ -1,3 +0,0 @@
|
||||
#define __CLC_FUNCTION atomic_sub
|
||||
#include <clc/atomic/atomic_decl.inc>
|
||||
#undef __CLC_FUNCTION
|
||||
@@ -1,2 +0,0 @@
|
||||
_CLC_OVERLOAD _CLC_DECL int atom_add(global int *p, int val);
|
||||
_CLC_OVERLOAD _CLC_DECL unsigned int atom_add(global unsigned int *p, unsigned int val);
|
||||
@@ -1,2 +0,0 @@
|
||||
_CLC_OVERLOAD _CLC_DECL int atom_add(global int *p);
|
||||
_CLC_OVERLOAD _CLC_DECL unsigned int atom_add(global unsigned int *p);
|
||||
@@ -1,2 +0,0 @@
|
||||
_CLC_OVERLOAD _CLC_DECL int atom_inc(global int *p);
|
||||
_CLC_OVERLOAD _CLC_DECL unsigned int atom_inc(global unsigned int *p);
|
||||
@@ -1,2 +0,0 @@
|
||||
_CLC_OVERLOAD _CLC_DECL int atom_sub(global int *p, int val);
|
||||
_CLC_OVERLOAD _CLC_DECL unsigned int atom_sub(global unsigned int *p, unsigned int val);
|
||||
@@ -1,126 +0,0 @@
|
||||
#ifndef cl_clang_storage_class_specifiers
|
||||
#error Implementation requires cl_clang_storage_class_specifiers extension!
|
||||
#endif
|
||||
|
||||
#pragma OPENCL EXTENSION cl_clang_storage_class_specifiers : enable
|
||||
|
||||
#ifdef cl_khr_fp64
|
||||
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
|
||||
#endif
|
||||
|
||||
/* Function Attributes */
|
||||
#include <clc/clcfunc.h>
|
||||
|
||||
/* Pattern Macro Definitions */
|
||||
#include <clc/clcmacro.h>
|
||||
|
||||
/* 6.1 Supported Data Types */
|
||||
#include <clc/clctypes.h>
|
||||
|
||||
/* 6.2.3 Explicit Conversions */
|
||||
#include <clc/convert.h>
|
||||
|
||||
/* 6.2.4.2 Reinterpreting Types Using as_type() and as_typen() */
|
||||
#include <clc/as_type.h>
|
||||
|
||||
/* 6.11.1 Work-Item Functions */
|
||||
#include <clc/workitem/get_global_size.h>
|
||||
#include <clc/workitem/get_global_id.h>
|
||||
#include <clc/workitem/get_local_size.h>
|
||||
#include <clc/workitem/get_local_id.h>
|
||||
#include <clc/workitem/get_num_groups.h>
|
||||
#include <clc/workitem/get_group_id.h>
|
||||
|
||||
/* 6.11.2 Math Functions */
|
||||
#include <clc/math/cos.h>
|
||||
#include <clc/math/ceil.h>
|
||||
#include <clc/math/exp.h>
|
||||
#include <clc/math/exp2.h>
|
||||
#include <clc/math/fabs.h>
|
||||
#include <clc/math/floor.h>
|
||||
#include <clc/math/fma.h>
|
||||
#include <clc/math/fmax.h>
|
||||
#include <clc/math/fmin.h>
|
||||
#include <clc/math/hypot.h>
|
||||
#include <clc/math/log.h>
|
||||
#include <clc/math/log2.h>
|
||||
#include <clc/math/mad.h>
|
||||
#include <clc/math/nextafter.h>
|
||||
#include <clc/math/pow.h>
|
||||
#include <clc/math/rint.h>
|
||||
#include <clc/math/round.h>
|
||||
#include <clc/math/sin.h>
|
||||
#include <clc/math/sqrt.h>
|
||||
#include <clc/math/native_cos.h>
|
||||
#include <clc/math/native_divide.h>
|
||||
#include <clc/math/native_exp.h>
|
||||
#include <clc/math/native_exp2.h>
|
||||
#include <clc/math/native_log.h>
|
||||
#include <clc/math/native_log2.h>
|
||||
#include <clc/math/native_powr.h>
|
||||
#include <clc/math/native_sin.h>
|
||||
#include <clc/math/native_sqrt.h>
|
||||
#include <clc/math/rsqrt.h>
|
||||
|
||||
/* 6.11.3 Integer Functions */
|
||||
#include <clc/integer/abs.h>
|
||||
#include <clc/integer/abs_diff.h>
|
||||
#include <clc/integer/add_sat.h>
|
||||
#include <clc/integer/clz.h>
|
||||
#include <clc/integer/hadd.h>
|
||||
#include <clc/integer/mad24.h>
|
||||
#include <clc/integer/mad_hi.h>
|
||||
#include <clc/integer/mul24.h>
|
||||
#include <clc/integer/mul_hi.h>
|
||||
#include <clc/integer/rhadd.h>
|
||||
#include <clc/integer/rotate.h>
|
||||
#include <clc/integer/sub_sat.h>
|
||||
#include <clc/integer/upsample.h>
|
||||
|
||||
/* 6.11.3 Integer Definitions */
|
||||
#include <clc/integer/definitions.h>
|
||||
|
||||
/* 6.11.2 and 6.11.3 Shared Integer/Math Functions */
|
||||
#include <clc/shared/clamp.h>
|
||||
#include <clc/shared/max.h>
|
||||
#include <clc/shared/min.h>
|
||||
#include <clc/shared/vload.h>
|
||||
#include <clc/shared/vstore.h>
|
||||
|
||||
/* 6.11.4 Common Functions */
|
||||
#include <clc/common/sign.h>
|
||||
|
||||
/* 6.11.5 Geometric Functions */
|
||||
#include <clc/geometric/cross.h>
|
||||
#include <clc/geometric/dot.h>
|
||||
#include <clc/geometric/length.h>
|
||||
#include <clc/geometric/normalize.h>
|
||||
|
||||
/* 6.11.6 Relational Functions */
|
||||
#include <clc/relational/any.h>
|
||||
#include <clc/relational/bitselect.h>
|
||||
#include <clc/relational/isnan.h>
|
||||
#include <clc/relational/select.h>
|
||||
|
||||
/* 6.11.8 Synchronization Functions */
|
||||
#include <clc/synchronization/cl_mem_fence_flags.h>
|
||||
#include <clc/synchronization/barrier.h>
|
||||
|
||||
/* 6.11.11 Atomic Functions */
|
||||
#include <clc/atomic/atomic_add.h>
|
||||
#include <clc/atomic/atomic_dec.h>
|
||||
#include <clc/atomic/atomic_inc.h>
|
||||
#include <clc/atomic/atomic_sub.h>
|
||||
|
||||
/* cl_khr_global_int32_base_atomics Extension Functions */
|
||||
#include <clc/cl_khr_global_int32_base_atomics/atom_add.h>
|
||||
#include <clc/cl_khr_global_int32_base_atomics/atom_dec.h>
|
||||
#include <clc/cl_khr_global_int32_base_atomics/atom_inc.h>
|
||||
#include <clc/cl_khr_global_int32_base_atomics/atom_sub.h>
|
||||
|
||||
/* libclc internal defintions */
|
||||
#ifdef __CLC_INTERNAL
|
||||
#include <math/clc_nextafter.h>
|
||||
#endif
|
||||
|
||||
#pragma OPENCL EXTENSION all : disable
|
||||
@@ -1,4 +0,0 @@
|
||||
#define _CLC_OVERLOAD __attribute__((overloadable))
|
||||
#define _CLC_DECL
|
||||
#define _CLC_DEF __attribute__((always_inline))
|
||||
#define _CLC_INLINE __attribute__((always_inline)) inline
|
||||
@@ -1,54 +0,0 @@
|
||||
#define _CLC_UNARY_VECTORIZE(DECLSPEC, RET_TYPE, FUNCTION, ARG1_TYPE) \
|
||||
DECLSPEC RET_TYPE##2 FUNCTION(ARG1_TYPE##2 x) { \
|
||||
return (RET_TYPE##2)(FUNCTION(x.x), FUNCTION(x.y)); \
|
||||
} \
|
||||
\
|
||||
DECLSPEC RET_TYPE##3 FUNCTION(ARG1_TYPE##3 x) { \
|
||||
return (RET_TYPE##3)(FUNCTION(x.x), FUNCTION(x.y), FUNCTION(x.z)); \
|
||||
} \
|
||||
\
|
||||
DECLSPEC RET_TYPE##4 FUNCTION(ARG1_TYPE##4 x) { \
|
||||
return (RET_TYPE##4)(FUNCTION(x.lo), FUNCTION(x.hi)); \
|
||||
} \
|
||||
\
|
||||
DECLSPEC RET_TYPE##8 FUNCTION(ARG1_TYPE##8 x) { \
|
||||
return (RET_TYPE##8)(FUNCTION(x.lo), FUNCTION(x.hi)); \
|
||||
} \
|
||||
\
|
||||
DECLSPEC RET_TYPE##16 FUNCTION(ARG1_TYPE##16 x) { \
|
||||
return (RET_TYPE##16)(FUNCTION(x.lo), FUNCTION(x.hi)); \
|
||||
}
|
||||
|
||||
#define _CLC_BINARY_VECTORIZE(DECLSPEC, RET_TYPE, FUNCTION, ARG1_TYPE, ARG2_TYPE) \
|
||||
DECLSPEC RET_TYPE##2 FUNCTION(ARG1_TYPE##2 x, ARG2_TYPE##2 y) { \
|
||||
return (RET_TYPE##2)(FUNCTION(x.x, y.x), FUNCTION(x.y, y.y)); \
|
||||
} \
|
||||
\
|
||||
DECLSPEC RET_TYPE##3 FUNCTION(ARG1_TYPE##3 x, ARG2_TYPE##3 y) { \
|
||||
return (RET_TYPE##3)(FUNCTION(x.x, y.x), FUNCTION(x.y, y.y), \
|
||||
FUNCTION(x.z, y.z)); \
|
||||
} \
|
||||
\
|
||||
DECLSPEC RET_TYPE##4 FUNCTION(ARG1_TYPE##4 x, ARG2_TYPE##4 y) { \
|
||||
return (RET_TYPE##4)(FUNCTION(x.lo, y.lo), FUNCTION(x.hi, y.hi)); \
|
||||
} \
|
||||
\
|
||||
DECLSPEC RET_TYPE##8 FUNCTION(ARG1_TYPE##8 x, ARG2_TYPE##8 y) { \
|
||||
return (RET_TYPE##8)(FUNCTION(x.lo, y.lo), FUNCTION(x.hi, y.hi)); \
|
||||
} \
|
||||
\
|
||||
DECLSPEC RET_TYPE##16 FUNCTION(ARG1_TYPE##16 x, ARG2_TYPE##16 y) { \
|
||||
return (RET_TYPE##16)(FUNCTION(x.lo, y.lo), FUNCTION(x.hi, y.hi)); \
|
||||
}
|
||||
|
||||
#define _CLC_DEFINE_BINARY_BUILTIN(RET_TYPE, FUNCTION, BUILTIN, ARG1_TYPE, ARG2_TYPE) \
|
||||
_CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG1_TYPE x, ARG2_TYPE y) { \
|
||||
return BUILTIN(x, y); \
|
||||
} \
|
||||
_CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, RET_TYPE, FUNCTION, ARG1_TYPE, ARG2_TYPE)
|
||||
|
||||
#define _CLC_DEFINE_UNARY_BUILTIN(RET_TYPE, FUNCTION, BUILTIN, ARG1_TYPE) \
|
||||
_CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG1_TYPE x) { \
|
||||
return BUILTIN(x); \
|
||||
} \
|
||||
_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, RET_TYPE, FUNCTION, ARG1_TYPE)
|
||||
@@ -1,74 +0,0 @@
|
||||
/* 6.1.1 Built-in Scalar Data Types */
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
typedef unsigned char uchar;
|
||||
typedef unsigned short ushort;
|
||||
typedef unsigned int uint;
|
||||
typedef unsigned long ulong;
|
||||
|
||||
/* 6.1.2 Built-in Vector Data Types */
|
||||
|
||||
typedef __attribute__((ext_vector_type(2))) char char2;
|
||||
typedef __attribute__((ext_vector_type(3))) char char3;
|
||||
typedef __attribute__((ext_vector_type(4))) char char4;
|
||||
typedef __attribute__((ext_vector_type(8))) char char8;
|
||||
typedef __attribute__((ext_vector_type(16))) char char16;
|
||||
|
||||
typedef __attribute__((ext_vector_type(2))) uchar uchar2;
|
||||
typedef __attribute__((ext_vector_type(3))) uchar uchar3;
|
||||
typedef __attribute__((ext_vector_type(4))) uchar uchar4;
|
||||
typedef __attribute__((ext_vector_type(8))) uchar uchar8;
|
||||
typedef __attribute__((ext_vector_type(16))) uchar uchar16;
|
||||
|
||||
typedef __attribute__((ext_vector_type(2))) short short2;
|
||||
typedef __attribute__((ext_vector_type(3))) short short3;
|
||||
typedef __attribute__((ext_vector_type(4))) short short4;
|
||||
typedef __attribute__((ext_vector_type(8))) short short8;
|
||||
typedef __attribute__((ext_vector_type(16))) short short16;
|
||||
|
||||
typedef __attribute__((ext_vector_type(2))) ushort ushort2;
|
||||
typedef __attribute__((ext_vector_type(3))) ushort ushort3;
|
||||
typedef __attribute__((ext_vector_type(4))) ushort ushort4;
|
||||
typedef __attribute__((ext_vector_type(8))) ushort ushort8;
|
||||
typedef __attribute__((ext_vector_type(16))) ushort ushort16;
|
||||
|
||||
typedef __attribute__((ext_vector_type(2))) int int2;
|
||||
typedef __attribute__((ext_vector_type(3))) int int3;
|
||||
typedef __attribute__((ext_vector_type(4))) int int4;
|
||||
typedef __attribute__((ext_vector_type(8))) int int8;
|
||||
typedef __attribute__((ext_vector_type(16))) int int16;
|
||||
|
||||
typedef __attribute__((ext_vector_type(2))) uint uint2;
|
||||
typedef __attribute__((ext_vector_type(3))) uint uint3;
|
||||
typedef __attribute__((ext_vector_type(4))) uint uint4;
|
||||
typedef __attribute__((ext_vector_type(8))) uint uint8;
|
||||
typedef __attribute__((ext_vector_type(16))) uint uint16;
|
||||
|
||||
typedef __attribute__((ext_vector_type(2))) long long2;
|
||||
typedef __attribute__((ext_vector_type(3))) long long3;
|
||||
typedef __attribute__((ext_vector_type(4))) long long4;
|
||||
typedef __attribute__((ext_vector_type(8))) long long8;
|
||||
typedef __attribute__((ext_vector_type(16))) long long16;
|
||||
|
||||
typedef __attribute__((ext_vector_type(2))) ulong ulong2;
|
||||
typedef __attribute__((ext_vector_type(3))) ulong ulong3;
|
||||
typedef __attribute__((ext_vector_type(4))) ulong ulong4;
|
||||
typedef __attribute__((ext_vector_type(8))) ulong ulong8;
|
||||
typedef __attribute__((ext_vector_type(16))) ulong ulong16;
|
||||
|
||||
typedef __attribute__((ext_vector_type(2))) float float2;
|
||||
typedef __attribute__((ext_vector_type(3))) float float3;
|
||||
typedef __attribute__((ext_vector_type(4))) float float4;
|
||||
typedef __attribute__((ext_vector_type(8))) float float8;
|
||||
typedef __attribute__((ext_vector_type(16))) float float16;
|
||||
|
||||
/* 9.3 Double Precision Floating-Point */
|
||||
|
||||
#ifdef cl_khr_fp64
|
||||
typedef __attribute__((ext_vector_type(2))) double double2;
|
||||
typedef __attribute__((ext_vector_type(3))) double double3;
|
||||
typedef __attribute__((ext_vector_type(4))) double double4;
|
||||
typedef __attribute__((ext_vector_type(8))) double double8;
|
||||
typedef __attribute__((ext_vector_type(16))) double double16;
|
||||
#endif
|
||||
@@ -1,5 +0,0 @@
|
||||
#define __CLC_FUNCTION sign
|
||||
#define __CLC_BODY <clc/math/unary_decl.inc>
|
||||
#include <clc/math/gentype.inc>
|
||||
#undef __CLC_FUNCTION
|
||||
#undef __CLC_BODY
|
||||
@@ -1,60 +0,0 @@
|
||||
#define _CLC_CONVERT_DECL(FROM_TYPE, TO_TYPE, SUFFIX) \
|
||||
_CLC_OVERLOAD _CLC_DECL TO_TYPE convert_##TO_TYPE##SUFFIX(FROM_TYPE x);
|
||||
|
||||
#define _CLC_VECTOR_CONVERT_DECL(FROM_TYPE, TO_TYPE, SUFFIX) \
|
||||
_CLC_CONVERT_DECL(FROM_TYPE, TO_TYPE, SUFFIX) \
|
||||
_CLC_CONVERT_DECL(FROM_TYPE##2, TO_TYPE##2, SUFFIX) \
|
||||
_CLC_CONVERT_DECL(FROM_TYPE##3, TO_TYPE##3, SUFFIX) \
|
||||
_CLC_CONVERT_DECL(FROM_TYPE##4, TO_TYPE##4, SUFFIX) \
|
||||
_CLC_CONVERT_DECL(FROM_TYPE##8, TO_TYPE##8, SUFFIX) \
|
||||
_CLC_CONVERT_DECL(FROM_TYPE##16, TO_TYPE##16, SUFFIX)
|
||||
|
||||
#define _CLC_VECTOR_CONVERT_FROM1(FROM_TYPE, SUFFIX) \
|
||||
_CLC_VECTOR_CONVERT_DECL(FROM_TYPE, char, SUFFIX) \
|
||||
_CLC_VECTOR_CONVERT_DECL(FROM_TYPE, uchar, SUFFIX) \
|
||||
_CLC_VECTOR_CONVERT_DECL(FROM_TYPE, int, SUFFIX) \
|
||||
_CLC_VECTOR_CONVERT_DECL(FROM_TYPE, uint, SUFFIX) \
|
||||
_CLC_VECTOR_CONVERT_DECL(FROM_TYPE, short, SUFFIX) \
|
||||
_CLC_VECTOR_CONVERT_DECL(FROM_TYPE, ushort, SUFFIX) \
|
||||
_CLC_VECTOR_CONVERT_DECL(FROM_TYPE, long, SUFFIX) \
|
||||
_CLC_VECTOR_CONVERT_DECL(FROM_TYPE, ulong, SUFFIX) \
|
||||
_CLC_VECTOR_CONVERT_DECL(FROM_TYPE, float, SUFFIX)
|
||||
|
||||
#ifdef cl_khr_fp64
|
||||
#define _CLC_VECTOR_CONVERT_FROM(FROM_TYPE, SUFFIX) \
|
||||
_CLC_VECTOR_CONVERT_FROM1(FROM_TYPE, SUFFIX) \
|
||||
_CLC_VECTOR_CONVERT_DECL(FROM_TYPE, double, SUFFIX)
|
||||
#else
|
||||
#define _CLC_VECTOR_CONVERT_FROM(FROM_TYPE, SUFFIX) \
|
||||
_CLC_VECTOR_CONVERT_FROM1(FROM_TYPE, SUFFIX)
|
||||
#endif
|
||||
|
||||
#define _CLC_VECTOR_CONVERT_TO1(SUFFIX) \
|
||||
_CLC_VECTOR_CONVERT_FROM(char, SUFFIX) \
|
||||
_CLC_VECTOR_CONVERT_FROM(uchar, SUFFIX) \
|
||||
_CLC_VECTOR_CONVERT_FROM(int, SUFFIX) \
|
||||
_CLC_VECTOR_CONVERT_FROM(uint, SUFFIX) \
|
||||
_CLC_VECTOR_CONVERT_FROM(short, SUFFIX) \
|
||||
_CLC_VECTOR_CONVERT_FROM(ushort, SUFFIX) \
|
||||
_CLC_VECTOR_CONVERT_FROM(long, SUFFIX) \
|
||||
_CLC_VECTOR_CONVERT_FROM(ulong, SUFFIX) \
|
||||
_CLC_VECTOR_CONVERT_FROM(float, SUFFIX)
|
||||
|
||||
#ifdef cl_khr_fp64
|
||||
#define _CLC_VECTOR_CONVERT_TO(SUFFIX) \
|
||||
_CLC_VECTOR_CONVERT_TO1(SUFFIX) \
|
||||
_CLC_VECTOR_CONVERT_FROM(double, SUFFIX)
|
||||
#else
|
||||
#define _CLC_VECTOR_CONVERT_TO(SUFFIX) \
|
||||
_CLC_VECTOR_CONVERT_TO1(SUFFIX)
|
||||
#endif
|
||||
|
||||
#define _CLC_VECTOR_CONVERT_TO_SUFFIX(ROUND) \
|
||||
_CLC_VECTOR_CONVERT_TO(_sat##ROUND) \
|
||||
_CLC_VECTOR_CONVERT_TO(ROUND)
|
||||
|
||||
_CLC_VECTOR_CONVERT_TO_SUFFIX(_rtn)
|
||||
_CLC_VECTOR_CONVERT_TO_SUFFIX(_rte)
|
||||
_CLC_VECTOR_CONVERT_TO_SUFFIX(_rtz)
|
||||
_CLC_VECTOR_CONVERT_TO_SUFFIX(_rtp)
|
||||
_CLC_VECTOR_CONVERT_TO_SUFFIX()
|
||||
@@ -1,51 +0,0 @@
|
||||
#define __CLC_GENTYPE float
|
||||
#include BODY
|
||||
#undef __CLC_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE float2
|
||||
#include BODY
|
||||
#undef __CLC_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE float3
|
||||
#include BODY
|
||||
#undef __CLC_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE float4
|
||||
#include BODY
|
||||
#undef __CLC_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE float8
|
||||
#include BODY
|
||||
#undef __CLC_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE float16
|
||||
#include BODY
|
||||
#undef __CLC_GENTYPE
|
||||
|
||||
#ifdef cl_khr_fp64
|
||||
#define __CLC_GENTYPE double
|
||||
#include BODY
|
||||
#undef __CLC_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE double2
|
||||
#include BODY
|
||||
#undef __CLC_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE double3
|
||||
#include BODY
|
||||
#undef __CLC_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE double4
|
||||
#include BODY
|
||||
#undef __CLC_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE double8
|
||||
#include BODY
|
||||
#undef __CLC_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE double16
|
||||
#include BODY
|
||||
#undef __CLC_GENTYPE
|
||||
#endif
|
||||
|
||||
#undef BODY
|
||||
@@ -1,2 +0,0 @@
|
||||
_CLC_OVERLOAD _CLC_DECL float3 cross(float3 p0, float3 p1);
|
||||
_CLC_OVERLOAD _CLC_DECL float4 cross(float4 p0, float4 p1);
|
||||
@@ -1,2 +0,0 @@
|
||||
#define __CLC_BODY <clc/geometric/distance.inc>
|
||||
#include <clc/geometric/floatn.inc>
|
||||
@@ -1,2 +0,0 @@
|
||||
#define __CLC_BODY <clc/geometric/dot.inc>
|
||||
#include <clc/geometric/floatn.inc>
|
||||
@@ -1 +0,0 @@
|
||||
_CLC_OVERLOAD _CLC_DECL __CLC_FLOAT dot(__CLC_FLOATN p0, __CLC_FLOATN p1);
|
||||
@@ -1,45 +0,0 @@
|
||||
#define __CLC_FLOAT float
|
||||
|
||||
#define __CLC_FLOATN float
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_FLOATN
|
||||
|
||||
#define __CLC_FLOATN float2
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_FLOATN
|
||||
|
||||
#define __CLC_FLOATN float3
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_FLOATN
|
||||
|
||||
#define __CLC_FLOATN float4
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_FLOATN
|
||||
|
||||
#undef __CLC_FLOAT
|
||||
|
||||
#ifdef cl_khr_fp64
|
||||
|
||||
#define __CLC_FLOAT double
|
||||
|
||||
#define __CLC_FLOATN double
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_FLOATN
|
||||
|
||||
#define __CLC_FLOATN double2
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_FLOATN
|
||||
|
||||
#define __CLC_FLOATN double3
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_FLOATN
|
||||
|
||||
#define __CLC_FLOATN double4
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_FLOATN
|
||||
|
||||
#undef __CLC_FLOAT
|
||||
|
||||
#endif
|
||||
|
||||
#undef __CLC_BODY
|
||||
@@ -1,2 +0,0 @@
|
||||
#define __CLC_BODY <clc/geometric/length.inc>
|
||||
#include <clc/geometric/floatn.inc>
|
||||
@@ -1 +0,0 @@
|
||||
_CLC_OVERLOAD _CLC_DECL __CLC_FLOAT length(__CLC_FLOATN p0);
|
||||
@@ -1,2 +0,0 @@
|
||||
#define __CLC_BODY <clc/geometric/normalize.inc>
|
||||
#include <clc/geometric/floatn.inc>
|
||||
@@ -1 +0,0 @@
|
||||
_CLC_OVERLOAD _CLC_DECL __CLC_FLOATN normalize(__CLC_FLOATN p);
|
||||
@@ -1,2 +0,0 @@
|
||||
#define __CLC_BODY <clc/integer/abs.inc>
|
||||
#include <clc/integer/gentype.inc>
|
||||
@@ -1 +0,0 @@
|
||||
_CLC_OVERLOAD _CLC_DECL __CLC_U_GENTYPE abs(__CLC_GENTYPE x);
|
||||
@@ -1,2 +0,0 @@
|
||||
#define __CLC_BODY <clc/integer/abs_diff.inc>
|
||||
#include <clc/integer/gentype.inc>
|
||||
@@ -1 +0,0 @@
|
||||
_CLC_OVERLOAD _CLC_DECL __CLC_U_GENTYPE abs_diff(__CLC_GENTYPE x, __CLC_GENTYPE y);
|
||||
@@ -1,2 +0,0 @@
|
||||
#define __CLC_BODY <clc/integer/add_sat.inc>
|
||||
#include <clc/integer/gentype.inc>
|
||||
@@ -1 +0,0 @@
|
||||
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE add_sat(__CLC_GENTYPE x, __CLC_GENTYPE y);
|
||||
@@ -1,2 +0,0 @@
|
||||
#define __CLC_BODY <clc/integer/clz.inc>
|
||||
#include <clc/integer/gentype.inc>
|
||||
@@ -1 +0,0 @@
|
||||
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE clz(__CLC_GENTYPE x);
|
||||
@@ -1,15 +0,0 @@
|
||||
#define CHAR_BIT 8
|
||||
#define INT_MAX 2147483647
|
||||
#define INT_MIN -2147483648
|
||||
#define LONG_MAX 0x7fffffffffffffffL
|
||||
#define LONG_MIN -0x8000000000000000L
|
||||
#define SCHAR_MAX 127
|
||||
#define SCHAR_MIN -128
|
||||
#define CHAR_MAX 127
|
||||
#define CHAR_MIN -128
|
||||
#define SHRT_MAX 32767
|
||||
#define SHRT_MIN -32768
|
||||
#define UCHAR_MAX 255
|
||||
#define USHRT_MAX 65535
|
||||
#define UINT_MAX 0xffffffff
|
||||
#define ULONG_MAX 0xffffffffffffffffUL
|
||||
@@ -1,435 +0,0 @@
|
||||
//These 2 defines only change when switching between data sizes or base types to
|
||||
//keep this file manageable.
|
||||
#define __CLC_GENSIZE 8
|
||||
#define __CLC_SCALAR_GENTYPE char
|
||||
|
||||
#define __CLC_GENTYPE char
|
||||
#define __CLC_U_GENTYPE uchar
|
||||
#define __CLC_S_GENTYPE char
|
||||
#define __CLC_SCALAR 1
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_SCALAR
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE char2
|
||||
#define __CLC_U_GENTYPE uchar2
|
||||
#define __CLC_S_GENTYPE char2
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE char3
|
||||
#define __CLC_U_GENTYPE uchar3
|
||||
#define __CLC_S_GENTYPE char3
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE char4
|
||||
#define __CLC_U_GENTYPE uchar4
|
||||
#define __CLC_S_GENTYPE char4
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE char8
|
||||
#define __CLC_U_GENTYPE uchar8
|
||||
#define __CLC_S_GENTYPE char8
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE char16
|
||||
#define __CLC_U_GENTYPE uchar16
|
||||
#define __CLC_S_GENTYPE char16
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#undef __CLC_SCALAR_GENTYPE
|
||||
#define __CLC_SCALAR_GENTYPE uchar
|
||||
|
||||
#define __CLC_GENTYPE uchar
|
||||
#define __CLC_U_GENTYPE uchar
|
||||
#define __CLC_S_GENTYPE char
|
||||
#define __CLC_SCALAR 1
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_SCALAR
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE uchar2
|
||||
#define __CLC_U_GENTYPE uchar2
|
||||
#define __CLC_S_GENTYPE char2
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE uchar3
|
||||
#define __CLC_U_GENTYPE uchar3
|
||||
#define __CLC_S_GENTYPE char3
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE uchar4
|
||||
#define __CLC_U_GENTYPE uchar4
|
||||
#define __CLC_S_GENTYPE char4
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE uchar8
|
||||
#define __CLC_U_GENTYPE uchar8
|
||||
#define __CLC_S_GENTYPE char8
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE uchar16
|
||||
#define __CLC_U_GENTYPE uchar16
|
||||
#define __CLC_S_GENTYPE char16
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#undef __CLC_GENSIZE
|
||||
#define __CLC_GENSIZE 16
|
||||
#undef __CLC_SCALAR_GENTYPE
|
||||
#define __CLC_SCALAR_GENTYPE short
|
||||
|
||||
#define __CLC_GENTYPE short
|
||||
#define __CLC_U_GENTYPE ushort
|
||||
#define __CLC_S_GENTYPE short
|
||||
#define __CLC_SCALAR 1
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_SCALAR
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE short2
|
||||
#define __CLC_U_GENTYPE ushort2
|
||||
#define __CLC_S_GENTYPE short2
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE short3
|
||||
#define __CLC_U_GENTYPE ushort3
|
||||
#define __CLC_S_GENTYPE short3
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE short4
|
||||
#define __CLC_U_GENTYPE ushort4
|
||||
#define __CLC_S_GENTYPE short4
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE short8
|
||||
#define __CLC_U_GENTYPE ushort8
|
||||
#define __CLC_S_GENTYPE short8
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE short16
|
||||
#define __CLC_U_GENTYPE ushort16
|
||||
#define __CLC_S_GENTYPE short16
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#undef __CLC_SCALAR_GENTYPE
|
||||
#define __CLC_SCALAR_GENTYPE ushort
|
||||
|
||||
#define __CLC_GENTYPE ushort
|
||||
#define __CLC_U_GENTYPE ushort
|
||||
#define __CLC_S_GENTYPE short
|
||||
#define __CLC_SCALAR 1
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_SCALAR
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE ushort2
|
||||
#define __CLC_U_GENTYPE ushort2
|
||||
#define __CLC_S_GENTYPE short2
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE ushort3
|
||||
#define __CLC_U_GENTYPE ushort3
|
||||
#define __CLC_S_GENTYPE short3
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE ushort4
|
||||
#define __CLC_U_GENTYPE ushort4
|
||||
#define __CLC_S_GENTYPE short4
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE ushort8
|
||||
#define __CLC_U_GENTYPE ushort8
|
||||
#define __CLC_S_GENTYPE short8
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE ushort16
|
||||
#define __CLC_U_GENTYPE ushort16
|
||||
#define __CLC_S_GENTYPE short16
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#undef __CLC_GENSIZE
|
||||
#define __CLC_GENSIZE 32
|
||||
#undef __CLC_SCALAR_GENTYPE
|
||||
#define __CLC_SCALAR_GENTYPE int
|
||||
|
||||
#define __CLC_GENTYPE int
|
||||
#define __CLC_U_GENTYPE uint
|
||||
#define __CLC_S_GENTYPE int
|
||||
#define __CLC_SCALAR 1
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_SCALAR
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE int2
|
||||
#define __CLC_U_GENTYPE uint2
|
||||
#define __CLC_S_GENTYPE int2
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE int3
|
||||
#define __CLC_U_GENTYPE uint3
|
||||
#define __CLC_S_GENTYPE int3
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE int4
|
||||
#define __CLC_U_GENTYPE uint4
|
||||
#define __CLC_S_GENTYPE int4
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE int8
|
||||
#define __CLC_U_GENTYPE uint8
|
||||
#define __CLC_S_GENTYPE int8
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE int16
|
||||
#define __CLC_U_GENTYPE uint16
|
||||
#define __CLC_S_GENTYPE int16
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#undef __CLC_SCALAR_GENTYPE
|
||||
#define __CLC_SCALAR_GENTYPE uint
|
||||
|
||||
#define __CLC_GENTYPE uint
|
||||
#define __CLC_U_GENTYPE uint
|
||||
#define __CLC_S_GENTYPE int
|
||||
#define __CLC_SCALAR 1
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_SCALAR
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE uint2
|
||||
#define __CLC_U_GENTYPE uint2
|
||||
#define __CLC_S_GENTYPE int2
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE uint3
|
||||
#define __CLC_U_GENTYPE uint3
|
||||
#define __CLC_S_GENTYPE int3
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE uint4
|
||||
#define __CLC_U_GENTYPE uint4
|
||||
#define __CLC_S_GENTYPE int4
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE uint8
|
||||
#define __CLC_U_GENTYPE uint8
|
||||
#define __CLC_S_GENTYPE int8
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE uint16
|
||||
#define __CLC_U_GENTYPE uint16
|
||||
#define __CLC_S_GENTYPE int16
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#undef __CLC_GENSIZE
|
||||
#define __CLC_GENSIZE 64
|
||||
#undef __CLC_SCALAR_GENTYPE
|
||||
#define __CLC_SCALAR_GENTYPE long
|
||||
|
||||
#define __CLC_GENTYPE long
|
||||
#define __CLC_U_GENTYPE ulong
|
||||
#define __CLC_S_GENTYPE long
|
||||
#define __CLC_SCALAR 1
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_SCALAR
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE long2
|
||||
#define __CLC_U_GENTYPE ulong2
|
||||
#define __CLC_S_GENTYPE long2
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE long3
|
||||
#define __CLC_U_GENTYPE ulong3
|
||||
#define __CLC_S_GENTYPE long3
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE long4
|
||||
#define __CLC_U_GENTYPE ulong4
|
||||
#define __CLC_S_GENTYPE long4
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE long8
|
||||
#define __CLC_U_GENTYPE ulong8
|
||||
#define __CLC_S_GENTYPE long8
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE long16
|
||||
#define __CLC_U_GENTYPE ulong16
|
||||
#define __CLC_S_GENTYPE long16
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#undef __CLC_SCALAR_GENTYPE
|
||||
#define __CLC_SCALAR_GENTYPE ulong
|
||||
|
||||
#define __CLC_GENTYPE ulong
|
||||
#define __CLC_U_GENTYPE ulong
|
||||
#define __CLC_S_GENTYPE long
|
||||
#define __CLC_SCALAR 1
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_SCALAR
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE ulong2
|
||||
#define __CLC_U_GENTYPE ulong2
|
||||
#define __CLC_S_GENTYPE long2
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE ulong3
|
||||
#define __CLC_U_GENTYPE ulong3
|
||||
#define __CLC_S_GENTYPE long3
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE ulong4
|
||||
#define __CLC_U_GENTYPE ulong4
|
||||
#define __CLC_S_GENTYPE long4
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE ulong8
|
||||
#define __CLC_U_GENTYPE ulong8
|
||||
#define __CLC_S_GENTYPE long8
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE ulong16
|
||||
#define __CLC_U_GENTYPE ulong16
|
||||
#define __CLC_S_GENTYPE long16
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#undef __CLC_GENSIZE
|
||||
#undef __CLC_SCALAR_GENTYPE
|
||||
#undef __CLC_BODY
|
||||
@@ -1,2 +0,0 @@
|
||||
#define __CLC_BODY <clc/integer/hadd.inc>
|
||||
#include <clc/integer/gentype.inc>
|
||||
@@ -1 +0,0 @@
|
||||
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE hadd(__CLC_GENTYPE x, __CLC_GENTYPE y);
|
||||
@@ -1,39 +0,0 @@
|
||||
#define __CLC_GENTYPE int
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE int2
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE int4
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE int8
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE int16
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE uint
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE uint2
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE uint4
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE uint8
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
|
||||
#define __CLC_GENTYPE uint16
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_GENTYPE
|
||||
@@ -1,3 +0,0 @@
|
||||
#define __CLC_BODY <clc/integer/mad24.inc>
|
||||
#include <clc/integer/integer-gentype.inc>
|
||||
#undef __CLC_BODY
|
||||
@@ -1 +0,0 @@
|
||||
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE mad24(__CLC_GENTYPE x, __CLC_GENTYPE y, __CLC_GENTYPE z);
|
||||
@@ -1 +0,0 @@
|
||||
#define mad_hi(a, b, c) (mul_hi((a),(b))+(c))
|
||||
@@ -1,3 +0,0 @@
|
||||
#define __CLC_BODY <clc/integer/mul24.inc>
|
||||
#include <clc/integer/integer-gentype.inc>
|
||||
#undef __CLC_BODY
|
||||
@@ -1 +0,0 @@
|
||||
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE mul24(__CLC_GENTYPE x, __CLC_GENTYPE y);
|
||||
@@ -1,2 +0,0 @@
|
||||
#define __CLC_BODY <clc/integer/mul_hi.inc>
|
||||
#include <clc/integer/gentype.inc>
|
||||
@@ -1 +0,0 @@
|
||||
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE mul_hi(__CLC_GENTYPE x, __CLC_GENTYPE y);
|
||||
@@ -1,2 +0,0 @@
|
||||
#define __CLC_BODY <clc/integer/rhadd.inc>
|
||||
#include <clc/integer/gentype.inc>
|
||||
@@ -1 +0,0 @@
|
||||
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE rhadd(__CLC_GENTYPE x, __CLC_GENTYPE y);
|
||||
@@ -1,2 +0,0 @@
|
||||
#define __CLC_BODY <clc/integer/rotate.inc>
|
||||
#include <clc/integer/gentype.inc>
|
||||
@@ -1 +0,0 @@
|
||||
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE rotate(__CLC_GENTYPE x, __CLC_GENTYPE y);
|
||||
@@ -1,2 +0,0 @@
|
||||
#define __CLC_BODY <clc/integer/sub_sat.inc>
|
||||
#include <clc/integer/gentype.inc>
|
||||
@@ -1 +0,0 @@
|
||||
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE sub_sat(__CLC_GENTYPE x, __CLC_GENTYPE y);
|
||||
@@ -1,25 +0,0 @@
|
||||
#define __CLC_UPSAMPLE_DECL(BGENTYPE, GENTYPE, UGENTYPE) \
|
||||
_CLC_OVERLOAD _CLC_DECL BGENTYPE upsample(GENTYPE hi, UGENTYPE lo);
|
||||
|
||||
#define __CLC_UPSAMPLE_VEC(BGENTYPE, GENTYPE, UGENTYPE) \
|
||||
__CLC_UPSAMPLE_DECL(BGENTYPE, GENTYPE, UGENTYPE) \
|
||||
__CLC_UPSAMPLE_DECL(BGENTYPE##2, GENTYPE##2, UGENTYPE##2) \
|
||||
__CLC_UPSAMPLE_DECL(BGENTYPE##3, GENTYPE##3, UGENTYPE##3) \
|
||||
__CLC_UPSAMPLE_DECL(BGENTYPE##4, GENTYPE##4, UGENTYPE##4) \
|
||||
__CLC_UPSAMPLE_DECL(BGENTYPE##8, GENTYPE##8, UGENTYPE##8) \
|
||||
__CLC_UPSAMPLE_DECL(BGENTYPE##16, GENTYPE##16, UGENTYPE##16) \
|
||||
|
||||
#define __CLC_UPSAMPLE_TYPES() \
|
||||
__CLC_UPSAMPLE_VEC(short, char, uchar) \
|
||||
__CLC_UPSAMPLE_VEC(ushort, uchar, uchar) \
|
||||
__CLC_UPSAMPLE_VEC(int, short, ushort) \
|
||||
__CLC_UPSAMPLE_VEC(uint, ushort, ushort) \
|
||||
__CLC_UPSAMPLE_VEC(long, int, uint) \
|
||||
__CLC_UPSAMPLE_VEC(ulong, uint, uint) \
|
||||
|
||||
__CLC_UPSAMPLE_TYPES()
|
||||
|
||||
#undef __CLC_UPSAMPLE_TYPES
|
||||
#undef __CLC_UPSAMPLE_DECL
|
||||
#undef __CLC_UPSAMPLE_VEC
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE __CLC_FUNCTION(__CLC_GENTYPE a, __CLC_GENTYPE b);
|
||||
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE __CLC_FUNCTION(__CLC_GENTYPE a, float b);
|
||||
|
||||
#ifdef cl_khr_fp64
|
||||
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE __CLC_FUNCTION(__CLC_GENTYPE a, double b);
|
||||
#endif
|
||||
@@ -1,18 +0,0 @@
|
||||
_CLC_OVERLOAD float __CLC_FUNCTION(float, float) __asm(__CLC_INTRINSIC ".f32");
|
||||
_CLC_OVERLOAD float2 __CLC_FUNCTION(float2, float2) __asm(__CLC_INTRINSIC ".v2f32");
|
||||
_CLC_OVERLOAD float3 __CLC_FUNCTION(float3, float3) __asm(__CLC_INTRINSIC ".v3f32");
|
||||
_CLC_OVERLOAD float4 __CLC_FUNCTION(float4, float4) __asm(__CLC_INTRINSIC ".v4f32");
|
||||
_CLC_OVERLOAD float8 __CLC_FUNCTION(float8, float8) __asm(__CLC_INTRINSIC ".v8f32");
|
||||
_CLC_OVERLOAD float16 __CLC_FUNCTION(float16, float16) __asm(__CLC_INTRINSIC ".v16f32");
|
||||
|
||||
#ifdef cl_khr_fp64
|
||||
_CLC_OVERLOAD double __CLC_FUNCTION(double, double) __asm(__CLC_INTRINSIC ".f64");
|
||||
_CLC_OVERLOAD double2 __CLC_FUNCTION(double2, double2) __asm(__CLC_INTRINSIC ".v2f64");
|
||||
_CLC_OVERLOAD double3 __CLC_FUNCTION(double3, double3) __asm(__CLC_INTRINSIC ".v3f64");
|
||||
_CLC_OVERLOAD double4 __CLC_FUNCTION(double4, double4) __asm(__CLC_INTRINSIC ".v4f64");
|
||||
_CLC_OVERLOAD double8 __CLC_FUNCTION(double8, double8) __asm(__CLC_INTRINSIC ".v8f64");
|
||||
_CLC_OVERLOAD double16 __CLC_FUNCTION(double16, double16) __asm(__CLC_INTRINSIC ".v16f64");
|
||||
#endif
|
||||
|
||||
#undef __CLC_FUNCTION
|
||||
#undef __CLC_INTRINSIC
|
||||
@@ -1,6 +0,0 @@
|
||||
#undef ceil
|
||||
#define ceil __clc_ceil
|
||||
|
||||
#define __CLC_FUNCTION __clc_ceil
|
||||
#define __CLC_INTRINSIC "llvm.ceil"
|
||||
#include <clc/math/unary_intrin.inc>
|
||||
@@ -1,11 +0,0 @@
|
||||
#define __CLC_BODY <clc/math/binary_decl.inc>
|
||||
|
||||
#define __CLC_FUNCTION nextafter
|
||||
#include <clc/math/gentype.inc>
|
||||
#undef __CLC_FUNCTION
|
||||
|
||||
#define __CLC_FUNCTION __clc_nextafter
|
||||
#include <clc/math/gentype.inc>
|
||||
#undef __CLC_FUNCTION
|
||||
|
||||
#undef __CLC_BODY
|
||||
@@ -1,6 +0,0 @@
|
||||
#undef cos
|
||||
#define cos __clc_cos
|
||||
|
||||
#define __CLC_FUNCTION __clc_cos
|
||||
#define __CLC_INTRINSIC "llvm.cos"
|
||||
#include <clc/math/unary_intrin.inc>
|
||||
@@ -1,4 +0,0 @@
|
||||
#undef exp
|
||||
|
||||
// exp(x) = exp2(x * log2(e)
|
||||
#define exp(val) (__clc_exp2((val) * 1.44269504f))
|
||||
@@ -1,6 +0,0 @@
|
||||
#undef exp2
|
||||
#define exp2 __clc_exp2
|
||||
|
||||
#define __CLC_FUNCTION __clc_exp2
|
||||
#define __CLC_INTRINSIC "llvm.exp2"
|
||||
#include <clc/math/unary_intrin.inc>
|
||||
@@ -1,6 +0,0 @@
|
||||
#undef fabs
|
||||
#define fabs __clc_fabs
|
||||
|
||||
#define __CLC_FUNCTION __clc_fabs
|
||||
#define __CLC_INTRINSIC "llvm.fabs"
|
||||
#include <clc/math/unary_intrin.inc>
|
||||
@@ -1,6 +0,0 @@
|
||||
#undef floor
|
||||
#define floor __clc_floor
|
||||
|
||||
#define __CLC_FUNCTION __clc_floor
|
||||
#define __CLC_INTRINSIC "llvm.floor"
|
||||
#include <clc/math/unary_intrin.inc>
|
||||
@@ -1,6 +0,0 @@
|
||||
#undef fma
|
||||
#define fma __clc_fma
|
||||
|
||||
#define __CLC_FUNCTION __clc_fma
|
||||
#define __CLC_INTRINSIC "llvm.fma"
|
||||
#include <clc/math/ternary_intrin.inc>
|
||||
@@ -1,11 +0,0 @@
|
||||
#undef fmax
|
||||
#define fmax __clc_fmax
|
||||
|
||||
#define __CLC_BODY <clc/math/binary_decl.inc>
|
||||
#define __CLC_FUNCTION __clc_fmax
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef __CLC_BODY
|
||||
#undef __CLC_FUNCTION
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user