Add rsForEachInternal
Bug: 23535985
Added a compiler intrinsic rsParallelFor to the runtime API, which
is translated into an internal API (rsForEachInternal) by slang.
Added a test to RsTest (for native) and RSTest_CompatLib
(for support).
Enhanced the auto api generator to handle ellipsis argument,
intrinsics, internal-only APIs, and special level for API under
development.
Change-Id: I6e2cf3db868f426aa8e0b9a77732b66c1e6b9f03
diff --git a/api/Specification.h b/api/Specification.h
index 87969a6..d3fbad5 100644
--- a/api/Specification.h
+++ b/api/Specification.h
@@ -19,6 +19,7 @@
// See Generator.cpp for documentation of the .spec file format.
+#include <climits>
#include <fstream>
#include <list>
#include <map>
@@ -124,8 +125,8 @@
* If non zero, both versions should be at least 9, the API level that introduced
* RenderScript.
*/
- int minVersion;
- int maxVersion;
+ unsigned int minVersion;
+ unsigned int maxVersion;
// Either 0, 32 or 64. If 0, this definition is valid for both 32 and 64 bits.
int intSize;
@@ -134,12 +135,14 @@
* we are interested in. This may alter maxVersion. This method returns false if the
* minVersion is greater than the maxApiLevel.
*/
- bool scan(Scanner* scanner, int maxApiLevel);
+ bool scan(Scanner* scanner, unsigned int maxApiLevel);
/* Return true if the target can be found whitin the range. */
bool includesVersion(int target) const {
return (minVersion == 0 || target >= minVersion) &&
(maxVersion == 0 || target <= maxVersion);
}
+
+ static constexpr unsigned int kUnreleasedVersion = UINT_MAX;
};
// We have three type of definitions
@@ -266,7 +269,7 @@
std::string getValue() const { return mValue; }
// Parse a constant specification and add it to specFile.
- static void scanConstantSpecification(Scanner* scanner, SpecFile* specFile, int maxApiLevel);
+ static void scanConstantSpecification(Scanner* scanner, SpecFile* specFile, unsigned int maxApiLevel);
};
enum TypeKind {
@@ -313,7 +316,7 @@
const std::vector<std::string>& getValueComments() const { return mValueComments; }
// Parse a type specification and add it to specFile.
- static void scanTypeSpecification(Scanner* scanner, SpecFile* specFile, int maxApiLevel);
+ static void scanTypeSpecification(Scanner* scanner, SpecFile* specFile, unsigned int maxApiLevel);
};
// Maximum number of placeholders (like #1, #2) in function specifications.
@@ -343,6 +346,9 @@
* "": Don't test. This is the default.
*/
std::string mTest;
+ bool mInternal; // Internal. Not visible to users. (Default: false)
+ bool mIntrinsic; // Compiler intrinsic that is lowered to an internal API.
+ // (Default: false)
std::string mAttribute; // Function attributes.
std::string mPrecisionLimit; // Maximum precision required when checking output of this
// function.
@@ -379,10 +385,13 @@
void createPermutations(Function* function, Scanner* scanner);
public:
- FunctionSpecification(Function* function) : mFunction(function), mReturn(nullptr) {}
+ FunctionSpecification(Function* function) : mFunction(function), mInternal(false),
+ mIntrinsic(false), mReturn(nullptr) {}
~FunctionSpecification();
Function* getFunction() const { return mFunction; }
+ bool isInternal() const { return mInternal; }
+ bool isIntrinsic() const { return mIntrinsic; }
std::string getAttribute() const { return mAttribute; }
std::string getTest() const { return mTest; }
std::string getPrecisionLimit() const { return mPrecisionLimit; }
@@ -402,7 +411,7 @@
void parseTest(Scanner* scanner);
// Return true if we need to generate tests for this function.
- bool hasTests(int versionOfTestFiles) const;
+ bool hasTests(unsigned int versionOfTestFiles) const;
bool hasInline() const { return mInline.size() > 0; }
@@ -415,7 +424,7 @@
}
// Parse a function specification and add it to specFile.
- static void scanFunctionSpecification(Scanner* scanner, SpecFile* specFile, int maxApiLevel);
+ static void scanFunctionSpecification(Scanner* scanner, SpecFile* specFile, unsigned int maxApiLevel);
};
/* A concrete version of a function specification, where all placeholders have been replaced by
@@ -527,7 +536,7 @@
!mDocumentedFunctions.empty();
}
- bool readSpecFile(int maxApiLevel);
+ bool readSpecFile(unsigned int maxApiLevel);
/* These are called by the parser to keep track of the specifications defined in this file.
* hasDocumentation is true if this specification containes the documentation.
@@ -562,9 +571,9 @@
/* Parse the spec file and create the object hierarchy, adding a pointer to mSpecFiles.
* We won't include information passed the specified level.
*/
- bool readSpecFile(const std::string& fileName, int maxApiLevel);
+ bool readSpecFile(const std::string& fileName, unsigned int maxApiLevel);
// Generate all the files.
- bool generateFiles(bool forVerification, int maxApiLevel) const;
+ bool generateFiles(bool forVerification, unsigned int maxApiLevel) const;
const std::vector<SpecFile*>& getSpecFiles() const { return mSpecFiles; }
const std::map<std::string, Constant*>& getConstants() const { return mConstants; }
@@ -575,7 +584,7 @@
std::string getHtmlAnchor(const std::string& name) const;
// Returns the maximum API level specified in any spec file.
- int getMaximumApiLevel();
+ unsigned int getMaximumApiLevel();
};
// Singleton that represents the collection of all the specs we're processing.