Compare commits

...

33 Commits

Author SHA1 Message Date
Bill Wendling
ddfbfaaca6 Merging r155984:
------------------------------------------------------------------------
r155984 | void | 2012-05-02 02:59:45 -0700 (Wed, 02 May 2012) | 4 lines

The value held in the vector may be RAUW'ed by some of the canonicalization
methods. Use a weak value handle to keep up with this.
PR12245

------------------------------------------------------------------------

llvm-svn: 155985
2012-05-02 10:00:50 +00:00
Bill Wendling
385fbc17e3 Merging r155954:
------------------------------------------------------------------------
r155954 | void | 2012-05-01 15:50:45 -0700 (Tue, 01 May 2012) | 3 lines

Strip the pointer casts off of allocas so that the selection DAG can find them.
PR10799

------------------------------------------------------------------------

llvm-svn: 155955
2012-05-01 22:51:49 +00:00
Bill Wendling
3ff7fb0fad Merging r155278:
------------------------------------------------------------------------
r155278 | chapuni | 2012-04-21 02:39:58 -0700 (Sat, 21 Apr 2012) | 3 lines

clang/test/Rewriter/rewrite-modern-extern-c-func-decl.mm: Mark as XFAIL:mingw for now, due to predefined __declspec.

It could be tweaked to add -triple i686-win32, though.
------------------------------------------------------------------------

llvm-svn: 155934
2012-05-01 20:21:01 +00:00
Bill Wendling
0b1d24671c Merging r155902:
------------------------------------------------------------------------
r155902 | void | 2012-05-01 01:27:43 -0700 (Tue, 01 May 2012) | 7 lines

Change the PassManager from a reference to a pointer.

The TargetPassManager's default constructor wants to initialize the PassManager
to 'null'. But it's illegal to bind a null reference to a null l-value. Make the
ivar a pointer instead.
PR12468

------------------------------------------------------------------------

llvm-svn: 155903
2012-05-01 08:28:53 +00:00
Bill Wendling
26951d3d04 Merging r155895:
------------------------------------------------------------------------
r155895 | eliben | 2012-04-30 23:15:40 -0700 (Mon, 30 Apr 2012) | 4 lines

Removed examples of stack frame inspection which no longer work for old JIT.
Added an example of MCJIT-based debugging.


------------------------------------------------------------------------

llvm-svn: 155901
2012-05-01 07:58:54 +00:00
Bill Wendling
496c30e19e Merging r155844:
------------------------------------------------------------------------
r155844 | spop | 2012-04-30 13:06:58 -0700 (Mon, 30 Apr 2012) | 8 lines

fix typo

Thanks to "Gabor Greif" <ggreif@gmail.com> for reporting this problem.

The configure flag should be --with-default-sysroot as documented, and
not --with-sysroot.  The reason we don't want to define --with-sysroot
is that GCC has a configure flag by that name and it has a different
semantics.
------------------------------------------------------------------------

llvm-svn: 155852
2012-04-30 22:36:07 +00:00
Bill Wendling
7a8da6c1bd Rename to match coding conventions.
llvm-svn: 155834
2012-04-30 17:58:59 +00:00
Bill Wendling
63ee36b8ca Merging r155817:
------------------------------------------------------------------------
r155817 | void | 2012-04-30 03:44:54 -0700 (Mon, 30 Apr 2012) | 9 lines

Second attempt at PR12573:

Allow the "SplitCriticalEdge" function to split the edge to a landing pad. If
the pass is *sure* that it thinks it knows what it's doing, then it may go ahead
and specify that the landing pad can have its critical edge split. The loop
unswitch pass is one of these passes. It will split the critical edges of all
edges coming from a loop to a landing pad not within the loop. Doing so will
retain important loop analysis information, such as loop simplify.

------------------------------------------------------------------------

llvm-svn: 155833
2012-04-30 17:48:14 +00:00
Bill Wendling
0ac87694b7 Merging r155813:
------------------------------------------------------------------------
r155813 | void | 2012-04-30 02:23:48 -0700 (Mon, 30 Apr 2012) | 1 line

Remove hack from r154987. The problem persists even with it, so it's not even a good hack.
------------------------------------------------------------------------

llvm-svn: 155831
2012-04-30 17:41:42 +00:00
Bill Wendling
9c81b57cff Merging r155166:
------------------------------------------------------------------------
r155166 | void | 2012-04-19 16:31:07 -0700 (Thu, 19 Apr 2012) | 1 line

Put this expensive check below the less expensive ones.
------------------------------------------------------------------------

llvm-svn: 155830
2012-04-30 17:40:59 +00:00
Bill Wendling
ee386407f0 Merging r155809:
------------------------------------------------------------------------
r155809 | rafael | 2012-04-29 20:53:06 -0700 (Sun, 29 Apr 2012) | 2 lines

Make sure HoistInsertPosition finds a position that is dominated by all
inputs.
------------------------------------------------------------------------

llvm-svn: 155828
2012-04-30 17:12:42 +00:00
Bill Wendling
e8a900fc8c Merging r155818:
------------------------------------------------------------------------
r155818 | baldrick | 2012-04-30 04:56:58 -0700 (Mon, 30 Apr 2012) | 3 lines

Just mark the sign bit as known zero, rather than any other irrelevant bits
known zero in the LHS.  Fixes PR12541.

------------------------------------------------------------------------

llvm-svn: 155827
2012-04-30 17:09:46 +00:00
Bill Wendling
2fe446131c Merging r155728:
------------------------------------------------------------------------
r155728 | rsmith | 2012-04-27 12:33:05 -0700 (Fri, 27 Apr 2012) | 4 lines

PR12224 (sort of): Diagnose inheriting constructor declarations in C++11 mode.
We do not support IRGen for these, and get some parts of the semantic analysis
wrong.

------------------------------------------------------------------------

llvm-svn: 155731
2012-04-27 20:15:25 +00:00
Bill Wendling
5f15b4e8a3 Merging r155668:
------------------------------------------------------------------------
r155668 | atrick | 2012-04-26 14:48:25 -0700 (Thu, 26 Apr 2012) | 8 lines

Fix the SD scheduler to avoid gluing the same node twice.

DAGCombine strangeness may result in multiple loads from the same
offset. They both may try to glue themselves to another load. We could
insist that the redundant loads glue themselves to each other, but the
beter fix is to bail out from bad gluing at the time we detect it.

Fixes rdar://11314175: BuildSchedUnits assert.
------------------------------------------------------------------------

llvm-svn: 155672
2012-04-26 23:04:56 +00:00
Bill Wendling
988b10e319 Merging r155670:
------------------------------------------------------------------------
r155670 | efriedma | 2012-04-26 15:43:24 -0700 (Thu, 26 Apr 2012) | 3 lines

Add a missing ExpressionEvaluationContext for template default arguments.  Fixes PR12581.


------------------------------------------------------------------------

llvm-svn: 155671
2012-04-26 23:03:48 +00:00
Bill Wendling
584eaadb4a Merging r155576:
------------------------------------------------------------------------
r155576 | akirtzidis | 2012-04-25 11:39:17 -0700 (Wed, 25 Apr 2012) | 4 lines

When resolving default template arguments, it should be done in the declaration context
of the template what we are going to instantiate.

Fixes various crashes of rdar://11242625 & http://llvm.org/PR11421.
------------------------------------------------------------------------

llvm-svn: 155582
2012-04-25 20:21:37 +00:00
Bill Wendling
ea5f85ee5a Merging r155536:
------------------------------------------------------------------------
r155536 | lattner | 2012-04-24 23:37:20 -0700 (Tue, 24 Apr 2012) | 3 lines

openbsd doesn't support soname, patch by Brad Smith!


------------------------------------------------------------------------

llvm-svn: 155574
2012-04-25 18:27:12 +00:00
Bill Wendling
f242e2386e Merging r155535:
------------------------------------------------------------------------
r155535 | lattner | 2012-04-24 23:12:24 -0700 (Tue, 24 Apr 2012) | 5 lines

OpenBSD: Remove incorrect -pthread preprocessor define _POSIX_THREADS and replace
with _REENTRANT. Also remove undef _POSIX_THREADS in phread.h.

Patch by Brad Smith!

------------------------------------------------------------------------

llvm-svn: 155573
2012-04-25 18:26:22 +00:00
Bill Wendling
67cd5deeec Merging r155534:
------------------------------------------------------------------------
r155534 | lattner | 2012-04-24 23:09:30 -0700 (Tue, 24 Apr 2012) | 3 lines

don't use soname on OpenBSD, it doesn't support it.  Patch by
Brad Smith!

------------------------------------------------------------------------

llvm-svn: 155572
2012-04-25 18:26:01 +00:00
Bill Wendling
181a72c0c3 Merging r155466:
------------------------------------------------------------------------
r155466 | chandlerc | 2012-04-24 11:42:47 -0700 (Tue, 24 Apr 2012) | 17 lines

Fix a crash on valid (if UB) bitcode that is produced for some global
constants in C++11 mode. I have no idea why it required such particular
circumstances to get here, the code seems clearly to rely upon unchecked
assumptions.

Specifically, when we decide to form an index into a struct type, we may
have gone through (at least one) zero-length array indexing round, which
would have left the offset un-adjusted, and thus not necessarily valid
for use when indexing the struct type.

This is just an canonicalization step, so the correct thing is to refuse
to canonicalize nonsensical GEPs of this form. Implemented, and test
case added.

Fixes PR12642. Pair debugged and coded with Richard Smith. =] I credit
him with most of the debugging, and preventing me from writing the wrong
code.
------------------------------------------------------------------------

llvm-svn: 155506
2012-04-24 23:40:05 +00:00
Bill Wendling
98eaa4638a Merging r155287:
------------------------------------------------------------------------
r155287 | chapuni | 2012-04-21 08:31:45 -0700 (Sat, 21 Apr 2012) | 3 lines

llvm/lib/Target: [PR12611] Add "llvm/Support/raw_ostream.h" for Debug build on MSVC.

Thanks to Andy Gibbs, to report the issue.
------------------------------------------------------------------------

llvm-svn: 155378
2012-04-23 18:34:50 +00:00
Bill Wendling
483a943c5f Merging r155286:
------------------------------------------------------------------------
r155286 | chapuni | 2012-04-21 08:31:36 -0700 (Sat, 21 Apr 2012) | 1 line

HexagonISelLowering.cpp: Reorder #includes.
------------------------------------------------------------------------

llvm-svn: 155377
2012-04-23 18:34:22 +00:00
Bill Wendling
047e6ff259 Merging r155342:
------------------------------------------------------------------------
r155342 | asl | 2012-04-23 02:02:13 -0700 (Mon, 23 Apr 2012) | 3 lines

Do not use stdint.h, driver might provide invalid location for it. Instead, provide the types directly.
This should fix PR12628

------------------------------------------------------------------------

llvm-svn: 155376
2012-04-23 18:33:49 +00:00
Bill Wendling
2cd7132e15 Merging r155288:
------------------------------------------------------------------------
r155288 | d0k | 2012-04-21 09:05:27 -0700 (Sat, 21 Apr 2012) | 6 lines

Remove unused PointerLikeTypeTraits for IndexListEntry.

It set NumLowBitAvailable = 3 which may not be true on all platforms.  We only
ever use 2 bits (the default) so this assumption can be safely removed

Should fix PR12612.
------------------------------------------------------------------------

llvm-svn: 155375
2012-04-23 18:33:11 +00:00
Bill Wendling
8234137390 Merging r155342:
------------------------------------------------------------------------

llvm-svn: 155374
2012-04-23 18:32:40 +00:00
Bill Wendling
8d6eb8e521 Merging r155285:
------------------------------------------------------------------------
r155285 | chapuni | 2012-04-21 07:51:02 -0700 (Sat, 21 Apr 2012) | 1 line

CMake: Enable LLVM_COMPILER_JOBS on all MS IDEs. We don't support older environments than VS9.
------------------------------------------------------------------------

llvm-svn: 155335
2012-04-23 06:46:30 +00:00
Bill Wendling
30f2ef3799 Merging r155284:
------------------------------------------------------------------------
r155284 | chapuni | 2012-04-21 07:50:56 -0700 (Sat, 21 Apr 2012) | 1 line

CMake: Prune redundant LLVM_COMPILER_JOBS from llvm/CMakeLists.txt. HandleLLVMOptions.cmake has it.
------------------------------------------------------------------------

llvm-svn: 155334
2012-04-23 06:45:46 +00:00
Bill Wendling
4ea5fe07cb Merging r155307:
------------------------------------------------------------------------
r155307 | void | 2012-04-22 00:23:04 -0700 (Sun, 22 Apr 2012) | 1 line

Remove some potential warnings about variables used uninitialized.
------------------------------------------------------------------------

llvm-svn: 155308
2012-04-22 07:23:44 +00:00
Bill Wendling
d5920bc1c3 Inline a variable that's used only in an assert.
llvm-svn: 155306
2012-04-22 07:16:56 +00:00
Bill Wendling
2878161153 Merging r155279:
------------------------------------------------------------------------
r155279 | chapuni | 2012-04-21 02:40:04 -0700 (Sat, 21 Apr 2012) | 1 line

SemaDeclCXX.cpp: Fix utf8 in comment.
------------------------------------------------------------------------

llvm-svn: 155295
2012-04-21 19:24:29 +00:00
Bill Wendling
6f8e540382 Merging r155230:
------------------------------------------------------------------------
r155230 | void | 2012-04-20 13:31:44 -0700 (Fri, 20 Apr 2012) | 1 line

Modify the sh-bang to run out-of-the-box for FreeBSDes.
------------------------------------------------------------------------

llvm-svn: 155231
2012-04-20 20:32:47 +00:00
Bill Wendling
b4b499b7ab Merging r155076:
------------------------------------------------------------------------
r155076 | rsmith | 2012-04-18 17:08:28 -0700 (Wed, 18 Apr 2012) | 6 lines

PR 12586: Fix assert while running libc++ testsuite: deal with exception
specifications on member function templates of class templates and other such
nested beasties. Store the function template from which we are to instantiate
an exception specification rather than trying to deduce it. Plus some
additional test cases.

------------------------------------------------------------------------

llvm-svn: 155079
2012-04-19 00:17:28 +00:00
Bill Wendling
392e4fbdd9 Creating release_31 branch
llvm-svn: 155059
llvm-svn: 155053
llvm-svn: 155051
2012-04-18 21:39:23 +00:00
7335 changed files with 758 additions and 1070288 deletions

View File

@@ -2701,7 +2701,8 @@ public:
ExtProtoInfo() :
Variadic(false), HasTrailingReturn(false), TypeQuals(0),
ExceptionSpecType(EST_None), RefQualifier(RQ_None),
NumExceptions(0), Exceptions(0), NoexceptExpr(0), ExceptionSpecDecl(0),
NumExceptions(0), Exceptions(0), NoexceptExpr(0),
ExceptionSpecDecl(0), ExceptionSpecTemplate(0),
ConsumedArguments(0) {}
FunctionType::ExtInfo ExtInfo;
@@ -2714,6 +2715,7 @@ public:
const QualType *Exceptions;
Expr *NoexceptExpr;
FunctionDecl *ExceptionSpecDecl;
FunctionDecl *ExceptionSpecTemplate;
const bool *ConsumedArguments;
};
@@ -2759,9 +2761,10 @@ private:
// NoexceptExpr - Instead of Exceptions, there may be a single Expr* pointing
// to the expression in the noexcept() specifier.
// ExceptionSpecDecl - Instead of Exceptions, there may be a single
// FunctionDecl* pointing to the function which should be used to resolve
// this function type's exception specification.
// ExceptionSpecDecl, ExceptionSpecTemplate - Instead of Exceptions, there may
// be a pair of FunctionDecl* pointing to the function which should be used to
// instantiate this function type's exception specification, and the function
// from which it should be instantiated.
// ConsumedArgs - A variable size array, following Exceptions
// and of length NumArgs, holding flags indicating which arguments
@@ -2804,6 +2807,7 @@ public:
EPI.NoexceptExpr = getNoexceptExpr();
} else if (EPI.ExceptionSpecType == EST_Uninstantiated) {
EPI.ExceptionSpecDecl = getExceptionSpecDecl();
EPI.ExceptionSpecTemplate = getExceptionSpecTemplate();
}
if (hasAnyConsumedArgs())
EPI.ConsumedArguments = getConsumedArgsBuffer();
@@ -2847,10 +2851,22 @@ public:
// NoexceptExpr sits where the arguments end.
return *reinterpret_cast<Expr *const *>(arg_type_end());
}
/// \brief If this function type has an uninstantiated exception
/// specification, this is the function whose exception specification
/// is represented by this type.
FunctionDecl *getExceptionSpecDecl() const {
if (getExceptionSpecType() != EST_Uninstantiated)
return 0;
return *reinterpret_cast<FunctionDecl * const *>(arg_type_end());
return reinterpret_cast<FunctionDecl * const *>(arg_type_end())[0];
}
/// \brief If this function type has an uninstantiated exception
/// specification, this is the function whose exception specification
/// should be instantiated to find the exception specification for
/// this type.
FunctionDecl *getExceptionSpecTemplate() const {
if (getExceptionSpecType() != EST_Uninstantiated)
return 0;
return reinterpret_cast<FunctionDecl * const *>(arg_type_end())[1];
}
bool isNothrow(ASTContext &Ctx) const {
ExceptionSpecificationType EST = getExceptionSpecType();

View File

@@ -231,9 +231,13 @@ def err_using_decl_can_not_refer_to_namespace : Error<
"using declaration can not refer to namespace">;
def err_using_decl_constructor : Error<
"using declaration can not refer to a constructor">;
def warn_cxx98_compat_using_decl_constructor : Warning<
"inherited constructors are incompatible with C++98">,
InGroup<CXX98Compat>, DefaultIgnore;
def err_using_decl_constructor_unsupported : Error<
"inheriting constructors are not supported">;
// FIXME: Replace the above error with this warning if support for
// inheriting constructors is implemented.
//def warn_cxx98_compat_using_decl_constructor : Warning<
// "inheriting constructors are incompatible with C++98">,
// InGroup<CXX98Compat>, DefaultIgnore;
def err_using_decl_destructor : Error<
"using declaration can not refer to a destructor">;
def err_using_decl_template_id : Error<

View File

@@ -2195,7 +2195,7 @@ ASTContext::getFunctionType(QualType ResultTy,
else if (EPI.ExceptionSpecType == EST_ComputedNoexcept) {
Size += sizeof(Expr*);
} else if (EPI.ExceptionSpecType == EST_Uninstantiated) {
Size += sizeof(FunctionDecl*);
Size += 2 * sizeof(FunctionDecl*);
}
if (EPI.ConsumedArguments)
Size += NumArgs * sizeof(bool);

View File

@@ -1550,7 +1550,8 @@ FunctionProtoType::FunctionProtoType(QualType result, const QualType *args,
// Store the function decl from which we will resolve our
// exception specification.
FunctionDecl **slot = reinterpret_cast<FunctionDecl**>(argSlot + numArgs);
*slot = epi.ExceptionSpecDecl;
slot[0] = epi.ExceptionSpecDecl;
slot[1] = epi.ExceptionSpecTemplate;
// This exception specification doesn't make the type dependent, because
// it's not instantiated as part of instantiating the type.
}

View File

@@ -365,7 +365,7 @@ protected:
DefineStd(Builder, "unix", Opts);
Builder.defineMacro("__ELF__");
if (Opts.POSIXThreads)
Builder.defineMacro("_POSIX_THREADS");
Builder.defineMacro("_REENTRANT");
}
public:
OpenBSDTargetInfo(const std::string &triple)

View File

@@ -652,6 +652,7 @@ Parser::ParseNonTypeTemplateParameter(unsigned Depth, unsigned Position) {
// end of the template-parameter-list rather than a greater-than
// operator.
GreaterThanIsOperatorScope G(GreaterThanIsOperator, false);
EnterExpressionEvaluationContext Unevaluated(Actions, Sema::Unevaluated);
DefaultArg = ParseAssignmentExpression();
if (DefaultArg.isInvalid())

View File

@@ -5925,10 +5925,12 @@ Decl *Sema::ActOnUsingDeclaration(Scope *S,
case UnqualifiedId::IK_ConstructorName:
case UnqualifiedId::IK_ConstructorTemplateId:
// C++0x inherited constructors.
// C++11 inheriting constructors.
Diag(Name.getLocStart(),
getLangOpts().CPlusPlus0x ?
diag::warn_cxx98_compat_using_decl_constructor :
// FIXME: Produce warn_cxx98_compat_using_decl_constructor
// instead once inheriting constructors work.
diag::err_using_decl_constructor_unsupported :
diag::err_using_decl_constructor)
<< SS.getRange();
@@ -11091,7 +11093,7 @@ bool Sema::checkThisInStaticMemberFunctionType(CXXMethodDecl *Method) {
// static member function (although its type and value category are defined
// within a static member function as they are within a non-static member
// function). [ Note: this is because declaration matching does not occur
// until the complete declarator is known. end note ]
// until the complete declarator is known. - end note ]
const FunctionProtoType *Proto = ProtoTL->getTypePtr();
FindCXXThisExpr Finder(*this);

View File

@@ -9776,9 +9776,8 @@ void Sema::MarkFunctionReferenced(SourceLocation Loc, FunctionDecl *Func) {
// Instantiate the exception specification for any function which is
// used: CodeGen will need it.
if (Func->getTemplateInstantiationPattern() &&
Func->getType()->castAs<FunctionProtoType>()->getExceptionSpecType()
== EST_Uninstantiated)
const FunctionProtoType *FPT = Func->getType()->getAs<FunctionProtoType>();
if (FPT && FPT->getExceptionSpecType() == EST_Uninstantiated)
InstantiateExceptionSpec(Loc, Func);
// Implicit instantiation of function templates and member functions of

View File

@@ -2496,6 +2496,7 @@ SubstDefaultTemplateArgument(Sema &SemaRef,
Converted.size(),
SourceRange(TemplateLoc, RAngleLoc));
Sema::ContextRAII SavedContext(SemaRef, Template->getDeclContext());
ArgType = SemaRef.SubstType(ArgType, AllTemplateArgs,
Param->getDefaultArgumentLoc(),
Param->getDeclName());
@@ -2544,6 +2545,8 @@ SubstDefaultTemplateArgument(Sema &SemaRef,
Converted.size(),
SourceRange(TemplateLoc, RAngleLoc));
Sema::ContextRAII SavedContext(SemaRef, Template->getDeclContext());
EnterExpressionEvaluationContext Unevaluated(SemaRef, Sema::Unevaluated);
return SemaRef.SubstExpr(Param->getDefaultArgument(), AllTemplateArgs);
}
@@ -2591,6 +2594,7 @@ SubstDefaultTemplateArgument(Sema &SemaRef,
Converted.size(),
SourceRange(TemplateLoc, RAngleLoc));
Sema::ContextRAII SavedContext(SemaRef, Template->getDeclContext());
// Substitute into the nested-name-specifier first,
QualifierLoc = Param->getDefaultArgument().getTemplateQualifierLoc();
if (QualifierLoc) {

View File

@@ -2251,6 +2251,8 @@ static void addInstantiatedParametersToScope(Sema &S, FunctionDecl *Function,
static void InstantiateExceptionSpec(Sema &SemaRef, FunctionDecl *New,
const FunctionProtoType *Proto,
const MultiLevelTemplateArgumentList &TemplateArgs) {
assert(Proto->getExceptionSpecType() != EST_Uninstantiated);
// C++11 [expr.prim.general]p3:
// If a declaration declares a member function or member function
// template of a class X, the expression this is a prvalue of type
@@ -2377,20 +2379,8 @@ static void InstantiateExceptionSpec(Sema &SemaRef, FunctionDecl *New,
void Sema::InstantiateExceptionSpec(SourceLocation PointOfInstantiation,
FunctionDecl *Decl) {
// Find the template declaration which contains the exception specification.
// Per [except.spec]p4, prefer the exception spec on the primary template
// if this is an explicit instantiation.
FunctionDecl *Tmpl = 0;
if (Decl->getPrimaryTemplate())
Tmpl = Decl->getPrimaryTemplate()->getTemplatedDecl();
else if (FunctionDecl *MemTmpl = Decl->getInstantiatedFromMemberFunction())
Tmpl = MemTmpl;
else
Tmpl = Decl->getTemplateInstantiationPattern();
assert(Tmpl && "can't instantiate non-template");
if (Decl->getType()->castAs<FunctionProtoType>()->getExceptionSpecType()
!= EST_Uninstantiated)
const FunctionProtoType *Proto = Decl->getType()->castAs<FunctionProtoType>();
if (Proto->getExceptionSpecType() != EST_Uninstantiated)
return;
InstantiatingTemplate Inst(*this, PointOfInstantiation, Decl,
@@ -2406,10 +2396,12 @@ void Sema::InstantiateExceptionSpec(SourceLocation PointOfInstantiation,
MultiLevelTemplateArgumentList TemplateArgs =
getTemplateInstantiationArgs(Decl, 0, /*RelativeToPrimary*/true);
addInstantiatedParametersToScope(*this, Decl, Tmpl, Scope, TemplateArgs);
FunctionDecl *Template = Proto->getExceptionSpecTemplate();
addInstantiatedParametersToScope(*this, Decl, Template, Scope, TemplateArgs);
const FunctionProtoType *Proto = Tmpl->getType()->castAs<FunctionProtoType>();
::InstantiateExceptionSpec(*this, Decl, Proto, TemplateArgs);
::InstantiateExceptionSpec(*this, Decl,
Template->getType()->castAs<FunctionProtoType>(),
TemplateArgs);
}
/// \brief Initializes the common fields of an instantiation function
@@ -2457,6 +2449,10 @@ TemplateDeclInstantiator::InitFunctionInstantiation(FunctionDecl *New,
EPI.ExceptionSpecType != EST_None &&
EPI.ExceptionSpecType != EST_DynamicNone &&
EPI.ExceptionSpecType != EST_BasicNoexcept) {
FunctionDecl *ExceptionSpecTemplate = Tmpl;
if (EPI.ExceptionSpecType == EST_Uninstantiated)
ExceptionSpecTemplate = EPI.ExceptionSpecTemplate;
// Mark the function has having an uninstantiated exception specification.
const FunctionProtoType *NewProto
= New->getType()->getAs<FunctionProtoType>();
@@ -2464,6 +2460,7 @@ TemplateDeclInstantiator::InitFunctionInstantiation(FunctionDecl *New,
EPI = NewProto->getExtProtoInfo();
EPI.ExceptionSpecType = EST_Uninstantiated;
EPI.ExceptionSpecDecl = New;
EPI.ExceptionSpecTemplate = ExceptionSpecTemplate;
New->setType(SemaRef.Context.getFunctionType(NewProto->getResultType(),
NewProto->arg_type_begin(),
NewProto->getNumArgs(),

View File

@@ -9,15 +9,15 @@ struct B1 {
B1(int);
};
using B1::B1; // expected-error {{using declaration can not refer to class member}}
using B1::B1; // expected-error {{using declaration can not refer to class member}} expected-error {{not supported}}
// C++0x [namespace.udecl]p10:
// A using-declaration is a declaration and can therefore be used repeatedly
// where (and only where) multiple declarations are allowed.
struct I1 : B1 {
using B1::B1; // expected-note {{previous using declaration}}
using B1::B1; // expected-error {{redeclaration of using decl}}
using B1::B1; // expected-note {{previous using declaration}} expected-error {{not supported}}
using B1::B1; // expected-error {{redeclaration of using decl}} expected-error {{not supported}}
};
// C++0x [namespace.udecl]p3:
@@ -27,31 +27,31 @@ struct I1 : B1 {
// shall name a direct base class of the class being defined.
struct D1 : I1 {
using B1::B1; // expected-error {{'B1' is not a direct base of 'D1', can not inherit constructors}}
using B1::B1; // expected-error {{'B1' is not a direct base of 'D1', can not inherit constructors}} expected-error {{not supported}}
};
template<typename T> struct A {};
template<typename T> struct B : A<bool>, A<char> {
using A<T>::A; // expected-error {{'A<double>::', which is not a base class of 'B<double>'}}
using A<T>::A; // expected-error {{'A<double>::', which is not a base class of 'B<double>'}} expected-error {{not supported}}
};
B<bool> bb;
B<char> bc;
B<double> bd; // expected-note {{here}}
template<typename T> struct C : A<T> {
using A<bool>::A; // expected-error {{'A<bool>::', which is not a base class of 'C<char>'}}
using A<bool>::A; // expected-error {{'A<bool>::', which is not a base class of 'C<char>'}} expected-error {{not supported}}
};
C<bool> cb;
C<char> cc; // expected-note {{here}}
template<typename T> struct D : A<T> {};
template<typename T> struct E : D<T> {
using A<bool>::A; // expected-error {{'A<bool>' is not a direct base of 'E<bool>', can not inherit}}
using A<bool>::A; // expected-error {{'A<bool>' is not a direct base of 'E<bool>', can not inherit}} expected-error {{not supported}}
};
E<bool> eb; // expected-note {{here}}
template<typename T> struct F : D<bool> {
using A<T>::A; // expected-error {{'A<bool>' is not a direct base of 'F<bool>'}}
using A<T>::A; // expected-error {{'A<bool>' is not a direct base of 'F<bool>'}} expected-error {{not supported}}
};
F<bool> fb; // expected-note {{here}}

View File

@@ -5,7 +5,7 @@ struct B1 {
B1(int, int);
};
struct D1 : B1 {
using B1::B1;
using B1::B1; // expected-error {{not supported}}
};
D1 d1a(1), d1b(1, 1);
@@ -15,7 +15,7 @@ struct B2 {
explicit B2(int, int = 0, int = 0);
};
struct D2 : B2 { // expected-note 2 {{candidate constructor}}
using B2::B2;
using B2::B2; // expected-error {{not supported}}
};
D2 d2a(1), d2b(1, 1), d2c(1, 1, 1);
@@ -25,18 +25,18 @@ struct B3 {
B3(void*); // expected-note {{inherited from here}}
};
struct D3 : B3 { // expected-note 2 {{candidate constructor}}
using B3::B3; // expected-note {{candidate constructor (inherited)}}
using B3::B3; // expected-note {{candidate constructor (inherited)}} expected-error {{not supported}}
};
D3 fd3() { return 1; } // expected-error {{no viable conversion}}
template<typename T> struct T1 : B1 {
using B1::B1;
using B1::B1; // expected-error {{not supported}}
};
template<typename T> struct T2 : T1<T> {
using T1<int>::T1;
using T1<int>::T1; // expected-error {{not supported}}
};
template<typename T> struct T3 : T1<int> {
using T1<T>::T1;
using T1<T>::T1; // expected-error {{not supported}}
};
struct U {
friend T1<int>::T1(int);

View File

@@ -8,12 +8,12 @@ struct B2 {
B2(int); // expected-note {{conflicting constructor}}
};
struct D1 : B1, B2 {
using B1::B1; // expected-note {{inherited here}}
using B2::B2; // expected-error {{already inherited constructor with the same signature}}
using B1::B1; // expected-note {{inherited here}} expected-error {{not supported}}
using B2::B2; // expected-error {{already inherited constructor with the same signature}} expected-error {{not supported}}
};
struct D2 : B1, B2 {
using B1::B1;
using B2::B2;
using B1::B1; // expected-error {{not supported}}
using B2::B2; // expected-error {{not supported}}
D2(int);
};
@@ -22,8 +22,8 @@ template<typename T> struct B3 {
};
template<typename T> struct B4 : B3<T>, B1 {
B4();
using B3<T>::B3; // expected-note {{inherited here}}
using B1::B1; // expected-error {{already inherited}}
using B3<T>::B3; // expected-note {{inherited here}} expected-error {{not supported}}
using B1::B1; // expected-error {{already inherited}} expected-error {{not supported}}
};
B4<char> b4c;
B4<int> b4i; // expected-note {{here}}

View File

@@ -1,5 +1,7 @@
// RUN: %clang_cc1 -triple armv7---eabi -target-abi aapcs -mfloat-abi hard -emit-llvm %s -o - | FileCheck %s
#include <stdint.h>
typedef long long int64_t;
typedef unsigned int uint32_t;
/* This is not a homogenous aggregate - fundamental types are different */
typedef union {

View File

@@ -3,9 +3,11 @@
void h();
template<typename T> void f() noexcept(sizeof(T) == 4) { h(); }
template<typename T> void g() noexcept(sizeof(T) == 4);
template<typename T> struct S {
static void f() noexcept(sizeof(T) == 4) { h(); }
static void g() noexcept(sizeof(T) == 4);
};
// CHECK: define {{.*}} @_Z1fIsEvv() {
@@ -30,7 +32,7 @@ template void S<char16_t>::f();
// CHECK: define {{.*}} @_ZN1SIA2_DsE1fEv() nounwind
template void S<char16_t[2]>::f();
void g() {
void h() {
// CHECK: define {{.*}} @_Z1fIiEvv() nounwind {
f<int>();
// CHECK: define {{.*}} @_Z1fIA2_iEvv() {
@@ -64,3 +66,55 @@ void g() {
// CHECK-NOT: nounwind
(void)&S<char>::f;
}
// CHECK: define {{.*}} @_Z1iv
void i() {
// CHECK: declare {{.*}} @_Z1gIiEvv() nounwind
g<int>();
// CHECK: declare {{.*}} @_Z1gIA2_iEvv()
// CHECK-NOT: nounwind
g<int[2]>();
// CHECK: declare {{.*}} @_ZN1SIiE1gEv() nounwind
S<int>::g();
// CHECK: declare {{.*}} @_ZN1SIA2_iE1gEv()
// CHECK-NOT: nounwind
S<int[2]>::g();
// CHECK: declare {{.*}} @_Z1gIfEvv() nounwind
void (*g1)() = &g<float>;
// CHECK: declare {{.*}} @_Z1gIdEvv()
// CHECK-NOT: nounwind
void (*g2)() = &g<double>;
// CHECK: declare {{.*}} @_ZN1SIfE1gEv() nounwind
void (*g3)() = &S<float>::g;
// CHECK: declare {{.*}} @_ZN1SIdE1gEv()
// CHECK-NOT: nounwind
void (*g4)() = &S<double>::g;
// CHECK: declare {{.*}} @_Z1gIA4_cEvv() nounwind
(void)&g<char[4]>;
// CHECK: declare {{.*}} @_Z1gIcEvv()
// CHECK-NOT: nounwind
(void)&g<char>;
// CHECK: declare {{.*}} @_ZN1SIA4_cE1gEv() nounwind
(void)&S<char[4]>::g;
// CHECK: declare {{.*}} @_ZN1SIcE1gEv()
// CHECK-NOT: nounwind
(void)&S<char>::g;
}
template<typename T> struct Nested {
template<bool b, typename U> void f() noexcept(sizeof(T) == sizeof(U));
};
// CHECK: define {{.*}} @_Z1jv
void j() {
// CHECK: declare {{.*}} @_ZN6NestedIiE1fILb1EcEEvv(
// CHECK-NOT: nounwind
Nested<int>().f<true, char>();
// CHECK: declare {{.*}} @_ZN6NestedIlE1fILb0ElEEvv({{.*}}) nounwind
Nested<long>().f<false, long>();
}

View File

@@ -1,5 +1,7 @@
// RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
// XFAIL: *
// PR12219
struct A { A(int); virtual ~A(); };
struct B : A { using A::A; ~B(); };

View File

@@ -2,6 +2,9 @@
// RUN: %clang_cc1 -fsyntax-only -Werror -Wno-address-of-temporary -Wno-attributes -D"Class=void*" -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
// rdar://11131490
// XFAIL: mingw
// FIXME: __declspec(X) is predefined on mingw.
extern "C" __declspec(dllexport) void BreakTheRewriter(void) {
__block int aBlockVariable = 0;
void (^aBlock)(void) = ^ {

View File

@@ -114,12 +114,16 @@ bool no_except_expr = noexcept(1 + 1); // expected-warning {{noexcept expression
void *null = nullptr; // expected-warning {{'nullptr' is incompatible with C++98}}
static_assert(true, "!"); // expected-warning {{static_assert declarations are incompatible with C++98}}
// FIXME: Reintroduce this test if support for inheriting constructors is
// implemented.
#if 0
struct InhCtorBase {
InhCtorBase(int);
};
struct InhCtorDerived : InhCtorBase {
using InhCtorBase::InhCtorBase; // expected-warning {{inherited constructors are incompatible with C++98}}
using InhCtorBase::InhCtorBase; // xpected-warning {{inheriting constructors are incompatible with C++98}}
};
#endif
struct FriendMember {
static void MemberFn();

View File

@@ -292,3 +292,14 @@ namespace PR8401 {
f();
}
}
namespace PR12581 {
const int a = 0;
template < typename > struct A;
template < typename MatrixType, int =
A < MatrixType >::Flags ? : A < MatrixType >::Flags & a > class B;
void
fn1 ()
{
}
}

View File

@@ -292,3 +292,35 @@ namespace PR10187 {
template void f<S>(); // expected-note {{here}}
}
}
namespace rdar11242625 {
template <typename T>
struct Main {
struct default_names {
typedef int id;
};
template <typename T2 = typename default_names::id>
struct TS {
T2 q;
};
};
struct Sub : public Main<int> {
TS<> ff;
};
int arr[sizeof(Sub)];
}
namespace PR11421 {
template < unsigned > struct X {
static const unsigned dimension = 3;
template<unsigned dim=dimension>
struct Y: Y<dim> { }; // expected-error {{incomplete type}} expected-note {{is not complete until the closing}}
};
typedef X<3> X3;
X3::Y<>::iterator it; // expected-note {{requested here}}
}

View File

@@ -1,4 +1,4 @@
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 -ftemplate-depth 16 %s
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 -ftemplate-depth 16 -fcxx-exceptions -fexceptions %s
// DR1330: an exception specification for a function template is only
// instantiated when it is needed.
@@ -31,7 +31,7 @@ decltype(S<0>::recurse()) *pVoid1 = 0; // ok, exception spec not needed
decltype(&S<0>::recurse) pFn = 0; // ok, exception spec not needed
template<> struct S<10> {};
void (*pFn2)() noexcept = &S<0>::recurse; // expected-note {{instantiation of exception spec}}
void (*pFn2)() noexcept = &S<0>::recurse; // expected-note {{instantiation of exception spec}} expected-error {{not superset}}
template<typename T> T go(T a) noexcept(noexcept(go(a))); // \
@@ -118,3 +118,16 @@ namespace pr9485 {
f2(0); // expected-error {{ambiguous}}
}
}
struct Exc1 { char c[4]; };
struct Exc2 { double x, y, z; };
struct Base {
virtual void f() noexcept; // expected-note {{overridden}}
};
template<typename T> struct Derived : Base {
void f() noexcept (sizeof(T) == 4); // expected-error {{is more lax}}
void g() noexcept (T::error);
};
Derived<Exc1> d1; // ok
Derived<Exc2> d2; // expected-note {{in instantiation of}}

View File

@@ -24,7 +24,7 @@ USEDLIBS = clangARCMigrate.a clangRewrite.a clangFrontend.a clangDriver.a \
include $(CLANG_LEVEL)/Makefile
# Add soname to the library.
ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux FreeBSD OpenBSD GNU))
ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux FreeBSD GNU))
LDFLAGS += -Wl,-soname,lib$(LIBRARYNAME)$(SHLIBEXT)
endif

View File

@@ -1,19 +0,0 @@
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 exmaple,
define i32 @f1(i32 %i) nounwind ssp {
; DEBUGGER: break f1
; DEBUGGER: r
; DEBUGGER: p i
; CHECK: $1 = 42
entry:
}
is a testcase where the debuger is asked to break at function 'f1' and
print value of argument 'i'. The expected value of 'i' is 42 in this case.

View File

@@ -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: $1 = (SVal &)
// CHECK: Data = 0x0,
// 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;
}

View File

@@ -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
// XFAIL: *
// XTARGET: 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);
}

View File

@@ -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
// XFAIL: *
// XTARGET: 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;
}

View File

@@ -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;
}

View File

@@ -1,126 +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
; XFAIL: *
; XTARGET: darwin
; Radar 8412415
target triple = "x86_64-apple-darwin10.0.0"
%struct._mtx = type { i64, i32, %struct.anon }
%struct.anon = type { i32, i32 }
define i32 @foobar(%struct._mtx* nocapture %mutex) nounwind readonly noinline ssp {
; DEBUGGER: break foobar
; DEBUGGER: r
; DEBUGGER: info address mutex
; CHECK: Symbol "mutex" is
; CHECK-NEXT:
; CHECK-NEXT: in register
entry:
tail call void @llvm.dbg.value(metadata !{%struct._mtx* %mutex}, i64 0, metadata !8), !dbg !29
tail call void @llvm.dbg.value(metadata !30, i64 0, metadata !21), !dbg !31
tail call void @llvm.dbg.value(metadata !32, i64 0, metadata !23), !dbg !33
tail call void @llvm.dbg.value(metadata !32, i64 0, metadata !24), !dbg !34
br label %do.body1, !dbg !37
do.body1: ; preds = %entry, %do.body1
%0 = phi i32 [ 0, %entry ], [ %inc, %do.body1 ]
%r.1 = phi i32 [ 1, %entry ], [ %r.0, %do.body1 ]
%inc = add i32 %0, 1
%tmp2 = getelementptr inbounds %struct._mtx* %mutex, i64 0, i32 1, !dbg !35
%tmp3 = load i32* %tmp2, align 4, !dbg !35
%tobool = icmp eq i32 %tmp3, 0, !dbg !35
%r.0 = select i1 %tobool, i32 %r.1, i32 2
%call = tail call i32 @bar(i32 %r.0, i32 %0), !dbg !38
%cmp = icmp slt i32 %inc, %call, !dbg !39
br i1 %cmp, label %do.body1, label %do.end9, !dbg !39
do.end9: ; preds = %do.body1
tail call void @llvm.dbg.value(metadata !40, i64 0, metadata !21), !dbg !41
tail call void @llvm.dbg.value(metadata !{i32 %call}, i64 0, metadata !24), !dbg !38
tail call void @llvm.dbg.value(metadata !{i32 %inc}, i64 0, metadata !23), !dbg !42
%add = add nsw i32 %r.0, %call, !dbg !43
ret i32 %add, !dbg !43
}
declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone
define i32 @bar(i32 %i, i32 %j) nounwind readnone noinline ssp {
entry:
tail call void @llvm.dbg.value(metadata !{i32 %i}, i64 0, metadata !25), !dbg !44
tail call void @llvm.dbg.value(metadata !{i32 %j}, i64 0, metadata !26), !dbg !45
%add = add nsw i32 %j, %i, !dbg !46
ret i32 %add, !dbg !46
}
define i32 @main() nounwind readonly ssp {
entry:
%m = alloca %struct._mtx, align 8
call void @llvm.dbg.declare(metadata !{%struct._mtx* %m}, metadata !27), !dbg !48
%tmp = getelementptr inbounds %struct._mtx* %m, i64 0, i32 1, !dbg !49
store i32 0, i32* %tmp, align 8, !dbg !49
%call = call i32 @foobar(%struct._mtx* %m), !dbg !50
ret i32 %call, !dbg !50
}
declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone
!llvm.dbg.sp = !{!0, !6, !7}
!llvm.dbg.lv.foobar = !{!8, !21, !23, !24}
!llvm.dbg.lv.bar = !{!25, !26}
!llvm.dbg.lv.main = !{!27}
!0 = metadata !{i32 524334, i32 0, metadata !1, metadata !"foobar", metadata !"foobar", metadata !"foobar", metadata !1, i32 12, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 true, i32 (%struct._mtx*)* @foobar} ; [ DW_TAG_subprogram ]
!1 = metadata !{i32 524329, metadata !"mu.c", metadata !"/private/tmp", metadata !2} ; [ DW_TAG_file_type ]
!2 = metadata !{i32 524305, i32 0, i32 12, metadata !"mu.c", metadata !"/private/tmp", metadata !"clang version 2.9 (trunk 114183)", i1 true, i1 true, metadata !"", i32 0} ; [ DW_TAG_compile_unit ]
!3 = metadata !{i32 524309, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !4, i32 0, null} ; [ DW_TAG_subroutine_type ]
!4 = metadata !{metadata !5}
!5 = metadata !{i32 524324, metadata !1, metadata !"int", metadata !1, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
!6 = metadata !{i32 524334, i32 0, metadata !1, metadata !"bar", metadata !"bar", metadata !"bar", metadata !1, i32 26, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 true, i32 (i32, i32)* @bar} ; [ DW_TAG_subprogram ]
!7 = metadata !{i32 524334, i32 0, metadata !1, metadata !"main", metadata !"main", metadata !"main", metadata !1, i32 30, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 true, i32 ()* @main} ; [ DW_TAG_subprogram ]
!8 = metadata !{i32 524545, metadata !0, metadata !"mutex", metadata !1, i32 12, metadata !9} ; [ DW_TAG_arg_variable ]
!9 = metadata !{i32 524303, metadata !1, metadata !"", metadata !1, i32 0, i64 64, i64 64, i64 0, i32 0, metadata !10} ; [ DW_TAG_pointer_type ]
!10 = metadata !{i32 524310, metadata !1, metadata !"mtx_t", metadata !1, i32 9, i64 0, i64 0, i64 0, i32 0, metadata !11} ; [ DW_TAG_typedef ]
!11 = metadata !{i32 524307, metadata !1, metadata !"_mtx", metadata !1, i32 2, i64 192, i64 64, i64 0, i32 0, null, metadata !12, i32 0, null} ; [ DW_TAG_structure_type ]
!12 = metadata !{metadata !13, metadata !15, metadata !16}
!13 = metadata !{i32 524301, metadata !1, metadata !"ptr", metadata !1, i32 3, i64 64, i64 64, i64 0, i32 0, metadata !14} ; [ DW_TAG_member ]
!14 = metadata !{i32 524324, metadata !1, metadata !"long unsigned int", metadata !1, i32 0, i64 64, i64 64, i64 0, i32 0, i32 7} ; [ DW_TAG_base_type ]
!15 = metadata !{i32 524301, metadata !1, metadata !"waiters", metadata !1, i32 4, i64 32, i64 32, i64 64, i32 0, metadata !5} ; [ DW_TAG_member ]
!16 = metadata !{i32 524301, metadata !1, metadata !"mtxi", metadata !1, i32 8, i64 64, i64 32, i64 96, i32 0, metadata !17} ; [ DW_TAG_member ]
!17 = metadata !{i32 524307, metadata !11, metadata !"", metadata !1, i32 5, i64 64, i64 32, i64 0, i32 0, null, metadata !18, i32 0, null} ; [ DW_TAG_structure_type ]
!18 = metadata !{metadata !19, metadata !20}
!19 = metadata !{i32 524301, metadata !1, metadata !"tag", metadata !1, i32 6, i64 32, i64 32, i64 0, i32 0, metadata !5} ; [ DW_TAG_member ]
!20 = metadata !{i32 524301, metadata !1, metadata !"pad", metadata !1, i32 7, i64 32, i64 32, i64 32, i32 0, metadata !5} ; [ DW_TAG_member ]
!21 = metadata !{i32 524544, metadata !22, metadata !"r", metadata !1, i32 13, metadata !5} ; [ DW_TAG_auto_variable ]
!22 = metadata !{i32 524299, metadata !0, i32 12, i32 52, metadata !1, i32 0} ; [ DW_TAG_lexical_block ]
!23 = metadata !{i32 524544, metadata !22, metadata !"l", metadata !1, i32 14, metadata !5} ; [ DW_TAG_auto_variable ]
!24 = metadata !{i32 524544, metadata !22, metadata !"j", metadata !1, i32 15, metadata !5} ; [ DW_TAG_auto_variable ]
!25 = metadata !{i32 524545, metadata !6, metadata !"i", metadata !1, i32 26, metadata !5} ; [ DW_TAG_arg_variable ]
!26 = metadata !{i32 524545, metadata !6, metadata !"j", metadata !1, i32 26, metadata !5} ; [ DW_TAG_arg_variable ]
!27 = metadata !{i32 524544, metadata !28, metadata !"m", metadata !1, i32 31, metadata !10} ; [ DW_TAG_auto_variable ]
!28 = metadata !{i32 524299, metadata !7, i32 30, i32 12, metadata !1, i32 4} ; [ DW_TAG_lexical_block ]
!29 = metadata !{i32 12, i32 45, metadata !0, null}
!30 = metadata !{i32 1}
!31 = metadata !{i32 13, i32 12, metadata !22, null}
!32 = metadata !{i32 0}
!33 = metadata !{i32 14, i32 12, metadata !22, null}
!34 = metadata !{i32 15, i32 12, metadata !22, null}
!35 = metadata !{i32 18, i32 5, metadata !36, null}
!36 = metadata !{i32 524299, metadata !22, i32 17, i32 6, metadata !1, i32 2} ; [ DW_TAG_lexical_block ]
!37 = metadata !{i32 16, i32 3, metadata !22, null}
!38 = metadata !{i32 20, i32 5, metadata !36, null}
!39 = metadata !{i32 22, i32 3, metadata !36, null}
!40 = metadata !{i32 2}
!41 = metadata !{i32 19, i32 7, metadata !36, null}
!42 = metadata !{i32 21, i32 5, metadata !36, null}
!43 = metadata !{i32 23, i32 3, metadata !22, null}
!44 = metadata !{i32 26, i32 39, metadata !6, null}
!45 = metadata !{i32 26, i32 46, metadata !6, null}
!46 = metadata !{i32 27, i32 3, metadata !47, null}
!47 = metadata !{i32 524299, metadata !6, i32 26, i32 49, metadata !1, i32 3} ; [ DW_TAG_lexical_block ]
!48 = metadata !{i32 31, i32 9, metadata !28, null}
!49 = metadata !{i32 32, i32 3, metadata !28, null}
!50 = metadata !{i32 33, i32 3, metadata !28, null}

View File

@@ -1,263 +0,0 @@
; This test case checks handling of llvm.dbg.declare intrinsic during fast-isel.
; RUN: %clang -arch x86_64 -O0 -g %s -c -o %t.o
; RUN: %clang -arch x86_64 %t.o -o %t.out
; RUN: %test_debuginfo %s %t.out
; XFAIL: *
; XTARGET: darwin
target triple = "x86_64-apple-darwin"
%struct.XYZ = type { i32, i32, i32, i32, i32 }
; Check handling of llvm.dbg.declare for an argument referred through alloca, where
; alloca dominates llvm.dbg.declare
define i32 @f1(i32 %i) nounwind ssp {
; DEBUGGER: break f1
; DEBUGGER: r
; DEBUGGER: p i
; CHECK: $1 = 42
entry:
%i.addr = alloca i32, align 4
store i32 %i, i32* %i.addr, align 4
call void @llvm.dbg.declare(metadata !{i32* %i.addr}, metadata !16), !dbg !17
%tmp = load i32* %i.addr, align 4, !dbg !18
ret i32 %tmp, !dbg !18
}
declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone
; Check handling of llvm.dbg.declare for an argument referred through alloca, where
; llvm.dbg.declare dominates alloca.
define i32 @f2(i32 %i) nounwind ssp {
; DEBUGGER: break f2
; DEBUGGER: c
; DEBUGGER: p i
; CHECK: $2 = 43
entry:
call void @llvm.dbg.declare(metadata !{i32* %i.addr}, metadata !20), !dbg !21
%i.addr = alloca i32, align 4
store i32 %i, i32* %i.addr, align 4
%tmp = load i32* %i.addr, align 4, !dbg !22
ret i32 %tmp, !dbg !22
}
; If llvm.dbg.declare is using an argument after its last use then register
; allocator may destroy debug info for the argument. This is expected and
; it should be fixed before registers are allocated.
define i32 @f3(i32 %i) nounwind ssp {
entry:
%i.addr = alloca i32, align 4
store i32 %i, i32* %i.addr, align 4
call void @llvm.dbg.declare(metadata !{i32 %i}, metadata !24), !dbg !25
%tmp = load i32* %i.addr, align 4, !dbg !26
ret i32 %tmp, !dbg !26
}
; Check handling of an argument referred directly by llvm.dbg.declare where
; llvm.dbg.declare dominates all uses of argument.
define i32 @f4(i32 %i) nounwind ssp {
; DEBUGGER: break f4
; DEBUGGER: c
; DEBUGGER: p i
; CHECK: $3 = 45
entry:
call void @llvm.dbg.declare(metadata !{i32 %i}, metadata !28), !dbg !29
ret i32 %i, !dbg !30
}
; Check handling of an argument referred directly by llvm.dbg.declare where
; llvm.dbg.declare dominates all uses of argument in separate basic block.
define i32 @f5(i32 %i) nounwind ssp {
; DEBUGGER: break f5
; DEBUGGER: c
; DEBUGGER: p i
; CHECK: $4 = 46
entry:
call void @llvm.dbg.declare(metadata !{i32 %i}, metadata !32), !dbg !33
br label %bbr
bbr:
ret i32 %i, !dbg !34
}
; Check handling of an argument referred directly by llvm.dbg.declare where
; argument is not used.
define i32 @f6(i32 %i) nounwind ssp {
entry:
call void @llvm.dbg.declare(metadata !{i32 %i}, metadata !36), !dbg !37
ret i32 1, !dbg !38
}
; Check handling of an byval argument referred directly by llvm.dbg.declare where
; argument is not used.
define i32 @f7(%struct.XYZ* byval %i) nounwind ssp {
entry:
call void @llvm.dbg.declare(metadata !{%struct.XYZ* %i}, metadata !40), !dbg !48
ret i32 1, !dbg !49
}
; Check handling of an byval argument referred directly by llvm.dbg.declare where
; argument use dominates llvm.dbg.declare.
define i32 @f8(%struct.XYZ* byval %i) nounwind ssp {
; DEBUGGER: break f8
; DEBUGGER: c
; DEBUGGER: p i.x
; CHECK: $5 = 51
entry:
%tmp = getelementptr inbounds %struct.XYZ* %i, i32 0, i32 1, !dbg !53
%tmp1 = load i32* %tmp, align 4, !dbg !53
call void @llvm.dbg.declare(metadata !{%struct.XYZ* %i}, metadata !51), !dbg !52
ret i32 %tmp1, !dbg !53
}
; Check handling of an byval argument referred directly by llvm.dbg.declare where
; llvm.dbg.declare dominates all uses of argument.
define i32 @f9(%struct.XYZ* byval %i) nounwind ssp {
; DEBUGGER: break f9
; DEBUGGER: c
; DEBUGGER: p i.x
; CHECK: $6 = 51
entry:
call void @llvm.dbg.declare(metadata !{%struct.XYZ* %i}, metadata !55), !dbg !56
%tmp = getelementptr inbounds %struct.XYZ* %i, i32 0, i32 2, !dbg !57
%tmp1 = load i32* %tmp, align 4, !dbg !57
ret i32 %tmp1, !dbg !57
}
; Check handling of an byval argument referred directly by llvm.dbg.declare where
; llvm.dbg.declare dominates all uses of argument in separate basic block.
define i32 @f10(%struct.XYZ* byval %i) nounwind ssp {
entry:
call void @llvm.dbg.declare(metadata !{%struct.XYZ* %i}, metadata !59), !dbg !60
br label %bbr
bbr:
%tmp = getelementptr inbounds %struct.XYZ* %i, i32 0, i32 3, !dbg !61
%tmp1 = load i32* %tmp, align 4, !dbg !61
ret i32 %tmp1, !dbg !61
}
define i32 @main() nounwind ssp {
entry:
%retval = alloca i32, align 4
%abc = alloca %struct.XYZ, align 4
%agg.tmp = alloca %struct.XYZ, align 4
%agg.tmp13 = alloca %struct.XYZ, align 4
%agg.tmp17 = alloca %struct.XYZ, align 4
%agg.tmp21 = alloca %struct.XYZ, align 4
store i32 0, i32* %retval
%call = call i32 @f1(i32 42), !dbg !63
%call1 = call i32 @f2(i32 43), !dbg !65
%call2 = call i32 @f3(i32 44), !dbg !66
%call3 = call i32 @f4(i32 45), !dbg !67
%call4 = call i32 @f5(i32 46), !dbg !68
%call5 = call i32 @f6(i32 47), !dbg !69
call void @llvm.dbg.declare(metadata !{%struct.XYZ* %abc}, metadata !70), !dbg !71
%tmp = getelementptr inbounds %struct.XYZ* %abc, i32 0, i32 0, !dbg !72
store i32 51, i32* %tmp, align 4, !dbg !72
%tmp6 = getelementptr inbounds %struct.XYZ* %abc, i32 0, i32 1, !dbg !72
store i32 52, i32* %tmp6, align 4, !dbg !72
%tmp7 = getelementptr inbounds %struct.XYZ* %abc, i32 0, i32 2, !dbg !72
store i32 53, i32* %tmp7, align 4, !dbg !72
%tmp8 = getelementptr inbounds %struct.XYZ* %abc, i32 0, i32 3, !dbg !72
store i32 54, i32* %tmp8, align 4, !dbg !72
%tmp9 = getelementptr inbounds %struct.XYZ* %abc, i32 0, i32 4, !dbg !72
store i32 55, i32* %tmp9, align 4, !dbg !72
%tmp10 = bitcast %struct.XYZ* %agg.tmp to i8*, !dbg !73
%tmp11 = bitcast %struct.XYZ* %abc to i8*, !dbg !73
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp10, i8* %tmp11, i64 20, i32 4, i1 false), !dbg !73
%call12 = call i32 @f7(%struct.XYZ* byval %agg.tmp), !dbg !73
%tmp14 = bitcast %struct.XYZ* %agg.tmp13 to i8*, !dbg !74
%tmp15 = bitcast %struct.XYZ* %abc to i8*, !dbg !74
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp14, i8* %tmp15, i64 20, i32 4, i1 false), !dbg !74
%call16 = call i32 @f8(%struct.XYZ* byval %agg.tmp13), !dbg !74
%tmp18 = bitcast %struct.XYZ* %agg.tmp17 to i8*, !dbg !75
%tmp19 = bitcast %struct.XYZ* %abc to i8*, !dbg !75
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp18, i8* %tmp19, i64 20, i32 4, i1 false), !dbg !75
%call20 = call i32 @f9(%struct.XYZ* byval %agg.tmp17), !dbg !75
%tmp22 = bitcast %struct.XYZ* %agg.tmp21 to i8*, !dbg !76
%tmp23 = bitcast %struct.XYZ* %abc to i8*, !dbg !76
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp22, i8* %tmp23, i64 20, i32 4, i1 false), !dbg !76
%call24 = call i32 @f10(%struct.XYZ* byval %agg.tmp21), !dbg !76
ret i32 0, !dbg !77
}
declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind
!llvm.dbg.sp = !{!0, !6, !7, !8, !9, !10, !11, !12, !13, !14, !15}
!0 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f1", metadata !"f1", metadata !"f1", metadata !1, i32 11, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 (i32)* @f1} ; [ DW_TAG_subprogram ]
!1 = metadata !{i32 524329, metadata !"fastisel_arg.c", metadata !"/private/tmp", metadata !2} ; [ DW_TAG_file_type ]
!2 = metadata !{i32 524305, i32 0, i32 12, metadata !"fastisel_arg.c", metadata !"/private/tmp", metadata !"clang version 2.8 (trunk 112967)", i1 true, i1 false, metadata !"", i32 0} ; [ DW_TAG_compile_unit ]
!3 = metadata !{i32 524309, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !4, i32 0, null} ; [ DW_TAG_subroutine_type ]
!4 = metadata !{metadata !5}
!5 = metadata !{i32 524324, metadata !1, metadata !"int", metadata !1, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
!6 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f2", metadata !"f2", metadata !"f2", metadata !1, i32 12, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 (i32)* @f2} ; [ DW_TAG_subprogram ]
!7 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f3", metadata !"f3", metadata !"f3", metadata !1, i32 13, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 (i32)* @f3} ; [ DW_TAG_subprogram ]
!8 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f4", metadata !"f4", metadata !"f4", metadata !1, i32 14, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 (i32)* @f4} ; [ DW_TAG_subprogram ]
!9 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f5", metadata !"f5", metadata !"f5", metadata !1, i32 15, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 (i32)* @f5} ; [ DW_TAG_subprogram ]
!10 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f6", metadata !"f6", metadata !"f6", metadata !1, i32 16, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 (i32)* @f6} ; [ DW_TAG_subprogram ]
!11 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f7", metadata !"f7", metadata !"f7", metadata !1, i32 17, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 (%struct.XYZ*)* @f7} ; [ DW_TAG_subprogram ]
!12 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f8", metadata !"f8", metadata !"f8", metadata !1, i32 18, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 (%struct.XYZ*)* @f8} ; [ DW_TAG_subprogram ]
!13 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f9", metadata !"f9", metadata !"f9", metadata !1, i32 19, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 (%struct.XYZ*)* @f9} ; [ DW_TAG_subprogram ]
!14 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f10", metadata !"f10", metadata !"f10", metadata !1, i32 20, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 (%struct.XYZ*)* @f10} ; [ DW_TAG_subprogram ]
!15 = metadata !{i32 524334, i32 0, metadata !1, metadata !"main", metadata !"main", metadata !"main", metadata !1, i32 23, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 ()* @main} ; [ DW_TAG_subprogram ]
!16 = metadata !{i32 524545, metadata !0, metadata !"i", metadata !1, i32 11, metadata !5} ; [ DW_TAG_arg_variable ]
!17 = metadata !{i32 11, i32 12, metadata !0, null}
!18 = metadata !{i32 11, i32 17, metadata !19, null}
!19 = metadata !{i32 524299, metadata !0, i32 11, i32 15, metadata !1, i32 0} ; [ DW_TAG_lexical_block ]
!20 = metadata !{i32 524545, metadata !6, metadata !"i", metadata !1, i32 12, metadata !5} ; [ DW_TAG_arg_variable ]
!21 = metadata !{i32 12, i32 12, metadata !6, null}
!22 = metadata !{i32 12, i32 17, metadata !23, null}
!23 = metadata !{i32 524299, metadata !6, i32 12, i32 15, metadata !1, i32 1} ; [ DW_TAG_lexical_block ]
!24 = metadata !{i32 524545, metadata !7, metadata !"i", metadata !1, i32 13, metadata !5} ; [ DW_TAG_arg_variable ]
!25 = metadata !{i32 13, i32 12, metadata !7, null}
!26 = metadata !{i32 13, i32 17, metadata !27, null}
!27 = metadata !{i32 524299, metadata !7, i32 13, i32 15, metadata !1, i32 2} ; [ DW_TAG_lexical_block ]
!28 = metadata !{i32 524545, metadata !8, metadata !"i", metadata !1, i32 14, metadata !5} ; [ DW_TAG_arg_variable ]
!29 = metadata !{i32 14, i32 12, metadata !8, null}
!30 = metadata !{i32 14, i32 17, metadata !31, null}
!31 = metadata !{i32 524299, metadata !8, i32 14, i32 15, metadata !1, i32 3} ; [ DW_TAG_lexical_block ]
!32 = metadata !{i32 524545, metadata !9, metadata !"i", metadata !1, i32 15, metadata !5} ; [ DW_TAG_arg_variable ]
!33 = metadata !{i32 15, i32 12, metadata !9, null}
!34 = metadata !{i32 15, i32 17, metadata !35, null}
!35 = metadata !{i32 524299, metadata !9, i32 15, i32 15, metadata !1, i32 4} ; [ DW_TAG_lexical_block ]
!36 = metadata !{i32 524545, metadata !10, metadata !"i", metadata !1, i32 16, metadata !5} ; [ DW_TAG_arg_variable ]
!37 = metadata !{i32 16, i32 12, metadata !10, null}
!38 = metadata !{i32 16, i32 17, metadata !39, null}
!39 = metadata !{i32 524299, metadata !10, i32 16, i32 15, metadata !1, i32 5} ; [ DW_TAG_lexical_block ]
!40 = metadata !{i32 524545, metadata !11, metadata !"i", metadata !1, i32 17, metadata !41} ; [ DW_TAG_arg_variable ]
!41 = metadata !{i32 524307, metadata !1, metadata !"XYZ", metadata !1, i32 2, i64 160, i64 32, i64 0, i32 0, null, metadata !42, i32 0, null} ; [ DW_TAG_structure_type ]
!42 = metadata !{metadata !43, metadata !44, metadata !45, metadata !46, metadata !47}
!43 = metadata !{i32 524301, metadata !1, metadata !"x", metadata !1, i32 3, i64 32, i64 32, i64 0, i32 0, metadata !5} ; [ DW_TAG_member ]
!44 = metadata !{i32 524301, metadata !1, metadata !"y", metadata !1, i32 4, i64 32, i64 32, i64 32, i32 0, metadata !5} ; [ DW_TAG_member ]
!45 = metadata !{i32 524301, metadata !1, metadata !"z", metadata !1, i32 5, i64 32, i64 32, i64 64, i32 0, metadata !5} ; [ DW_TAG_member ]
!46 = metadata !{i32 524301, metadata !1, metadata !"a", metadata !1, i32 6, i64 32, i64 32, i64 96, i32 0, metadata !5} ; [ DW_TAG_member ]
!47 = metadata !{i32 524301, metadata !1, metadata !"b", metadata !1, i32 7, i64 32, i64 32, i64 128, i32 0, metadata !5} ; [ DW_TAG_member ]
!48 = metadata !{i32 17, i32 19, metadata !11, null}
!49 = metadata !{i32 17, i32 24, metadata !50, null}
!50 = metadata !{i32 524299, metadata !11, i32 17, i32 22, metadata !1, i32 6} ; [ DW_TAG_lexical_block ]
!51 = metadata !{i32 524545, metadata !12, metadata !"i", metadata !1, i32 18, metadata !41} ; [ DW_TAG_arg_variable ]
!52 = metadata !{i32 18, i32 19, metadata !12, null}
!53 = metadata !{i32 18, i32 24, metadata !54, null}
!54 = metadata !{i32 524299, metadata !12, i32 18, i32 22, metadata !1, i32 7} ; [ DW_TAG_lexical_block ]
!55 = metadata !{i32 524545, metadata !13, metadata !"i", metadata !1, i32 19, metadata !41} ; [ DW_TAG_arg_variable ]
!56 = metadata !{i32 19, i32 19, metadata !13, null}
!57 = metadata !{i32 19, i32 24, metadata !58, null}
!58 = metadata !{i32 524299, metadata !13, i32 19, i32 22, metadata !1, i32 8} ; [ DW_TAG_lexical_block ]
!59 = metadata !{i32 524545, metadata !14, metadata !"i", metadata !1, i32 20, metadata !41} ; [ DW_TAG_arg_variable ]
!60 = metadata !{i32 20, i32 20, metadata !14, null}
!61 = metadata !{i32 20, i32 25, metadata !62, null}
!62 = metadata !{i32 524299, metadata !14, i32 20, i32 23, metadata !1, i32 9} ; [ DW_TAG_lexical_block ]
!63 = metadata !{i32 24, i32 3, metadata !64, null}
!64 = metadata !{i32 524299, metadata !15, i32 23, i32 12, metadata !1, i32 10} ; [ DW_TAG_lexical_block ]
!65 = metadata !{i32 25, i32 3, metadata !64, null}
!66 = metadata !{i32 26, i32 3, metadata !64, null}
!67 = metadata !{i32 27, i32 3, metadata !64, null}
!68 = metadata !{i32 28, i32 3, metadata !64, null}
!69 = metadata !{i32 29, i32 3, metadata !64, null}
!70 = metadata !{i32 524544, metadata !64, metadata !"abc", metadata !1, i32 30, metadata !41} ; [ DW_TAG_auto_variable ]
!71 = metadata !{i32 30, i32 14, metadata !64, null}
!72 = metadata !{i32 30, i32 17, metadata !64, null}
!73 = metadata !{i32 31, i32 3, metadata !64, null}
!74 = metadata !{i32 32, i32 3, metadata !64, null}
!75 = metadata !{i32 33, i32 3, metadata !64, null}
!76 = metadata !{i32 34, i32 3, metadata !64, null}
!77 = metadata !{i32 36, i32 3, metadata !64, null}

View File

@@ -1,264 +0,0 @@
; This test case checks handling of llvm.dbg.declare intrinsic during isel.
; RUN: %clang -arch x86_64 -mllvm -fast-isel=false -mllvm -regalloc=default -g %s -c -o %t.o
; RUN: %clang -arch x86_64 %t.o -o %t.out
; RUN: %test_debuginfo %s %t.out
; XFAIL: *
; XTARGET: darwin
target triple = "x86_64-apple-darwin"
%struct.XYZ = type { i32, i32, i32, i32, i32 }
; Check handling of llvm.dbg.declare for an argument referred through alloca, where
; alloca dominates llvm.dbg.declare
define i32 @f1(i32 %i) nounwind ssp {
; DEBUGGER: break f1
; DEBUGGER: r
; DEBUGGER: p i
; CHECK: $1 = 42
entry:
%i.addr = alloca i32, align 4
store i32 %i, i32* %i.addr, align 4
call void @llvm.dbg.declare(metadata !{i32* %i.addr}, metadata !16), !dbg !17
%tmp = load i32* %i.addr, align 4, !dbg !18
ret i32 %tmp, !dbg !18
}
declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone
; Check handling of llvm.dbg.declare for an argument referred through alloca, where
; llvm.dbg.declare dominates alloca.
define i32 @f2(i32 %i) nounwind ssp {
; DEBUGGER: break f2
; DEBUGGER: c
; DEBUGGER: p i
; CHECK: $2 = 43
entry:
call void @llvm.dbg.declare(metadata !{i32* %i.addr}, metadata !20), !dbg !21
%i.addr = alloca i32, align 4
store i32 %i, i32* %i.addr, align 4
%tmp = load i32* %i.addr, align 4, !dbg !22
ret i32 %tmp, !dbg !22
}
; Check handling of an argument referred directly by llvm.dbg.declare where at least
; one argument use dominates llvm.dbg.declare.
; This is expected to not work because registor allocator has freedom to kill 'i'
; after its last use.
define i32 @f3(i32 %i) nounwind ssp {
entry:
%i.addr = alloca i32, align 4
store i32 %i, i32* %i.addr, align 4
call void @llvm.dbg.declare(metadata !{i32 %i}, metadata !24), !dbg !25
%tmp = load i32* %i.addr, align 4, !dbg !26
ret i32 %tmp, !dbg !26
}
; Check handling of an argument referred directly by llvm.dbg.declare where
; llvm.dbg.declare dominates all uses of argument.
define i32 @f4(i32 %i) nounwind ssp {
entry:
call void @llvm.dbg.declare(metadata !{i32 %i}, metadata !28), !dbg !29
ret i32 %i, !dbg !30
}
; Check handling of an argument referred directly by llvm.dbg.declare where
; llvm.dbg.declare dominates all uses of argument in separate basic block.
define i32 @f5(i32 %i) nounwind ssp {
entry:
call void @llvm.dbg.declare(metadata !{i32 %i}, metadata !32), !dbg !33
br label %bbr
bbr:
ret i32 %i, !dbg !34
}
; Check handling of an argument referred directly by llvm.dbg.declare where
; argument is not used.
define i32 @f6(i32 %i) nounwind ssp {
entry:
call void @llvm.dbg.declare(metadata !{i32 %i}, metadata !36), !dbg !37
ret i32 1, !dbg !38
}
; Check handling of an byval argument referred directly by llvm.dbg.declare where
; argument is not used.
define i32 @f7(%struct.XYZ* byval %i) nounwind ssp {
; DEBUGGER: break f7
; DEBUGGER: c
; DEBUGGER: p i.x
; CHECK: $3 = 51
entry:
call void @llvm.dbg.declare(metadata !{%struct.XYZ* %i}, metadata !40), !dbg !48
ret i32 1, !dbg !49
}
; Check handling of an byval argument referred directly by llvm.dbg.declare where
; argument use dominates llvm.dbg.declare.
define i32 @f8(%struct.XYZ* byval %i) nounwind ssp {
; DEBUGGER: break f8
; DEBUGGER: c
; DEBUGGER: p i.x
; CHECK: $4 = 51
entry:
%tmp = getelementptr inbounds %struct.XYZ* %i, i32 0, i32 1, !dbg !53
%tmp1 = load i32* %tmp, align 4, !dbg !53
call void @llvm.dbg.declare(metadata !{%struct.XYZ* %i}, metadata !51), !dbg !52
ret i32 %tmp1, !dbg !53
}
; Check handling of an byval argument referred directly by llvm.dbg.declare where
; llvm.dbg.declare dominates all uses of argument.
define i32 @f9(%struct.XYZ* byval %i) nounwind ssp {
; DEBUGGER: break f9
; DEBUGGER: c
; DEBUGGER: p i.x
; CHECK: $5 = 51
entry:
call void @llvm.dbg.declare(metadata !{%struct.XYZ* %i}, metadata !55), !dbg !56
%tmp = getelementptr inbounds %struct.XYZ* %i, i32 0, i32 2, !dbg !57
%tmp1 = load i32* %tmp, align 4, !dbg !57
ret i32 %tmp1, !dbg !57
}
; Check handling of an byval argument referred directly by llvm.dbg.declare where
; llvm.dbg.declare dominates all uses of argument in separate basic block.
define i32 @f10(%struct.XYZ* byval %i) nounwind ssp {
; DEBUGGER: break f10
; DEBUGGER: c
; DEBUGGER: p i.x
; CHECK: $6 = 51
entry:
call void @llvm.dbg.declare(metadata !{%struct.XYZ* %i}, metadata !59), !dbg !60
br label %bbr
bbr:
%tmp = getelementptr inbounds %struct.XYZ* %i, i32 0, i32 3, !dbg !61
%tmp1 = load i32* %tmp, align 4, !dbg !61
ret i32 %tmp1, !dbg !61
}
define i32 @main() nounwind ssp {
entry:
%retval = alloca i32, align 4
%abc = alloca %struct.XYZ, align 4
%agg.tmp = alloca %struct.XYZ, align 4
%agg.tmp13 = alloca %struct.XYZ, align 4
%agg.tmp17 = alloca %struct.XYZ, align 4
%agg.tmp21 = alloca %struct.XYZ, align 4
store i32 0, i32* %retval
%call = call i32 @f1(i32 42), !dbg !63
%call1 = call i32 @f2(i32 43), !dbg !65
%call2 = call i32 @f3(i32 44), !dbg !66
%call3 = call i32 @f4(i32 45), !dbg !67
%call4 = call i32 @f5(i32 46), !dbg !68
%call5 = call i32 @f6(i32 47), !dbg !69
call void @llvm.dbg.declare(metadata !{%struct.XYZ* %abc}, metadata !70), !dbg !71
%tmp = getelementptr inbounds %struct.XYZ* %abc, i32 0, i32 0, !dbg !72
store i32 51, i32* %tmp, align 4, !dbg !72
%tmp6 = getelementptr inbounds %struct.XYZ* %abc, i32 0, i32 1, !dbg !72
store i32 52, i32* %tmp6, align 4, !dbg !72
%tmp7 = getelementptr inbounds %struct.XYZ* %abc, i32 0, i32 2, !dbg !72
store i32 53, i32* %tmp7, align 4, !dbg !72
%tmp8 = getelementptr inbounds %struct.XYZ* %abc, i32 0, i32 3, !dbg !72
store i32 54, i32* %tmp8, align 4, !dbg !72
%tmp9 = getelementptr inbounds %struct.XYZ* %abc, i32 0, i32 4, !dbg !72
store i32 55, i32* %tmp9, align 4, !dbg !72
%tmp10 = bitcast %struct.XYZ* %agg.tmp to i8*, !dbg !73
%tmp11 = bitcast %struct.XYZ* %abc to i8*, !dbg !73
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp10, i8* %tmp11, i64 20, i32 4, i1 false), !dbg !73
%call12 = call i32 @f7(%struct.XYZ* byval %agg.tmp), !dbg !73
%tmp14 = bitcast %struct.XYZ* %agg.tmp13 to i8*, !dbg !74
%tmp15 = bitcast %struct.XYZ* %abc to i8*, !dbg !74
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp14, i8* %tmp15, i64 20, i32 4, i1 false), !dbg !74
%call16 = call i32 @f8(%struct.XYZ* byval %agg.tmp13), !dbg !74
%tmp18 = bitcast %struct.XYZ* %agg.tmp17 to i8*, !dbg !75
%tmp19 = bitcast %struct.XYZ* %abc to i8*, !dbg !75
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp18, i8* %tmp19, i64 20, i32 4, i1 false), !dbg !75
%call20 = call i32 @f9(%struct.XYZ* byval %agg.tmp17), !dbg !75
%tmp22 = bitcast %struct.XYZ* %agg.tmp21 to i8*, !dbg !76
%tmp23 = bitcast %struct.XYZ* %abc to i8*, !dbg !76
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp22, i8* %tmp23, i64 20, i32 4, i1 false), !dbg !76
%call24 = call i32 @f10(%struct.XYZ* byval %agg.tmp21), !dbg !76
ret i32 0, !dbg !77
}
declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind
!llvm.dbg.sp = !{!0, !6, !7, !8, !9, !10, !11, !12, !13, !14, !15}
!0 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f1", metadata !"f1", metadata !"f1", metadata !1, i32 11, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 (i32)* @f1} ; [ DW_TAG_subprogram ]
!1 = metadata !{i32 524329, metadata !"fastisel_arg.c", metadata !"/private/tmp", metadata !2} ; [ DW_TAG_file_type ]
!2 = metadata !{i32 524305, i32 0, i32 12, metadata !"fastisel_arg.c", metadata !"/private/tmp", metadata !"clang version 2.8 (trunk 112967)", i1 true, i1 false, metadata !"", i32 0} ; [ DW_TAG_compile_unit ]
!3 = metadata !{i32 524309, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !4, i32 0, null} ; [ DW_TAG_subroutine_type ]
!4 = metadata !{metadata !5}
!5 = metadata !{i32 524324, metadata !1, metadata !"int", metadata !1, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
!6 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f2", metadata !"f2", metadata !"f2", metadata !1, i32 12, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 (i32)* @f2} ; [ DW_TAG_subprogram ]
!7 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f3", metadata !"f3", metadata !"f3", metadata !1, i32 13, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 (i32)* @f3} ; [ DW_TAG_subprogram ]
!8 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f4", metadata !"f4", metadata !"f4", metadata !1, i32 14, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 (i32)* @f4} ; [ DW_TAG_subprogram ]
!9 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f5", metadata !"f5", metadata !"f5", metadata !1, i32 15, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 (i32)* @f5} ; [ DW_TAG_subprogram ]
!10 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f6", metadata !"f6", metadata !"f6", metadata !1, i32 16, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 (i32)* @f6} ; [ DW_TAG_subprogram ]
!11 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f7", metadata !"f7", metadata !"f7", metadata !1, i32 17, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 (%struct.XYZ*)* @f7} ; [ DW_TAG_subprogram ]
!12 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f8", metadata !"f8", metadata !"f8", metadata !1, i32 18, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 (%struct.XYZ*)* @f8} ; [ DW_TAG_subprogram ]
!13 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f9", metadata !"f9", metadata !"f9", metadata !1, i32 19, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 (%struct.XYZ*)* @f9} ; [ DW_TAG_subprogram ]
!14 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f10", metadata !"f10", metadata !"f10", metadata !1, i32 20, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 (%struct.XYZ*)* @f10} ; [ DW_TAG_subprogram ]
!15 = metadata !{i32 524334, i32 0, metadata !1, metadata !"main", metadata !"main", metadata !"main", metadata !1, i32 23, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 ()* @main} ; [ DW_TAG_subprogram ]
!16 = metadata !{i32 524545, metadata !0, metadata !"i", metadata !1, i32 11, metadata !5} ; [ DW_TAG_arg_variable ]
!17 = metadata !{i32 11, i32 12, metadata !0, null}
!18 = metadata !{i32 11, i32 17, metadata !19, null}
!19 = metadata !{i32 524299, metadata !0, i32 11, i32 15, metadata !1, i32 0} ; [ DW_TAG_lexical_block ]
!20 = metadata !{i32 524545, metadata !6, metadata !"i", metadata !1, i32 12, metadata !5} ; [ DW_TAG_arg_variable ]
!21 = metadata !{i32 12, i32 12, metadata !6, null}
!22 = metadata !{i32 12, i32 17, metadata !23, null}
!23 = metadata !{i32 524299, metadata !6, i32 12, i32 15, metadata !1, i32 1} ; [ DW_TAG_lexical_block ]
!24 = metadata !{i32 524545, metadata !7, metadata !"i", metadata !1, i32 13, metadata !5} ; [ DW_TAG_arg_variable ]
!25 = metadata !{i32 13, i32 12, metadata !7, null}
!26 = metadata !{i32 13, i32 17, metadata !27, null}
!27 = metadata !{i32 524299, metadata !7, i32 13, i32 15, metadata !1, i32 2} ; [ DW_TAG_lexical_block ]
!28 = metadata !{i32 524545, metadata !8, metadata !"i", metadata !1, i32 14, metadata !5} ; [ DW_TAG_arg_variable ]
!29 = metadata !{i32 14, i32 12, metadata !8, null}
!30 = metadata !{i32 14, i32 17, metadata !31, null}
!31 = metadata !{i32 524299, metadata !8, i32 14, i32 15, metadata !1, i32 3} ; [ DW_TAG_lexical_block ]
!32 = metadata !{i32 524545, metadata !9, metadata !"i", metadata !1, i32 15, metadata !5} ; [ DW_TAG_arg_variable ]
!33 = metadata !{i32 15, i32 12, metadata !9, null}
!34 = metadata !{i32 15, i32 17, metadata !35, null}
!35 = metadata !{i32 524299, metadata !9, i32 15, i32 15, metadata !1, i32 4} ; [ DW_TAG_lexical_block ]
!36 = metadata !{i32 524545, metadata !10, metadata !"i", metadata !1, i32 16, metadata !5} ; [ DW_TAG_arg_variable ]
!37 = metadata !{i32 16, i32 12, metadata !10, null}
!38 = metadata !{i32 16, i32 17, metadata !39, null}
!39 = metadata !{i32 524299, metadata !10, i32 16, i32 15, metadata !1, i32 5} ; [ DW_TAG_lexical_block ]
!40 = metadata !{i32 524545, metadata !11, metadata !"i", metadata !1, i32 17, metadata !41} ; [ DW_TAG_arg_variable ]
!41 = metadata !{i32 524307, metadata !1, metadata !"XYZ", metadata !1, i32 2, i64 160, i64 32, i64 0, i32 0, null, metadata !42, i32 0, null} ; [ DW_TAG_structure_type ]
!42 = metadata !{metadata !43, metadata !44, metadata !45, metadata !46, metadata !47}
!43 = metadata !{i32 524301, metadata !1, metadata !"x", metadata !1, i32 3, i64 32, i64 32, i64 0, i32 0, metadata !5} ; [ DW_TAG_member ]
!44 = metadata !{i32 524301, metadata !1, metadata !"y", metadata !1, i32 4, i64 32, i64 32, i64 32, i32 0, metadata !5} ; [ DW_TAG_member ]
!45 = metadata !{i32 524301, metadata !1, metadata !"z", metadata !1, i32 5, i64 32, i64 32, i64 64, i32 0, metadata !5} ; [ DW_TAG_member ]
!46 = metadata !{i32 524301, metadata !1, metadata !"a", metadata !1, i32 6, i64 32, i64 32, i64 96, i32 0, metadata !5} ; [ DW_TAG_member ]
!47 = metadata !{i32 524301, metadata !1, metadata !"b", metadata !1, i32 7, i64 32, i64 32, i64 128, i32 0, metadata !5} ; [ DW_TAG_member ]
!48 = metadata !{i32 17, i32 19, metadata !11, null}
!49 = metadata !{i32 17, i32 24, metadata !50, null}
!50 = metadata !{i32 524299, metadata !11, i32 17, i32 22, metadata !1, i32 6} ; [ DW_TAG_lexical_block ]
!51 = metadata !{i32 524545, metadata !12, metadata !"i", metadata !1, i32 18, metadata !41} ; [ DW_TAG_arg_variable ]
!52 = metadata !{i32 18, i32 19, metadata !12, null}
!53 = metadata !{i32 18, i32 24, metadata !54, null}
!54 = metadata !{i32 524299, metadata !12, i32 18, i32 22, metadata !1, i32 7} ; [ DW_TAG_lexical_block ]
!55 = metadata !{i32 524545, metadata !13, metadata !"i", metadata !1, i32 19, metadata !41} ; [ DW_TAG_arg_variable ]
!56 = metadata !{i32 19, i32 19, metadata !13, null}
!57 = metadata !{i32 19, i32 24, metadata !58, null}
!58 = metadata !{i32 524299, metadata !13, i32 19, i32 22, metadata !1, i32 8} ; [ DW_TAG_lexical_block ]
!59 = metadata !{i32 524545, metadata !14, metadata !"i", metadata !1, i32 20, metadata !41} ; [ DW_TAG_arg_variable ]
!60 = metadata !{i32 20, i32 20, metadata !14, null}
!61 = metadata !{i32 20, i32 25, metadata !62, null}
!62 = metadata !{i32 524299, metadata !14, i32 20, i32 23, metadata !1, i32 9} ; [ DW_TAG_lexical_block ]
!63 = metadata !{i32 24, i32 3, metadata !64, null}
!64 = metadata !{i32 524299, metadata !15, i32 23, i32 12, metadata !1, i32 10} ; [ DW_TAG_lexical_block ]
!65 = metadata !{i32 25, i32 3, metadata !64, null}
!66 = metadata !{i32 26, i32 3, metadata !64, null}
!67 = metadata !{i32 27, i32 3, metadata !64, null}
!68 = metadata !{i32 28, i32 3, metadata !64, null}
!69 = metadata !{i32 29, i32 3, metadata !64, null}
!70 = metadata !{i32 524544, metadata !64, metadata !"abc", metadata !1, i32 30, metadata !41} ; [ DW_TAG_auto_variable ]
!71 = metadata !{i32 30, i32 14, metadata !64, null}
!72 = metadata !{i32 30, i32 17, metadata !64, null}
!73 = metadata !{i32 31, i32 3, metadata !64, null}
!74 = metadata !{i32 32, i32 3, metadata !64, null}
!75 = metadata !{i32 33, i32 3, metadata !64, null}
!76 = metadata !{i32 34, i32 3, metadata !64, null}
!77 = metadata !{i32 36, i32 3, metadata !64, null}

View File

@@ -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
// XFAIL: *
// XTARGET: 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;
}

View File

@@ -1,24 +0,0 @@
// RUN: %clangxx -O0 -g %s -c -o %t.o
// RUN: %test_debuginfo %s %t.o
// Radar 9168773
// DEBUGGER: ptype A
// CHECK: type = class A {
// CHECK-NEXT: public:
// 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;

View File

@@ -1,109 +0,0 @@
; This test case checks handling of llvm.dbg.declare intrinsic during fast-isel.
; RUN: %clang -arch x86_64 -O0 -g %s -c -o %t.o
; RUN: %clang -arch x86_64 %t.o -o %t.out
; RUN: %test_debuginfo %s %t.out
; XFAIL: *
; XTARGET: darwin
target triple = "x86_64-apple-darwin10.0.0"
define i32 @f1() nounwind ssp {
; DEBUGGER: break f1
; DEBUGGER: r
; DEBUGGER: n
; DEBUGGER: p i
; CHECK: $1 = 42
entry:
%i = alloca i32, align 4
call void @llvm.dbg.declare(metadata !{i32* %i}, metadata !10), !dbg !12
store i32 42, i32* %i, align 4, !dbg !13
%tmp = load i32* %i, align 4, !dbg !14
ret i32 %tmp, !dbg !14
}
declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone
define i32 @f2() nounwind ssp {
; DEBUGGER: break f2
; DEBUGGER: c
; DEBUGGER: n
; DEBUGGER: p i
; CHECK: $2 = 42
entry:
call void @llvm.dbg.declare(metadata !{i32* %i}, metadata !15), !dbg !17
%i = alloca i32, align 4
store i32 42, i32* %i, align 4, !dbg !18
%tmp = load i32* %i, align 4, !dbg !19
ret i32 %tmp, !dbg !19
}
; dbg.declare is dropped, as expected, by instruction selector.
; THIS IS NOT EXPECTED TO WORK.
define i32 @f3() nounwind ssp {
entry:
call void @llvm.dbg.declare(metadata !{i32* %i}, metadata !20), !dbg !22
br label %bbr
bbr:
%i = alloca i32, align 4
store i32 42, i32* %i, align 4, !dbg !23
%tmp = load i32* %i, align 4, !dbg !24
ret i32 %tmp, !dbg !24
}
; dbg.declare is dropped, as expected, by instruction selector.
; THIS IS NOT EXPECTED TO WORK.
define i32 @f4() nounwind ssp {
entry:
%i = alloca i32, align 4
call void @llvm.dbg.declare(metadata !{i32* %i}, metadata !25), !dbg !27
ret i32 42, !dbg !28
}
define i32 @main() nounwind ssp {
entry:
%retval = alloca i32, align 4
store i32 0, i32* %retval
%call = call i32 @f1(), !dbg !29
%call1 = call i32 @f2(), !dbg !31
%call2 = call i32 @f3(), !dbg !32
%call3 = call i32 @f4(), !dbg !33
ret i32 0, !dbg !34
}
!llvm.dbg.sp = !{!0, !6, !7, !8, !9}
!0 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f1", metadata !"f1", metadata !"f1", metadata !1, i32 2, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 ()* @f1} ; [ DW_TAG_subprogram ]
!1 = metadata !{i32 524329, metadata !"lv.c", metadata !"dbg_info_bugs", metadata !2} ; [ DW_TAG_file_type ]
!2 = metadata !{i32 524305, i32 0, i32 12, metadata !"lv.c", metadata !"dbg_info_bugs", metadata !"clang version 2.9 (trunk 113428)", i1 true, i1 false, metadata !"", i32 0} ; [ DW_TAG_compile_unit ]
!3 = metadata !{i32 524309, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !4, i32 0, null} ; [ DW_TAG_subroutine_type ]
!4 = metadata !{metadata !5}
!5 = metadata !{i32 524324, metadata !1, metadata !"int", metadata !1, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
!6 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f2", metadata !"f2", metadata !"f2", metadata !1, i32 8, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 ()* @f2} ; [ DW_TAG_subprogram ]
!7 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f3", metadata !"f3", metadata !"f3", metadata !1, i32 14, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 ()* @f3} ; [ DW_TAG_subprogram ]
!8 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f4", metadata !"f4", metadata !"f4", metadata !1, i32 20, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 ()* @f4} ; [ DW_TAG_subprogram ]
!9 = metadata !{i32 524334, i32 0, metadata !1, metadata !"main", metadata !"main", metadata !"main", metadata !1, i32 25, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 ()* @main} ; [ DW_TAG_subprogram ]
!10 = metadata !{i32 524544, metadata !11, metadata !"i", metadata !1, i32 3, metadata !5} ; [ DW_TAG_auto_variable ]
!11 = metadata !{i32 524299, metadata !0, i32 2, i32 10, metadata !1, i32 0} ; [ DW_TAG_lexical_block ]
!12 = metadata !{i32 3, i32 7, metadata !11, null}
!13 = metadata !{i32 4, i32 3, metadata !11, null}
!14 = metadata !{i32 5, i32 3, metadata !11, null}
!15 = metadata !{i32 524544, metadata !16, metadata !"i", metadata !1, i32 9, metadata !5} ; [ DW_TAG_auto_variable ]
!16 = metadata !{i32 524299, metadata !6, i32 8, i32 10, metadata !1, i32 1} ; [ DW_TAG_lexical_block ]
!17 = metadata !{i32 9, i32 7, metadata !16, null}
!18 = metadata !{i32 10, i32 3, metadata !16, null}
!19 = metadata !{i32 11, i32 3, metadata !16, null}
!20 = metadata !{i32 524544, metadata !21, metadata !"i", metadata !1, i32 15, metadata !5} ; [ DW_TAG_auto_variable ]
!21 = metadata !{i32 524299, metadata !7, i32 14, i32 10, metadata !1, i32 2} ; [ DW_TAG_lexical_block ]
!22 = metadata !{i32 15, i32 7, metadata !21, null}
!23 = metadata !{i32 16, i32 3, metadata !21, null}
!24 = metadata !{i32 17, i32 3, metadata !21, null}
!25 = metadata !{i32 524544, metadata !26, metadata !"i", metadata !1, i32 21, metadata !5} ; [ DW_TAG_auto_variable ]
!26 = metadata !{i32 524299, metadata !8, i32 20, i32 10, metadata !1, i32 3} ; [ DW_TAG_lexical_block ]
!27 = metadata !{i32 21, i32 7, metadata !26, null}
!28 = metadata !{i32 22, i32 3, metadata !26, null}
!29 = metadata !{i32 26, i32 3, metadata !30, null}
!30 = metadata !{i32 524299, metadata !9, i32 25, i32 12, metadata !1, i32 4} ; [ DW_TAG_lexical_block ]
!31 = metadata !{i32 27, i32 3, metadata !30, null}
!32 = metadata !{i32 28, i32 3, metadata !30, null}
!33 = metadata !{i32 29, i32 3, metadata !30, null}
!34 = metadata !{i32 30, i32 3, metadata !30, null}

View File

@@ -1,109 +0,0 @@
; This test case checks handling of llvm.dbg.declare intrinsic during isel.
; RUN: %clang -arch x86_64 -O0 -mllvm -fast-isel=false -g %s -c -o %t.o
; RUN: %clang -arch x86_64 %t.o -o %t.out
; RUN: %test_debuginfo %s %t.out
; XFAIL: *
; XTARGET: darwin
target triple = "x86_64-apple-darwin10.0.0"
define i32 @f1() nounwind ssp {
; DEBUGGER: break f1
; DEBUGGER: r
; DEBUGGER: n
; DEBUGGER: p i
; CHECK: $1 = 42
entry:
%i = alloca i32, align 4
call void @llvm.dbg.declare(metadata !{i32* %i}, metadata !10), !dbg !12
store i32 42, i32* %i, align 4, !dbg !13
%tmp = load i32* %i, align 4, !dbg !14
ret i32 %tmp, !dbg !14
}
declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone
define i32 @f2() nounwind ssp {
; DEBUGGER: break f2
; DEBUGGER: c
; DEBUGGER: n
; DEBUGGER: p i
; CHECK: $2 = 42
entry:
call void @llvm.dbg.declare(metadata !{i32* %i}, metadata !15), !dbg !17
%i = alloca i32, align 4
store i32 42, i32* %i, align 4, !dbg !18
%tmp = load i32* %i, align 4, !dbg !19
ret i32 %tmp, !dbg !19
}
; dbg.declare is dropped, as expected, by instruction selector.
; THIS IS NOT EXPECTED TO WORK.
define i32 @f3() nounwind ssp {
entry:
call void @llvm.dbg.declare(metadata !{i32* %i}, metadata !20), !dbg !22
br label %bbr
bbr:
%i = alloca i32, align 4
store i32 42, i32* %i, align 4, !dbg !23
%tmp = load i32* %i, align 4, !dbg !24
ret i32 %tmp, !dbg !24
}
; dbg.declare is dropped, as expected, by instruction selector.
; THIS IS NOT EXPECTED TO WORK.
define i32 @f4() nounwind ssp {
entry:
%i = alloca i32, align 4
call void @llvm.dbg.declare(metadata !{i32* %i}, metadata !25), !dbg !27
ret i32 42, !dbg !28
}
define i32 @main() nounwind ssp {
entry:
%retval = alloca i32, align 4
store i32 0, i32* %retval
%call = call i32 @f1(), !dbg !29
%call1 = call i32 @f2(), !dbg !31
%call2 = call i32 @f3(), !dbg !32
%call3 = call i32 @f4(), !dbg !33
ret i32 0, !dbg !34
}
!llvm.dbg.sp = !{!0, !6, !7, !8, !9}
!0 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f1", metadata !"f1", metadata !"f1", metadata !1, i32 2, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 ()* @f1} ; [ DW_TAG_subprogram ]
!1 = metadata !{i32 524329, metadata !"lv.c", metadata !"dbg_info_bugs", metadata !2} ; [ DW_TAG_file_type ]
!2 = metadata !{i32 524305, i32 0, i32 12, metadata !"lv.c", metadata !"dbg_info_bugs", metadata !"clang version 2.9 (trunk 113428)", i1 true, i1 false, metadata !"", i32 0} ; [ DW_TAG_compile_unit ]
!3 = metadata !{i32 524309, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !4, i32 0, null} ; [ DW_TAG_subroutine_type ]
!4 = metadata !{metadata !5}
!5 = metadata !{i32 524324, metadata !1, metadata !"int", metadata !1, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
!6 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f2", metadata !"f2", metadata !"f2", metadata !1, i32 8, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 ()* @f2} ; [ DW_TAG_subprogram ]
!7 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f3", metadata !"f3", metadata !"f3", metadata !1, i32 14, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 ()* @f3} ; [ DW_TAG_subprogram ]
!8 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f4", metadata !"f4", metadata !"f4", metadata !1, i32 20, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 ()* @f4} ; [ DW_TAG_subprogram ]
!9 = metadata !{i32 524334, i32 0, metadata !1, metadata !"main", metadata !"main", metadata !"main", metadata !1, i32 25, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 ()* @main} ; [ DW_TAG_subprogram ]
!10 = metadata !{i32 524544, metadata !11, metadata !"i", metadata !1, i32 3, metadata !5} ; [ DW_TAG_auto_variable ]
!11 = metadata !{i32 524299, metadata !0, i32 2, i32 10, metadata !1, i32 0} ; [ DW_TAG_lexical_block ]
!12 = metadata !{i32 3, i32 7, metadata !11, null}
!13 = metadata !{i32 4, i32 3, metadata !11, null}
!14 = metadata !{i32 5, i32 3, metadata !11, null}
!15 = metadata !{i32 524544, metadata !16, metadata !"i", metadata !1, i32 9, metadata !5} ; [ DW_TAG_auto_variable ]
!16 = metadata !{i32 524299, metadata !6, i32 8, i32 10, metadata !1, i32 1} ; [ DW_TAG_lexical_block ]
!17 = metadata !{i32 9, i32 7, metadata !16, null}
!18 = metadata !{i32 10, i32 3, metadata !16, null}
!19 = metadata !{i32 11, i32 3, metadata !16, null}
!20 = metadata !{i32 524544, metadata !21, metadata !"i", metadata !1, i32 15, metadata !5} ; [ DW_TAG_auto_variable ]
!21 = metadata !{i32 524299, metadata !7, i32 14, i32 10, metadata !1, i32 2} ; [ DW_TAG_lexical_block ]
!22 = metadata !{i32 15, i32 7, metadata !21, null}
!23 = metadata !{i32 16, i32 3, metadata !21, null}
!24 = metadata !{i32 17, i32 3, metadata !21, null}
!25 = metadata !{i32 524544, metadata !26, metadata !"i", metadata !1, i32 21, metadata !5} ; [ DW_TAG_auto_variable ]
!26 = metadata !{i32 524299, metadata !8, i32 20, i32 10, metadata !1, i32 3} ; [ DW_TAG_lexical_block ]
!27 = metadata !{i32 21, i32 7, metadata !26, null}
!28 = metadata !{i32 22, i32 3, metadata !26, null}
!29 = metadata !{i32 26, i32 3, metadata !30, null}
!30 = metadata !{i32 524299, metadata !9, i32 25, i32 12, metadata !1, i32 4} ; [ DW_TAG_lexical_block ]
!31 = metadata !{i32 27, i32 3, metadata !30, null}
!32 = metadata !{i32 28, i32 3, metadata !30, null}
!33 = metadata !{i32 29, i32 3, metadata !30, null}
!34 = metadata !{i32 30, i32 3, metadata !30, null}

View File

@@ -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: type = int (void)
int foo() {
struct Local {
static int my_number() {
return 42;
}
};
int i = 0;
i = Local::my_number();
return i + 1;
}

View File

@@ -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 61
// DEBUGGER: r
// DEBUGGER: p a
// CHECK: $1 = (A &)
// CHECK: _vptr$A =
// CHECK: 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;
}

View File

@@ -1,84 +0,0 @@
; This test checks debug info of unused, zero extended 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
; XFAIL: *
; XTARGET: darwin
; Radar 9422775
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
target triple = "x86_64-apple-macosx10.6.7"
%class.aClass = type { float }
; DEBUGGER: break aClass::setValues
; DEBUGGER: r
; DEBUGGER: p Filter
; CHECK: true
define void @_ZN6aClass9setValuesEibf(%class.aClass* nocapture %this, i32 %ch, i1 zeroext %Filter, float %a1) nounwind noinline ssp align 2 {
entry:
tail call void @llvm.dbg.value(metadata !{%class.aClass* %this}, i64 0, metadata !19), !dbg !25
tail call void @llvm.dbg.value(metadata !{i32 %ch}, i64 0, metadata !20), !dbg !26
tail call void @llvm.dbg.value(metadata !{i1 %Filter}, i64 0, metadata !21), !dbg !27
tail call void @llvm.dbg.value(metadata !{float %a1}, i64 0, metadata !22), !dbg !28
%m = getelementptr inbounds %class.aClass* %this, i64 0, i32 0, !dbg !29
store float %a1, float* %m, align 4, !dbg !29, !tbaa !31
ret void, !dbg !34
}
declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone
define i32 @main() nounwind ssp {
entry:
%a = alloca %class.aClass, align 4
call void @llvm.dbg.declare(metadata !{%class.aClass* %a}, metadata !23), !dbg !35
call void @_ZN6aClass9setValuesEibf(%class.aClass* %a, i32 undef, i1 zeroext 1, float 1.000000e+00), !dbg !36
ret i32 0, !dbg !37
}
declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone
!llvm.dbg.cu = !{!0}
!llvm.dbg.sp = !{!1, !12, !16}
!llvm.dbg.lv._ZN6aClass9setValuesEibf = !{!19, !20, !21, !22}
!llvm.dbg.lv.main = !{!23}
!0 = metadata !{i32 589841, i32 0, i32 4, metadata !"two.cpp", metadata !"/private/tmp/inc", metadata !"clang version 3.0 (trunk 131411)", i1 true, i1 true, metadata !"", i32 0} ; [ DW_TAG_compile_unit ]
!1 = metadata !{i32 589870, i32 0, metadata !2, metadata !"setValues", metadata !"setValues", metadata !"_ZN6aClass9setValuesEibf", metadata !3, i32 6, metadata !7, i1 false, i1 false, i32 0, i32 0, null, i32 256, i1 true, null, null} ; [ DW_TAG_subprogram ]
!2 = metadata !{i32 589826, metadata !0, metadata !"aClass", metadata !3, i32 2, i64 32, i64 32, i32 0, i32 0, null, metadata !4, i32 0, null, null} ; [ DW_TAG_class_type ]
!3 = metadata !{i32 589865, metadata !"./one.h", metadata !"/private/tmp/inc", metadata !0} ; [ DW_TAG_file_type ]
!4 = metadata !{metadata !5, metadata !1}
!5 = metadata !{i32 589837, metadata !3, metadata !"m", metadata !3, i32 4, i64 32, i64 32, i64 0, i32 1, metadata !6} ; [ DW_TAG_member ]
!6 = metadata !{i32 589860, metadata !0, metadata !"float", null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 4} ; [ DW_TAG_base_type ]
!7 = metadata !{i32 589845, metadata !3, metadata !"", metadata !3, i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !8, i32 0, i32 0} ; [ DW_TAG_subroutine_type ]
!8 = metadata !{null, metadata !9, metadata !10, metadata !11, metadata !6}
!9 = metadata !{i32 589839, metadata !0, metadata !"", i32 0, i32 0, i64 64, i64 64, i64 0, i32 64, metadata !2} ; [ DW_TAG_pointer_type ]
!10 = metadata !{i32 589860, metadata !0, metadata !"int", null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
!11 = metadata !{i32 589860, metadata !0, metadata !"bool", null, i32 0, i64 8, i64 8, i64 0, i32 0, i32 2} ; [ DW_TAG_base_type ]
!12 = metadata !{i32 589870, i32 0, metadata !13, metadata !"setValues", metadata !"setValues", metadata !"_ZN6aClass9setValuesEibf", metadata !13, i32 4, metadata !14, i1 false, i1 true, i32 0, i32 0, i32 0, i32 256, i1 true, void (%class.aClass*, i32, i1, float)* @_ZN6aClass9setValuesEibf, null, metadata !1} ; [ DW_TAG_subprogram ]
!13 = metadata !{i32 589865, metadata !"two.cpp", metadata !"/private/tmp/inc", metadata !0} ; [ DW_TAG_file_type ]
!14 = metadata !{i32 589845, metadata !13, metadata !"", metadata !13, i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !15, i32 0, i32 0} ; [ DW_TAG_subroutine_type ]
!15 = metadata !{null}
!16 = metadata !{i32 589870, i32 0, metadata !13, metadata !"main", metadata !"main", metadata !"", metadata !13, i32 9, metadata !17, i1 false, i1 true, i32 0, i32 0, i32 0, i32 256, i1 true, i32 ()* @main, null, null} ; [ DW_TAG_subprogram ]
!17 = metadata !{i32 589845, metadata !13, metadata !"", metadata !13, i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !18, i32 0, i32 0} ; [ DW_TAG_subroutine_type ]
!18 = metadata !{metadata !10}
!19 = metadata !{i32 590081, metadata !12, metadata !"this", metadata !13, i32 16777219, metadata !9, i32 64} ; [ DW_TAG_arg_variable ]
!20 = metadata !{i32 590081, metadata !12, metadata !"ch", metadata !13, i32 33554435, metadata !10, i32 0} ; [ DW_TAG_arg_variable ]
!21 = metadata !{i32 590081, metadata !12, metadata !"Filter", metadata !13, i32 50331651, metadata !11, i32 0} ; [ DW_TAG_arg_variable ]
!22 = metadata !{i32 590081, metadata !12, metadata !"a1", metadata !13, i32 67108867, metadata !6, i32 0} ; [ DW_TAG_arg_variable ]
!23 = metadata !{i32 590080, metadata !24, metadata !"a", metadata !13, i32 10, metadata !2, i32 0} ; [ DW_TAG_auto_variable ]
!24 = metadata !{i32 589835, metadata !16, i32 9, i32 1, metadata !13, i32 1} ; [ DW_TAG_lexical_block ]
!25 = metadata !{i32 3, i32 40, metadata !12, null}
!26 = metadata !{i32 3, i32 54, metadata !12, null}
!27 = metadata !{i32 3, i32 63, metadata !12, null}
!28 = metadata !{i32 3, i32 77, metadata !12, null}
!29 = metadata !{i32 5, i32 2, metadata !30, null}
!30 = metadata !{i32 589835, metadata !12, i32 4, i32 1, metadata !13, i32 0} ; [ DW_TAG_lexical_block ]
!31 = metadata !{metadata !"float", metadata !32}
!32 = metadata !{metadata !"omnipotent char", metadata !33}
!33 = metadata !{metadata !"Simple C/C++ TBAA", null}
!34 = metadata !{i32 6, i32 1, metadata !30, null}
!35 = metadata !{i32 10, i32 11, metadata !24, null}
!36 = metadata !{i32 11, i32 4, metadata !24, null}
!37 = metadata !{i32 12, i32 4, metadata !24, null}

View File

@@ -1,2 +0,0 @@
N: Peter Collingbourne
E: peter@pcc.me.uk

View File

@@ -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-2012 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-2012 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.

View File

@@ -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/

View File

@@ -1,91 +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.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)
else:
self.clean_files.append(output)
def _as_list(self, input):
if isinstance(input, list):
return input
return [input]
def finish(self):
self.output.write('all:: %s\n\n' % ' '.join(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

View File

@@ -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('$', '$$')

View File

@@ -1,3 +0,0 @@
#!/bin/sh
clang -ccc-host-triple ptx32--nvidiacl -Iptx-nvidiacl/include -Igeneric/include -Xclang -mlink-bitcode-file -Xclang ptx32--nvidiacl/lib/builtins.bc -include clc/clc.h -Dcl_clang_storage_class_specifiers "$@"

View File

@@ -1,133 +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")
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('-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"
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(['--ldflags', '--libs', 'core', 'bitreader', 'bitwriter'])
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')
default_targets = ['ptx32--nvidiacl', 'ptx64--nvidiacl']
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', 'c++', llvm_cxxflags)
b.rule("LLVM_TOOL_LINK", "c++ -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')
manifest_deps = set([sys.argv[0], os.path.join(srcdir, 'build', 'metabuild.py'),
os.path.join(srcdir, 'build', 'ninja_syntax.py')])
for target in targets:
(t_arch, t_vendor, t_os) = target.split('-')
archs = [t_arch]
if t_arch == 'ptx32' or t_arch == 'ptx64':
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)
subdirs = [subdir for subdir in subdirs
if os.path.isdir(os.path.join(srcdir, subdir, 'include')) or
os.path.isfile(os.path.join(srcdir, subdir, 'lib', 'SOURCES'))]
clang_cl_includes = ' '.join(["-I%s" % os.path.join(srcdir, subdir, 'include')
for subdir in subdirs])
# The rule for building a .bc file for the specified architecture using clang.
clang_bc_flags = "-ccc-host-triple %s -I`dirname $in` %s " \
"-Dcl_clang_storage_class_specifiers " \
"-emit-llvm" % (target, clang_cl_includes)
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()
for subdir in subdirs:
src_libdir = os.path.join(srcdir, subdir, 'lib')
if not os.path.isdir(src_libdir):
continue
subdir_list_file = os.path.join(src_libdir, 'SOURCES')
manifest_deps.add(subdir_list_file)
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 + '.bc')
objects.append(obj)
src_file = os.path.join(src_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.bc')
builtins_opt_bc = os.path.join(target, 'lib', 'builtins.opt.bc')
builtins_bc = os.path.join(target, 'lib', 'builtins.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)
b.rule("configure", command = ' '.join(sys.argv), description = 'CONFIGURE',
generator = True)
b.build(b.output_filename(), 'configure', list(manifest_deps))
b.finish()

View File

@@ -1,53 +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_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_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_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_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_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)

View File

@@ -1,57 +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.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/sin.h>
#include <clc/math/sqrt.h>
#include <clc/math/native_cos.h>
#include <clc/math/native_divide.h>
#include <clc/math/native_sin.h>
#include <clc/math/native_sqrt.h>
/* 6.11.3 Integer Functions */
#include <clc/integer/abs.h>
#include <clc/integer/abs_diff.h>
#include <clc/integer/add_sat.h>
/* 6.11.5 Geometric Functions */
#include <clc/geometric/cross.h>
#include <clc/geometric/length.h>
#include <clc/geometric/normalize.h>
/* 6.11.6 Relational Functions */
#include <clc/relational/select.h>
/* 6.11.8 Synchronization Functions */
#include <clc/synchronization/cl_mem_fence_flags.h>
#include <clc/synchronization/barrier.h>
#pragma OPENCL EXTENSION all : disable

View File

@@ -1,4 +0,0 @@
#define _CLC_OVERLOAD __attribute__((overloadable))
#define _CLC_DECL
#define _CLC_DEF __attribute__((always_inline))
#define _CLC_INLINE __attribute__((always_inline)) static inline

View File

@@ -1,42 +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)); \
}

View File

@@ -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

View File

@@ -1,51 +0,0 @@
#define GENTYPE float
#include BODY
#undef GENTYPE
#define GENTYPE float2
#include BODY
#undef GENTYPE
#define GENTYPE float3
#include BODY
#undef GENTYPE
#define GENTYPE float4
#include BODY
#undef GENTYPE
#define GENTYPE float8
#include BODY
#undef GENTYPE
#define GENTYPE float16
#include BODY
#undef GENTYPE
#ifdef cl_khr_fp64
#define GENTYPE double
#include BODY
#undef GENTYPE
#define GENTYPE double2
#include BODY
#undef GENTYPE
#define GENTYPE double3
#include BODY
#undef GENTYPE
#define GENTYPE double4
#include BODY
#undef GENTYPE
#define GENTYPE double8
#include BODY
#undef GENTYPE
#define GENTYPE double16
#include BODY
#undef GENTYPE
#endif
#undef BODY

View File

@@ -1,2 +0,0 @@
_CLC_OVERLOAD _CLC_DECL float3 cross(float3 p0, float3 p1);
_CLC_OVERLOAD _CLC_DECL float4 cross(float4 p0, float4 p1);

View File

@@ -1,2 +0,0 @@
#define BODY <clc/geometric/distance.inc>
#include <clc/geometric/floatn.inc>

View File

@@ -1,2 +0,0 @@
#define BODY <clc/geometric/dot.inc>
#include <clc/geometric/floatn.inc>

View File

@@ -1,35 +0,0 @@
#define FLOATN float
#include BODY
#undef FLOATN
#define FLOATN float2
#include BODY
#undef FLOATN
#define FLOATN float3
#include BODY
#undef FLOATN
#define FLOATN float4
#include BODY
#undef FLOATN
#ifdef cl_khr_fp64
#define FLOATN double
#include BODY
#undef FLOATN
#define FLOATN double2
#include BODY
#undef FLOATN
#define FLOATN double3
#include BODY
#undef FLOATN
#define FLOATN double4
#include BODY
#undef FLOATN
#endif
#undef BODY

View File

@@ -1,2 +0,0 @@
#define BODY <clc/geometric/length.inc>
#include <clc/geometric/floatn.inc>

View File

@@ -1 +0,0 @@
_CLC_OVERLOAD _CLC_DECL float length(FLOATN p0);

View File

@@ -1,2 +0,0 @@
#define BODY <clc/geometric/normalize.inc>
#include <clc/geometric/floatn.inc>

View File

@@ -1 +0,0 @@
_CLC_OVERLOAD _CLC_DECL FLOATN normalize(FLOATN p);

View File

@@ -1,2 +0,0 @@
#define BODY <clc/integer/abs.inc>
#include <clc/integer/gentype.inc>

View File

@@ -1 +0,0 @@
_CLC_OVERLOAD _CLC_DECL UGENTYPE abs(GENTYPE x);

View File

@@ -1,2 +0,0 @@
#define BODY <clc/integer/abs_diff.inc>
#include <clc/integer/gentype.inc>

View File

@@ -1 +0,0 @@
_CLC_OVERLOAD _CLC_DECL UGENTYPE abs_diff(GENTYPE x, GENTYPE y);

View File

@@ -1,2 +0,0 @@
#define BODY <clc/integer/add_sat.inc>
#include <clc/integer/gentype.inc>

View File

@@ -1 +0,0 @@
_CLC_OVERLOAD _CLC_DECL GENTYPE add_sat(GENTYPE x, GENTYPE y);

View File

@@ -1,385 +0,0 @@
#define GENTYPE char
#define UGENTYPE uchar
#define SGENTYPE char
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE char2
#define UGENTYPE uchar2
#define SGENTYPE char2
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE char3
#define UGENTYPE uchar3
#define SGENTYPE char3
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE char4
#define UGENTYPE uchar4
#define SGENTYPE char4
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE char8
#define UGENTYPE uchar8
#define SGENTYPE char8
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE char16
#define UGENTYPE uchar16
#define SGENTYPE char16
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE uchar
#define UGENTYPE uchar
#define SGENTYPE char
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE uchar2
#define UGENTYPE uchar2
#define SGENTYPE char2
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE uchar3
#define UGENTYPE uchar3
#define SGENTYPE char3
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE uchar4
#define UGENTYPE uchar4
#define SGENTYPE char4
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE uchar8
#define UGENTYPE uchar8
#define SGENTYPE char8
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE uchar16
#define UGENTYPE uchar16
#define SGENTYPE char16
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE short
#define UGENTYPE ushort
#define SGENTYPE short
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE short2
#define UGENTYPE ushort2
#define SGENTYPE short2
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE short3
#define UGENTYPE ushort3
#define SGENTYPE short3
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE short4
#define UGENTYPE ushort4
#define SGENTYPE short4
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE short8
#define UGENTYPE ushort8
#define SGENTYPE short8
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE short16
#define UGENTYPE ushort16
#define SGENTYPE short16
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE ushort
#define UGENTYPE ushort
#define SGENTYPE short
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE ushort2
#define UGENTYPE ushort2
#define SGENTYPE short2
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE ushort3
#define UGENTYPE ushort3
#define SGENTYPE short3
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE ushort4
#define UGENTYPE ushort4
#define SGENTYPE short4
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE ushort8
#define UGENTYPE ushort8
#define SGENTYPE short8
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE ushort16
#define UGENTYPE ushort16
#define SGENTYPE short16
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE int
#define UGENTYPE uint
#define SGENTYPE int
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE int2
#define UGENTYPE uint2
#define SGENTYPE int2
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE int3
#define UGENTYPE uint3
#define SGENTYPE int3
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE int4
#define UGENTYPE uint4
#define SGENTYPE int4
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE int8
#define UGENTYPE uint8
#define SGENTYPE int8
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE int16
#define UGENTYPE uint16
#define SGENTYPE int16
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE uint
#define UGENTYPE uint
#define SGENTYPE int
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE uint2
#define UGENTYPE uint2
#define SGENTYPE int2
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE uint3
#define UGENTYPE uint3
#define SGENTYPE int3
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE uint4
#define UGENTYPE uint4
#define SGENTYPE int4
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE uint8
#define UGENTYPE uint8
#define SGENTYPE int8
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE uint16
#define UGENTYPE uint16
#define SGENTYPE int16
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE long
#define UGENTYPE ulong
#define SGENTYPE long
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE long2
#define UGENTYPE ulong2
#define SGENTYPE long2
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE long3
#define UGENTYPE ulong3
#define SGENTYPE long3
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE long4
#define UGENTYPE ulong4
#define SGENTYPE long4
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE long8
#define UGENTYPE ulong8
#define SGENTYPE long8
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE long16
#define UGENTYPE ulong16
#define SGENTYPE long16
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE ulong
#define UGENTYPE ulong
#define SGENTYPE long
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE ulong2
#define UGENTYPE ulong2
#define SGENTYPE long2
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE ulong3
#define UGENTYPE ulong3
#define SGENTYPE long3
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE ulong4
#define UGENTYPE ulong4
#define SGENTYPE long4
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE ulong8
#define UGENTYPE ulong8
#define SGENTYPE long8
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE ulong16
#define UGENTYPE ulong16
#define SGENTYPE long16
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#undef BODY

View File

@@ -1,6 +0,0 @@
#undef cos
#define cos __clc_cos
#define FUNCTION __clc_cos
#define INTRINSIC "llvm.cos"
#include <clc/math/unary_intrin.inc>

View File

@@ -1 +0,0 @@
#define native_cos cos

View File

@@ -1 +0,0 @@
#define native_divide(x, y) ((x) / (y))

View File

@@ -1 +0,0 @@
#define native_sin sin

View File

@@ -1 +0,0 @@
#define native_sqrt sqrt

View File

@@ -1,6 +0,0 @@
#undef sin
#define sin __clc_sin
#define FUNCTION __clc_sin
#define INTRINSIC "llvm.sin"
#include <clc/math/unary_intrin.inc>

View File

@@ -1,6 +0,0 @@
#undef sqrt
#define sqrt __clc_sqrt
#define FUNCTION __clc_sqrt
#define INTRINSIC "llvm.sqrt"
#include <clc/math/unary_intrin.inc>

View File

@@ -1 +0,0 @@
_CLC_OVERLOAD _CLC_DECL GENTYPE FUNCTION(GENTYPE x);

View File

@@ -1,18 +0,0 @@
_CLC_OVERLOAD float FUNCTION(float f) __asm(INTRINSIC ".f32");
_CLC_OVERLOAD float2 FUNCTION(float2 f) __asm(INTRINSIC ".v2f32");
_CLC_OVERLOAD float3 FUNCTION(float3 f) __asm(INTRINSIC ".v3f32");
_CLC_OVERLOAD float4 FUNCTION(float4 f) __asm(INTRINSIC ".v4f32");
_CLC_OVERLOAD float8 FUNCTION(float8 f) __asm(INTRINSIC ".v8f32");
_CLC_OVERLOAD float16 FUNCTION(float16 f) __asm(INTRINSIC ".v16f32");
#ifdef cl_khr_fp64
_CLC_OVERLOAD double FUNCTION(double d) __asm(INTRINSIC ".f64");
_CLC_OVERLOAD double2 FUNCTION(double2 d) __asm(INTRINSIC ".v2f64");
_CLC_OVERLOAD double3 FUNCTION(double3 d) __asm(INTRINSIC ".v3f64");
_CLC_OVERLOAD double4 FUNCTION(double4 d) __asm(INTRINSIC ".v4f64");
_CLC_OVERLOAD double8 FUNCTION(double8 d) __asm(INTRINSIC ".v8f64");
_CLC_OVERLOAD double16 FUNCTION(double16 d) __asm(INTRINSIC ".v16f64");
#endif
#undef FUNCTION
#undef INTRINSIC

View File

@@ -1 +0,0 @@
#define select(a, b, c) ((c) ? (b) : (a))

View File

@@ -1,4 +0,0 @@
typedef uint cl_mem_fence_flags;
#define CLK_LOCAL_MEM_FENCE 1
#define CLK_GLOBAL_MEM_FENCE 2

View File

@@ -1,8 +0,0 @@
geometric/cross.cl
geometric/dot.cl
geometric/length.cl
geometric/normalize.cl
integer/abs.cl
integer/add_sat.cl
integer/add_sat.ll
integer/add_sat_impl.ll

View File

@@ -1,11 +0,0 @@
#include <clc/clc.h>
_CLC_OVERLOAD _CLC_DEF float3 cross(float3 p0, float3 p1) {
return (float3)(p0.y*p1.z - p0.z*p1.y, p0.z*p1.x - p0.x*p1.z,
p0.x*p1.y - p0.y*p1.x);
}
_CLC_OVERLOAD _CLC_DEF float4 cross(float4 p0, float4 p1) {
return (float4)(p0.y*p1.z - p0.z*p1.y, p0.z*p1.x - p0.x*p1.z,
p0.x*p1.y - p0.y*p1.x, 0.f);
}

View File

@@ -1,17 +0,0 @@
#include <clc/clc.h>
_CLC_OVERLOAD _CLC_DEF float dot(float p0, float p1) {
return p0*p1;
}
_CLC_OVERLOAD _CLC_DEF float dot(float2 p0, float2 p1) {
return p0.x*p1.x + p0.y*p1.y;
}
_CLC_OVERLOAD _CLC_DEF float dot(float3 p0, float3 p1) {
return p0.x*p1.x + p0.y*p1.y + p0.z*p1.z;
}
_CLC_OVERLOAD _CLC_DEF float dot(float4 p0, float4 p1) {
return p0.x*p1.x + p0.y*p1.y + p0.z*p1.z + p0.w*p1.w;
}

View File

@@ -1,4 +0,0 @@
#include <clc/clc.h>
#define BODY "length.inc"
#include <clc/geometric/floatn.inc>

View File

@@ -1,3 +0,0 @@
_CLC_OVERLOAD _CLC_DEF float length(FLOATN p) {
return native_sqrt(dot(p, p));
}

View File

@@ -1,4 +0,0 @@
#include <clc/clc.h>
#define BODY "normalize.inc"
#include <clc/geometric/floatn.inc>

View File

@@ -1,3 +0,0 @@
_CLC_OVERLOAD _CLC_DEF FLOATN normalize(FLOATN p) {
return p/length(p);
}

View File

@@ -1,4 +0,0 @@
#include <clc/clc.h>
#define BODY <abs.inc>
#include <clc/integer/gentype.inc>

View File

@@ -1,3 +0,0 @@
_CLC_OVERLOAD _CLC_DEF UGENTYPE abs(GENTYPE x) {
return __builtin_astype((GENTYPE)(x > (GENTYPE)(0) ? x : -x), UGENTYPE);
}

View File

@@ -1,4 +0,0 @@
#include <clc/clc.h>
#define BODY <abs_diff.inc>
#include <clc/integer/gentype.inc>

View File

@@ -1,3 +0,0 @@
_CLC_OVERLOAD _CLC_DEF UGENTYPE abs_diff(GENTYPE x) {
return __builtin_astype((GENTYPE)(x > y ? x-y : y-x), UGENTYPE);
}

View File

@@ -1,52 +0,0 @@
#include <clc/clc.h>
// From add_sat.ll
_CLC_DECL char __clc_add_sat_s8(char, char);
_CLC_DECL char __clc_add_sat_u8(uchar, uchar);
_CLC_DECL char __clc_add_sat_s16(short, short);
_CLC_DECL char __clc_add_sat_u16(ushort, ushort);
_CLC_DECL char __clc_add_sat_s32(int, int);
_CLC_DECL char __clc_add_sat_u32(uint, uint);
_CLC_DECL char __clc_add_sat_s64(long, long);
_CLC_DECL char __clc_add_sat_u64(ulong, ulong);
_CLC_OVERLOAD _CLC_DEF char add_sat(char x, char y) {
return __clc_add_sat_s8(x, y);
}
_CLC_OVERLOAD _CLC_DEF uchar add_sat(uchar x, uchar y) {
return __clc_add_sat_u8(x, y);
}
_CLC_OVERLOAD _CLC_DEF short add_sat(short x, short y) {
return __clc_add_sat_s16(x, y);
}
_CLC_OVERLOAD _CLC_DEF ushort add_sat(ushort x, ushort y) {
return __clc_add_sat_u16(x, y);
}
_CLC_OVERLOAD _CLC_DEF int add_sat(int x, int y) {
return __clc_add_sat_s32(x, y);
}
_CLC_OVERLOAD _CLC_DEF uint add_sat(uint x, uint y) {
return __clc_add_sat_u32(x, y);
}
_CLC_OVERLOAD _CLC_DEF long add_sat(long x, long y) {
return __clc_add_sat_s64(x, y);
}
_CLC_OVERLOAD _CLC_DEF ulong add_sat(ulong x, ulong y) {
return __clc_add_sat_u64(x, y);
}
_CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, char, add_sat, char, char)
_CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, uchar, add_sat, uchar, uchar)
_CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, short, add_sat, short, short)
_CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, ushort, add_sat, ushort, ushort)
_CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, int, add_sat, int, int)
_CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, uint, add_sat, uint, uint)
_CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, long, add_sat, long, long)
_CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, ulong, add_sat, ulong, ulong)

View File

@@ -1,55 +0,0 @@
declare i8 @__clc_add_sat_impl_s8(i8 %x, i8 %y)
define linkonce_odr i8 @__clc_add_sat_s8(i8 %x, i8 %y) nounwind readnone alwaysinline {
%call = call i8 @__clc_add_sat_impl_s8(i8 %x, i8 %y)
ret i8 %call
}
declare i8 @__clc_add_sat_impl_u8(i8 %x, i8 %y)
define linkonce_odr i8 @__clc_add_sat_u8(i8 %x, i8 %y) nounwind readnone alwaysinline {
%call = call i8 @__clc_add_sat_impl_u8(i8 %x, i8 %y)
ret i8 %call
}
declare i16 @__clc_add_sat_impl_s16(i16 %x, i16 %y)
define linkonce_odr i16 @__clc_add_sat_s16(i16 %x, i16 %y) nounwind readnone alwaysinline {
%call = call i16 @__clc_add_sat_impl_s16(i16 %x, i16 %y)
ret i16 %call
}
declare i16 @__clc_add_sat_impl_u16(i16 %x, i16 %y)
define linkonce_odr i16 @__clc_add_sat_u16(i16 %x, i16 %y) nounwind readnone alwaysinline {
%call = call i16 @__clc_add_sat_impl_u16(i16 %x, i16 %y)
ret i16 %call
}
declare i32 @__clc_add_sat_impl_s32(i32 %x, i32 %y)
define linkonce_odr i32 @__clc_add_sat_s32(i32 %x, i32 %y) nounwind readnone alwaysinline {
%call = call i32 @__clc_add_sat_impl_s32(i32 %x, i32 %y)
ret i32 %call
}
declare i32 @__clc_add_sat_impl_u32(i32 %x, i32 %y)
define linkonce_odr i32 @__clc_add_sat_u32(i32 %x, i32 %y) nounwind readnone alwaysinline {
%call = call i32 @__clc_add_sat_impl_u32(i32 %x, i32 %y)
ret i32 %call
}
declare i64 @__clc_add_sat_impl_s64(i64 %x, i64 %y)
define linkonce_odr i64 @__clc_add_sat_s64(i64 %x, i64 %y) nounwind readnone alwaysinline {
%call = call i64 @__clc_add_sat_impl_s64(i64 %x, i64 %y)
ret i64 %call
}
declare i64 @__clc_add_sat_impl_u64(i64 %x, i64 %y)
define linkonce_odr i64 @__clc_add_sat_u64(i64 %x, i64 %y) nounwind readnone alwaysinline {
%call = call i64 @__clc_add_sat_impl_u64(i64 %x, i64 %y)
ret i64 %call
}

View File

@@ -1,83 +0,0 @@
declare {i8, i1} @llvm.sadd.with.overflow.i8(i8, i8)
declare {i8, i1} @llvm.uadd.with.overflow.i8(i8, i8)
define linkonce_odr i8 @__clc_add_sat_impl_s8(i8 %x, i8 %y) nounwind readnone alwaysinline {
%call = call {i8, i1} @llvm.sadd.with.overflow.i8(i8 %x, i8 %y)
%res = extractvalue {i8, i1} %call, 0
%over = extractvalue {i8, i1} %call, 1
%x.msb = ashr i8 %x, 7
%x.limit = xor i8 %x.msb, 127
%sat = select i1 %over, i8 %x.limit, i8 %res
ret i8 %sat
}
define linkonce_odr i8 @__clc_add_sat_impl_u8(i8 %x, i8 %y) nounwind readnone alwaysinline {
%call = call {i8, i1} @llvm.uadd.with.overflow.i8(i8 %x, i8 %y)
%res = extractvalue {i8, i1} %call, 0
%over = extractvalue {i8, i1} %call, 1
%sat = select i1 %over, i8 -1, i8 %res
ret i8 %sat
}
declare {i16, i1} @llvm.sadd.with.overflow.i16(i16, i16)
declare {i16, i1} @llvm.uadd.with.overflow.i16(i16, i16)
define linkonce_odr i16 @__clc_add_sat_impl_s16(i16 %x, i16 %y) nounwind readnone alwaysinline {
%call = call {i16, i1} @llvm.sadd.with.overflow.i16(i16 %x, i16 %y)
%res = extractvalue {i16, i1} %call, 0
%over = extractvalue {i16, i1} %call, 1
%x.msb = ashr i16 %x, 15
%x.limit = xor i16 %x.msb, 32767
%sat = select i1 %over, i16 %x.limit, i16 %res
ret i16 %sat
}
define linkonce_odr i16 @__clc_add_sat_impl_u16(i16 %x, i16 %y) nounwind readnone alwaysinline {
%call = call {i16, i1} @llvm.uadd.with.overflow.i16(i16 %x, i16 %y)
%res = extractvalue {i16, i1} %call, 0
%over = extractvalue {i16, i1} %call, 1
%sat = select i1 %over, i16 -1, i16 %res
ret i16 %sat
}
declare {i32, i1} @llvm.sadd.with.overflow.i32(i32, i32)
declare {i32, i1} @llvm.uadd.with.overflow.i32(i32, i32)
define linkonce_odr i32 @__clc_add_sat_impl_s32(i32 %x, i32 %y) nounwind readnone alwaysinline {
%call = call {i32, i1} @llvm.sadd.with.overflow.i32(i32 %x, i32 %y)
%res = extractvalue {i32, i1} %call, 0
%over = extractvalue {i32, i1} %call, 1
%x.msb = ashr i32 %x, 31
%x.limit = xor i32 %x.msb, 2147483647
%sat = select i1 %over, i32 %x.limit, i32 %res
ret i32 %sat
}
define linkonce_odr i32 @__clc_add_sat_impl_u32(i32 %x, i32 %y) nounwind readnone alwaysinline {
%call = call {i32, i1} @llvm.uadd.with.overflow.i32(i32 %x, i32 %y)
%res = extractvalue {i32, i1} %call, 0
%over = extractvalue {i32, i1} %call, 1
%sat = select i1 %over, i32 -1, i32 %res
ret i32 %sat
}
declare {i64, i1} @llvm.sadd.with.overflow.i64(i64, i64)
declare {i64, i1} @llvm.uadd.with.overflow.i64(i64, i64)
define linkonce_odr i64 @__clc_add_sat_impl_s64(i64 %x, i64 %y) nounwind readnone alwaysinline {
%call = call {i64, i1} @llvm.sadd.with.overflow.i64(i64 %x, i64 %y)
%res = extractvalue {i64, i1} %call, 0
%over = extractvalue {i64, i1} %call, 1
%x.msb = ashr i64 %x, 63
%x.limit = xor i64 %x.msb, 9223372036854775807
%sat = select i1 %over, i64 %x.limit, i64 %res
ret i64 %sat
}
define linkonce_odr i64 @__clc_add_sat_impl_u64(i64 %x, i64 %y) nounwind readnone alwaysinline {
%call = call {i64, i1} @llvm.uadd.with.overflow.i64(i64 %x, i64 %y)
%res = extractvalue {i64, i1} %call, 0
%over = extractvalue {i64, i1} %call, 1
%sat = select i1 %over, i64 -1, i64 %res
ret i64 %sat
}

View File

@@ -1,6 +0,0 @@
_CLC_INLINE void barrier(cl_mem_fence_flags flags) {
if (flags & CLK_LOCAL_MEM_FENCE) {
__builtin_ptx_bar_sync(0);
}
}

View File

@@ -1,8 +0,0 @@
_CLC_INLINE size_t get_global_id(uint dim) {
switch (dim) {
case 0: return __builtin_ptx_read_ctaid_x()*__builtin_ptx_read_ntid_x()+__builtin_ptx_read_tid_x();
case 1: return __builtin_ptx_read_ctaid_y()*__builtin_ptx_read_ntid_y()+__builtin_ptx_read_tid_y();
case 2: return __builtin_ptx_read_ctaid_z()*__builtin_ptx_read_ntid_z()+__builtin_ptx_read_tid_z();
default: return 0;
}
}

View File

@@ -1,8 +0,0 @@
_CLC_INLINE size_t get_global_size(uint dim) {
switch (dim) {
case 0: return __builtin_ptx_read_nctaid_x()*__builtin_ptx_read_ntid_x();
case 1: return __builtin_ptx_read_nctaid_y()*__builtin_ptx_read_ntid_y();
case 2: return __builtin_ptx_read_nctaid_z()*__builtin_ptx_read_ntid_z();
default: return 0;
}
}

View File

@@ -1,8 +0,0 @@
_CLC_INLINE size_t get_group_id(uint dim) {
switch (dim) {
case 0: return __builtin_ptx_read_ctaid_x();
case 1: return __builtin_ptx_read_ctaid_y();
case 2: return __builtin_ptx_read_ctaid_z();
default: return 0;
}
}

View File

@@ -1,8 +0,0 @@
_CLC_INLINE size_t get_local_id(uint dim) {
switch (dim) {
case 0: return __builtin_ptx_read_tid_x();
case 1: return __builtin_ptx_read_tid_y();
case 2: return __builtin_ptx_read_tid_z();
default: return 0;
}
}

View File

@@ -1,8 +0,0 @@
_CLC_INLINE size_t get_local_size(uint dim) {
switch (dim) {
case 0: return __builtin_ptx_read_ntid_x();
case 1: return __builtin_ptx_read_ntid_y();
case 2: return __builtin_ptx_read_ntid_z();
default: return 0;
}
}

View File

@@ -1,8 +0,0 @@
_CLC_INLINE size_t get_num_groups(uint dim) {
switch (dim) {
case 0: return __builtin_ptx_read_nctaid_x();
case 1: return __builtin_ptx_read_nctaid_y();
case 2: return __builtin_ptx_read_nctaid_z();
default: return 0;
}
}

View File

@@ -1 +0,0 @@
integer/add_sat.ll

View File

@@ -1,55 +0,0 @@
declare i8 @__clc_add_sat_impl_s8(i8 %x, i8 %y)
define linkonce_odr ptx_device i8 @__clc_add_sat_s8(i8 %x, i8 %y) nounwind readnone alwaysinline {
%call = call i8 @__clc_add_sat_impl_s8(i8 %x, i8 %y)
ret i8 %call
}
declare i8 @__clc_add_sat_impl_u8(i8 %x, i8 %y)
define linkonce_odr ptx_device i8 @__clc_add_sat_u8(i8 %x, i8 %y) nounwind readnone alwaysinline {
%call = call i8 @__clc_add_sat_impl_u8(i8 %x, i8 %y)
ret i8 %call
}
declare i16 @__clc_add_sat_impl_s16(i16 %x, i16 %y)
define linkonce_odr ptx_device i16 @__clc_add_sat_s16(i16 %x, i16 %y) nounwind readnone alwaysinline {
%call = call i16 @__clc_add_sat_impl_s16(i16 %x, i16 %y)
ret i16 %call
}
declare i16 @__clc_add_sat_impl_u16(i16 %x, i16 %y)
define linkonce_odr ptx_device i16 @__clc_add_sat_u16(i16 %x, i16 %y) nounwind readnone alwaysinline {
%call = call i16 @__clc_add_sat_impl_u16(i16 %x, i16 %y)
ret i16 %call
}
declare i32 @__clc_add_sat_impl_s32(i32 %x, i32 %y)
define linkonce_odr ptx_device i32 @__clc_add_sat_s32(i32 %x, i32 %y) nounwind readnone alwaysinline {
%call = call i32 @__clc_add_sat_impl_s32(i32 %x, i32 %y)
ret i32 %call
}
declare i32 @__clc_add_sat_impl_u32(i32 %x, i32 %y)
define linkonce_odr ptx_device i32 @__clc_add_sat_u32(i32 %x, i32 %y) nounwind readnone alwaysinline {
%call = call i32 @__clc_add_sat_impl_u32(i32 %x, i32 %y)
ret i32 %call
}
declare i64 @__clc_add_sat_impl_s64(i64 %x, i64 %y)
define linkonce_odr ptx_device i64 @__clc_add_sat_s64(i64 %x, i64 %y) nounwind readnone alwaysinline {
%call = call i64 @__clc_add_sat_impl_s64(i64 %x, i64 %y)
ret i64 %call
}
declare i64 @__clc_add_sat_impl_u64(i64 %x, i64 %y)
define linkonce_odr ptx_device i64 @__clc_add_sat_u64(i64 %x, i64 %y) nounwind readnone alwaysinline {
%call = call i64 @__clc_add_sat_impl_u64(i64 %x, i64 %y)
ret i64 %call
}

Some files were not shown because too many files have changed in this diff Show More