summaryrefslogtreecommitdiffstats
path: root/include
AgeCommit message (Collapse)AuthorFilesLines
2018-03-21Make PROVIDE_xxx macro more robustVictor Khimenko1-26/+26
If symbold is defined into "1" then it could be used as #if PROVIDE_xxx ... #endif That's what cland and gcc are using if -DPROVIDE_xxx is used on the command-line: https://gcc.gnu.org/onlinedocs/gcc/Preprocessor-Options.html#index-D https://clang.llvm.org/docs/ClangCommandLineReference.html Test: make BUG=75971275 Change-Id: Idcb1eb05d1823d30a64049b1c079a8b4bd34946f
2017-03-29Structure layout logic cleanup.David Gross2-1/+9
(Revert "Revert "Structure layout logic cleanup."" This reverts commit 15440179aa78ae6ca1cc5207757691071a02b0bb.) Do not run special x86-32 transformations when slang has explicitly padded structs. Verify that front end (Module) and back end (TargetMachine) agree on the layout of every exported struct type. Cannot build without slang change: https://android-review.googlesource.com/#/c/359135/ Bug: http://b/29154200 Bug: http://b/28070272 Test: (aosp_x86_64-eng emulator, full_fugu-eng, aosp_angler-eng) x (RsTest 32-bit, RsTest 64-bit, cts -m RenderscriptTest) tests/run-lit-tests.sh Tried (unmodified slang, modified bcc) and ( modified slang, unmodified bcc) and ( modified slang, modified bcc) By instrumenting modified bcc, confimed that: - Special x8632 layout transformations only run with unmodified slang, and only when test is compiled for x8632. "Modified slang" is a forthcoming slang change to add explicit padding to struct types: https://android-review.googlesource.com/#/c/359135/ Change-Id: Id938db661497710275a318e0964a36f64fcfa05b
2017-03-29Revert "Structure layout logic cleanup."David Gross2-9/+1
This reverts commit 8281b5d72ff27077c461aa22e5c51a3a69e25916. Change-Id: I3ed6617ca890c8dfd537b645357d0344746e549a Reason: AddressSanitizer: container-overflow (aosp-master/aosp_x86_64-eng build)
2017-03-28Structure layout logic cleanup.David Gross2-1/+9
Do not run special x86-32 transformations when slang has explicitly padded structs. Verify that front end (Module) and back end (TargetMachine) agree on the layout of every exported struct type. Cannot build without slang change: https://android-review.googlesource.com/#/c/299366/ Bug: http://b/29154200 Bug: http://b/28070272 Test: (aosp_x86-eng emulator, full_fugu-eng, aosp_angler-eng) x (RsTest 32-bit, RsTest 64-bit, cts -m RenderscriptTest) tests/run-lit-tests.sh Tried (unmodified slang, modified bcc) and ( modified slang, unmodified bcc) and ( modified slang, modified bcc) By instrumenting modified bcc, confimed that: - Special x8632 layout transformations only run with unmodified slang, and only when test is compiled for x8632. "Modified slang" is a forthcoming slang change to add explicit padding to struct types: https://android-review.googlesource.com/#/c/299366/ Change-Id: I536497d1152995bf93a48dc83527d1575d5f947e
2017-03-22Make bitcode wrapper info available to MetadataExtractor.David Gross2-9/+10
Copy bitcode wrapper information (compiler version, optimization level) from bitcode wrapper to Module metadata, where it can be found by MetadataExtractor instantiated from Module. Previously, such a MetadataExtractor ignored the information in the bitcode wrapper; instead, it - nonsensically set compiler version to RS_VERSION, which is an API level rather than a slang version; and - set optimization level to 3. Remove unused MetadataExtractor::getTargetAPI(): - Old behavior: - For user bitcode, got actual targetAPI. - For libclcore, got 0. - For linked bitcode (user bitcode + libclcore), got uninitialized/garbage value. - It's not clear what a sensible value would be for libclcore or for linked bitcode (or perhaps it should be an error to query the targetAPI in those cases). What a sensible value would be depends on how we intend to use it. This change enables a forthcoming libbcc change that needs to know the slang version. Bug: http://b/29154200 Bug: http://b/28070272 Test: full_fugu-eng Tried ( modified slang, modified bcc) and (unmodified slang, modified bcc): - libbcc/tests/run_lit_tests.sh; RsTest; cts -m RenderscriptTest - confirmed that our driver is loaded rather than libPVRRS.so - By instrumenting modified bcc and running RsTest, confirmed that: - MetadataExtractor properly obtains slang version from Module. "Modified slang" is a forthcoming slang change that changes the slang version. Change-Id: Ifc9c1348c96a88bf7ddb344721f67f89359a4fe6
2017-02-23Merge "Remove OutputFile and Disassembler from libbcc."Jean-Luc Brouillet1-5/+0
2017-02-22Remove OutputFile and Disassembler from libbcc.Jean-Luc Brouillet1-5/+0
For OutputFile, the code can be a lot simpler by just relying on what llvm provides. Disassembler was also not used. Bug: 34265954 Test: Compiled. Ran imageprocessing_jb and a compat lab test. Test: Ran CTS. Change-Id: I360a55541b6bbb9c104415e44920728c8d451446
2017-02-22Add back version info to Script in libbccJean-Luc Brouillet1-0/+9
An upcoming CL for the debugger will need this. Bug: 34265954 Test: Compiled. Ran rstest. Change-Id: I6e133e19c5348659cdc799a9e2272142c6bc071a
2017-02-20Merge RSScript.cpp and Script.cppJean-Luc Brouillet3-154/+70
We don't need two classes. Bug: 34265954 Test: Compiled. Ran imageprocessing_jb and a compat lab test. Test: Compared that the APK have not changed in size. Change-Id: Ib91e16d80bd5ba33c5946ff6f5b11a579338eb1c
2017-02-16Flatten the libbcc directories.Jean-Luc Brouillet18-798/+1
Get rid of the Support, Core, and RenderScript subdirectories for the sources and the header files. Deleted the unused Sha1 header file. Bug: 34265954 Test: Compiled everything, ran a regular and a support lib app. Change-Id: Iac760ee3c1985259593e7bbd1dd2dd35e99f654b
2017-01-13liblog: use log/log.h when utilizing ALOG macrosMark Salyzyn1-1/+1
Test: compile Bug: 34250038 Change-Id: I65a106104f30daad7fa19eefe0d6fef743824478
2017-01-11liblog: use log/log.h when utilizing ALOG macrosMark Salyzyn1-1/+1
Test: compile Bug: 30465923 Change-Id: I5dcef0e7708f018d3dea2a8184115b7aeb941686
2016-12-17Move bcinfo headers next to libraryColin Cross11-1258/+0
Move the bcinfo headers into bcinfo/include, and export the headers to modules that depend on libbcinfo. Test: m -j native Change-Id: If50c88424055a754f5626201d8f05a9c404f24b9
2016-12-13Convert libbcc to Android.bpColin Cross1-1/+1
See build/soong/README.md for more information. Includes one small code change to replace FORCE_BUILD_LLVM_DISABLE_NDEBUG with _DEBUG, which is set already in llvm-defaults in external/llvm/soong/llvm.go when the environment variable is set. libbcc-targets.mk remains, it is still used by frameworks/rs/cpu_ref. Reapplies Iec37d2c33020bb5702c27497ae343a8312601202 with libbcinfo's version_script only applied on device builds, and only building 64-bit for host. Test: mma -j Test: mma -j FORCE_BUILD_LLVM_COMPONENTS=true Change-Id: I6a024929bf90368f81f47c72f0c48866efc0e635
2016-12-13Revert "Convert libbcc to Android.bp"Colin Cross1-1/+1
This reverts commit 5a2d24e315d79f735eeb8b6560118f10edbd6b05. Reason for revert: breaks mac build Change-Id: I6429aaddea2c2cc1e71c5ab66d656392a112bd8f
2016-12-12Convert libbcc to Android.bpColin Cross1-1/+1
See build/soong/README.md for more information. Includes one small code change to replace FORCE_BUILD_LLVM_DISABLE_NDEBUG with _DEBUG, which is set already in llvm-defaults in external/llvm/soong/llvm.go when the environment variable is set. libbcc-targets.mk remains, it is still used by frameworks/rs/cpu_ref. Test: mma -j Test: mma -j FORCE_BUILD_LLVM_COMPONENTS=true Change-Id: Iec37d2c33020bb5702c27497ae343a8312601202
2016-10-24Fix libbcc to compile with LLVM r275480Pirama Arumuga Nainar2-4/+3
Bug: http://b/31320715 Test: Run RenderScript tests (host tests for slang and libbcc, RsTest, CTS) Change-Id: Id3f0d03ef019f9315216e7f7ac4cf60883719ad7
2016-10-03libbcc: Replace cutils/log.h with android/log.hMark Salyzyn2-2/+2
Should use android/log.h instead. Test: compile Bug: 26552300 Bug: 31289077 Change-Id: I932dcd8b71d0e2d3a4c908ee96e00afdda7713c6
2016-08-23Fix clang-tidy warnings in libbcc.Chih-Hung Hsieh10-10/+10
These are proposed changes, looking for upstream changes. * Add explicit keyword to conversion constructors. Bug: 28341362 * Use const reference type for read-only parameters. Bug: 30407689 * Use const reference type for loop index variables to avoid unnecessary copy. Bug: 30413223 * Use faster overloaded string find function. Bug: 30411878 Test: build with WITH_TIDY=1 Change-Id: I2a083651ba7aa7cb1b88fb84738d7caf37b4f511
2016-06-29Fix misc-macro-parentheses warnings in libbcc.Chih-Hung Hsieh1-2/+3
Use NOLINT to suppress wrong clang-tidy warnings on type names used in a macro. Bug: 28705665 Test: build with clang-tidy Change-Id: Id9197d40258838245931bc0a0a00e8287ec0a764
2016-06-14Delete simple reduction implementation.David Gross2-28/+12
Bug: 27298560 Change-Id: Id826426fc81458ad66118bf7b2059a7a6f02a047 (cherry picked from commit a48ea364652efcf947dd33c8a6ba893e9c00dd6a)
2016-04-18If a general reduction kernel lacks a combiner function, synthesize one.David Gross1-0/+11
The CPU reference driver can only go multithreaded for a reduction kernel if that kernel has a combiner function. Bug: 27299475 Change-Id: If7f3a9ba8ec5e15ed5f3ef96968d28d650b01c20 (cherry picked from commit 57fd9f882f3359be4201c42b02aebf785d311df2)
2016-04-14Translate GEP instructions on structs to GEP on int8*Pirama Arumuga Nainar3-1/+10
http://b/24142721 X86 data layout has 64-bit scalars aligned at 4-byte boundaries, while ARM aligns these data at 8-byte boundaries. To bring frontend- and backend-generated code into agreement, this patch adds a pass to translate GEPs on structs to GEPs with int8* operands and byte offsets. This pass runs only on X86 targets. Change-Id: I961b2bc7db9f57f15126f27396db42c9deedfd43
2016-04-14X86: Fix kernel Input/Output GetElementPtr offset issueYong Chen1-0/+4
http://b/24142721 The disagreement between module and x86 target datalayout causes mismatched size calculation of structs with 64-bit scalar fields. This patch solves the issue by treating input and output pointers as byte* pointers, indexing them with explicit byte offsets computed using a modified data layout for x86, with alignment for 64-bit scalars set to 8-bytes, and casting the indexed pointers back to the real type. Change-Id: Id99ea0e37f5cc9ad93cc6a5979db79ff11b3998c Signed-off-by: Yong Chen <yong.a.chen@intel.com>
2016-03-17Update libbcc for LLVM rebase to r256229Pirama Arumuga Nainar2-0/+20
http://b/26987366 Change-Id: Ib5459acda9c4e612948290d0f68456dd4dc414af
2016-02-18Remove dead argument from RSCompilerDriver().David Gross1-1/+1
Change-Id: I4307c10d01bc6886e47789a100845d5b784beb3c
2016-02-09Make RSKernelExpand use memory rather than registers.Dean De Leo1-0/+2
The RSKernelExpand pass generates a loop around the main kernel body. This patch changes it to use LLVM memory with loads and stores rather than generating the SSA directly. This is required in order to be able to attach debugging information to the memory location associated with the loop iteration index variable, enabling the debugger to inspect current thread coordinate. The regular SSA form of LLVM IR doesn't allow this to be done efficiently. If optimizations are enabled, the subsequent passes promote memory back to registers, avoiding potential performance regressions. Change-Id: Ic458e4f14537ff3a4fdd5123276aab0c75c04154
2016-01-30Deduce whether the module contains debug info.Dean De Leo1-0/+9
Add functionality to the MetadataExtractor to deduce whether the module contains debug info. This method will be used to deduce whether we should link with a special runtime library with debug information. Change-Id: I8ebe8c465c785adfb2b24864714e654f49c12c6d
2016-01-30Initial version of debug info pass for RS.Dean De Leo3-0/+7
This introduces a new LLVM pass into libbcc called RSAddDebugInfoPass. Its purpose is to add debug information metadata to LLVM constructs generated by the other parts of libbcc. The generated code generally lacks sufficient debugging information as it has not been processed by the clang-based front-end. The initial version of RSAddDebugInfoPass provides the following: 1. It annotates the expanded function generated by RSExpandKernel pass with debug information, stating the name of the function and source file indicating that the function has been generated. 2. It annotates the instructions of the *.expand function with filename/line indicating that the function code has been generated. The source file of both the generated function definition and the instructions that make up the function is mapped to the source location of /opt/renderscriptdebugger/1/generated.rs:1. That might be source-mapped by the debugger to an appropriate file in the SDK, the contents of which clearly indicate that the user is dealing with generated code (i.e. one without a "physical" source file). Change-Id: I2e566160a448d7bfbb3f8d16680e09e43c845693
2016-01-15Metadata support for general reduction.David Gross1-2/+53
Needs corresponding change in frameworks/rs: The driver and bcinfo need to remain precisely in sync with regard to metadata format in order for RenderScript to work at all. Also fixed memory leak in MetadataExtractor. Bug: 23535724 Change-Id: I6857f605c79139bdce362a7aeef73c91fc502ff6
2015-09-14Fix invalid read of literal (anonymous) structure names on assertion builds.Stephen Hines1-0/+28
Bug: 22926131 This change adds support for using libbcc with an assertion-enabled build of LLVM via the FORCE_BUILD_LLVM_DISABLE_NDEBUG define. It also restricts the use of getName() on literal structures. Although a separate patch to frameworks/rs that makes our RS object types not just typedefs of anonymous structs can fix this safely going forward, our release builds will need to be able to read legacy bitcode that uses anonymous literal structure types. Thus, we need the ability to call getName() on all structures for release builds. In the case of assertion builds, we will enforce that we are using the updated compiler + headers so that the structures are not anonymous. If an older compiler + headers are used in the host compile, the bcc compilation will fail with an appropriate error message. Change-Id: Ic2910aed069235b40a31c22b006a4db5c1b9e06c
2015-08-17Expand reduce-style kernels.Matt Wala2-2/+2
Bug: 22631253 Rename the RSForEachExpand pass / source file to RSKernelExpand. In addition to already being responsible for expanding foreach-style kernels, RSKernelExpand now expands reduce-style kernels from define foo @func(foo %a, foo %b) into define void @func.expand(i8* %inBuf, i8* %outBuf, i32 len) The expanded function reduces a sub-range of its input. Change-Id: I518fa9367b57111a2f2a1b23903ff870c421beeb
2015-08-12Lose HAVE_ANDROID_OS from frameworks/compile/libbcc.Elliott Hughes1-2/+2
Change-Id: I445c64c3a3e571380d2efff39829a8d6cf48b329
2015-08-06Merge "Clean up Compiler::runPasses()."David Gross1-6/+4
2015-08-05Clean up Compiler::runPasses().David Gross1-6/+4
Flatten out call tree rooted at Compiler::runPasses(), to make it easier to understand. Bug: 22801527 Change-Id: I680f9443bba3328c4c0da73a2358d4cd12094d20
2015-07-23Merge "libbcc: Add support for reduce kernel metadata."Stephen Hines1-3/+16
2015-07-21libbcc: Add support for reduce kernel metadata.Matt Wala1-3/+16
Bug: 22631253 This change implements recognizing the #rs_export_reduce metadata node for reduce-style kernels in libbcc and bcinfo. Change-Id: I5323f607f7ac474d0f7b79486a2bbe900680e330
2015-07-17Stopped bcc from ignoring optimization levelStephen McGroarty2-0/+9
Added in a constructor for RSScript which takes in the compiler config and derives the optimization level from that rather than defaulting it to opt level 3. Also added in a statement to catch a null pointer for the case where the llvm-rs-cc produced bitcode fails verification. Change-Id: I6efdab6280a9c389268b5a40dc4a50eb9bc24370 Signed-off-by: Stephen McGroarty <stephen@codeplay.com>
2015-06-23Check kernels before fusingYang Ni1-1/+3
b/21958851 Kernel fusion for a Script Group expects kernels to be chained up via outputs (return values) and first arguments. Check this condition during fusion. Otherwise, BCC may crash on broken invariants. Change-Id: I013558c77dc3f79d6e42986121927dd6c695f27e (cherry picked from commit 8c12d615b4ed4b1d782722a125dd1d43bc44a71b)
2015-06-22Fix cases where RSInvariant pass might miss marking some loads as invariant.David Gross1-10/+15
llvm-rs-cc and bcc can add numeric suffixes to structure type names; we need to tolerate this when looking for the context structure by name. Bug: 21815112 Change-Id: If5ef169245f8d43affdc43abb2298c7015568dd0
2015-06-16Screen bitcode for non-RS functions before linking with runtime libPirama Arumuga Nainar1-1/+5
Bug: 19425238 Bug: 20894432 Perform the screening of non-RenderScript functions in the script before linking against the runtime lib. Previously, this used to be done after linking with the runtime lib, LTO passes and just before code generation. This allows vendors to link against a different runtime library that may not have all the functions as the CPU reference driver and add new builtins specific to their driver. Moreover, symbols introduced by LLVM optimizations no longer need any special handling. Change-Id: I5628aa15547a9d56ef7e6550fcb45e8ffa821ade
2015-05-24Fix x86_64 issue with a missing "." in structure names.Stephen Hines1-0/+6
Bug: 21375248 This patch refactors RSX86CallConvPass.cpp a little bit so that it uses our latest utility functions for determining the Type of a given Value. The prior implementation could miss structures that didn't have a suffixed dot + number appended to them (i.e. struct.rs_allocation.17 worked fine, but struct.rs_allocation would go undetected). This resulted in missing conversions for the parameter types on x86_64 compiles (and thus crashes in CTS for reference counting, etc.). Change-Id: Ic437754399514d201d2fb69f6efb03badc5f535d
2015-05-21Provide additional information about global variables.Stephen Hines1-0/+66
Bug: 20306487 This patch extends our global information pass to include details about the type of a global variable, whether or not it is static, constant, or a pointer. It also refactors code that deals with conversion between RenderScript's internal data types and LLVM's type system. A subtle bug has also been fixed with respect to the RSInvokeHelperPass. The previous version could ignore an rs_* object that did not have a numeric suffix. The new helper function properly addresses cases like this. Change-Id: If9c933a885bf6a9063b7edec3f0873e1b144188d
2015-05-15Merge "Update libbcc for rebase to LLVM r235153"Pirama Arumuga Nainar1-2/+3
2015-05-15Update libbcc for rebase to LLVM r235153Pirama Arumuga Nainar1-2/+3
Some changes related to GEP may impact us in the future: - GEP constructors take an additional argument - the pointee type of the resulting pointer. Update bitcode readers accordingly. They take nullptr for now. This behavior should be retained at least for 3.x. - Likewise, CreateStructGEP and CreateConstInBoundsGEP2_32 need the pointee type argument. Passing nullptr for the extra argument for now. According to commit message in r233938, passing nullptr may not work in the future. Unlike the BitcodeReaders, we can pass the right pointee type here. b/20886457 is created to track this issue. Change-Id: I2450da1c36470fb9defd387d74360480c3e4bd2f
2015-05-05Provide a pass that creates information about global variables in RS.Stephen Hines4-0/+63
Bug: 20306487 This change implements RSGlobalInfoPass, which is an optional LLVM pass that adds several new global variables to a given Module. These variables contain information about the other RenderScript global variables that are present. Change-Id: I671013c11c7a528254edad5c66f2858953c0f5c4
2015-04-15Merge "Embed a real chesksum in script group .so"Yang Ni1-1/+1
2015-04-13Undo AArch64 pass-by-pointer for X86-64Pirama Arumuga Nainar2-0/+3
bug 19779488 AArch64's calling convention passes large objects by pointer/reference. Consequently, RS functions exported in the driver need special handling for x86-64. This patch creates a new pass to libbcc that identifies pointer arguments created due to the AArch64 convention and marks them as pass-by-value. Change-Id: I2e24edd9704e843b118f4c445cfd92f61f9de909
2015-04-08Embed a real chesksum in script group .soYang Ni1-1/+1
Change-Id: Icf2f37867692f94e344a292fa15f8b85e0fc30a5
2015-04-07Update libbcc for LLVM rebase to r233350.Stephen Hines1-1/+0
- Remove direct calls/use of DataLayoutPass. - Move BitcodeReader.h (declarations) into BitcodeReader.cpp files. - Fix typed/untyped GEP. - Add empty materializeMetadata(), since we don't defer it ever. - Fix longstanding (but insconsequential) difference between bitc::CST_CODE_INLINEASM and bitc::CST_CODE_INLINEASM_OLD. Change-Id: I135e494beea2f5992db1cb5c038d52cced991e72