History log of /frameworks/compile/slang/slang.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
6a360ef49a83c623784ce97e32f7c07b170ef364 24-Jul-2017 David Gross <dgross@google.com> Improve Java reflection for 32-bit versus 64-bit differences.

Bug: 32780232
Bug: 20260865
Bug: 21597073

By default, when targeting API L or above, we support both 32-bit and
64-bit targets. We do so by running two compilation passes -- a
32-bit compilation pass followed by a 64-bit compilation pass. We
generate reflected Java code as part of the 64-bit compilation pass.
This can cause problems if there are "significant" differences between
the user's script (.rs file) as seen during 32-bit compilation
compared to 64-bit compilation -- for example, rs object handles (such
as rs_allocation and rs_element) are different sizes, the type size_t
is a different size, and a user can create arbitrary differences by
using the __LP64__ macro. If any of those differences affect
reflected code (for example, by changing exported types), then we may
get incorrect runtime behavior on 32-bit targets.

At present we do have some special processing for rs object handles.
However, we don't properly address all cases -- for example, when an
rs object handle is a field of a struct or an argument to an invokable
function, reflected code does not get the layout of the struct or
argument list correct on 32-bit targets. We also make no attempt to
address any other differences (such as size_t or __LP64__).

This CL is intended to fully address 32-bit versus 64-bit reflection
issues:

1) Fully handle rs object handle size differences when laying out data
(such as structs and invokable function argument lists).

2) Emit errors for any other differences between 32-bit and 64-bit
compilation that would require changes to reflected code (for
example, no exported global may be of type size_t).

We solve these problems as follows:

a) As part of the 32-bit compilation pass, execute (most of) the same
code paths we would use to generate reflected code, but instead of
actually generating reflected code, collect information for later.

b) When we generate reflected code as part of the 64-bit compilation
pass, we consult the information collected during the 32-bit
compilation pass in order to do target sensitive data layout and to
emit errors for intolerable 32-bit versus 64-bit differences.

This CL requires changes to the compatibility library (in
frameworks/rs).

Test: many
- slang/lit-tests
- slang/test
- RsTest aosp_x86_64-eng (aosp, emulator) 32-bit and 64-bit
- cts aosp_x86_64-eng (aosp, emulator) RenderScript and CtsRsCppTestCases
- RSTestBackward
- aosp_arm-eng
- n9 LMP MR1 Release (LM)
- angler MNC DR Release (MD)
- aosp_arm64-eng
- n9 LMP MR1 Release (LM)
- angler MNC DR Release (MD)
- RSTest_Backward19
- aosp_arm-eng
- n5 KLP MR2 Release (KT)
- n9 LMP MR1 Release (LM)
- angler MNC DR Release (MD)
- RSTest_CompatLib
- aosp_arm-eng
- n9 LMP MR1 Release (LM)
- angler MNC DR Release (MD)
- aosp_arm64-eng
- n9 LMP MR1 Release (LM)
- angler MNC DR Release (MD)
- aosp_x86-eng
- emulator aosp
- aosp_x86_64-eng
- emulator aosp
- RSTest_Compat19
- aosp_arm-eng
- n5 KLP MR2 Release (KT)
- n9 LMP MR1 Release (LM)
- angler MNC DR Release (MD)
- aosp_x86
- emulator aosp

Change-Id: I5d1fc51e35693588dff05afa48e1a4902859036e
(cherry picked from commit d80e58b259c2febc4907aed4aca9d88d43bdd1a1)
/frameworks/compile/slang/slang.cpp
b6a143562bda2117824a0515c208504e9a2830f1 26-Jul-2016 Pirama Arumuga Nainar <pirama@google.com> Fix slang to compile with LLVM r275480

Bug: http://b/31320715

In addition to fixing compilation with the new LLVM sources, this change
also switches to using LLVM's RenderScript triples. Clang also uses
this triple to set the size and alignment of 'long' data type to
64-bits. We no longer need/have the '+long64' CPU feature.

Test: Run RenderScript tests (host tests for slang and libbcc, RsTest, CTS)

Change-Id: I3d2795bc0253a10d6fb36bfb0c28eb0c2e9a2922
/frameworks/compile/slang/slang.cpp
ef1707027a18ed0d91a3854476db71024ae0e6da 15-Sep-2016 I-Jui (Ray) Sung <ijsung@google.com> Revised ODR validation flow; added more ODR tests

Changed ODR validation logic to report errors on the tightest enclosing
type; fixed inconsistent diagnostic messages for F_odr_nested_records_2
and F_odr_nested_records_3. Also changed expected diagnostic message for
F_one_definition_rule8 for the same.

Removed unused RSExportable::equals(), as it is not used outside
RSExportType and subtypes, and is only for ODR matching. Renamed most
equals() to matchODR() for clarifying the intent and simplified the
logic in checkODR().

More ODR validation test cases: on fields and their type names including
record-typed fields and fields of built-in types, and
struct-of-array-of-structs.

Test: RsTest, CTS and slang test.py for angler_aosp-eng
Change-Id: I1703ecc0ab2995e0bfdfa1de33ea02cd63d99a7d
/frameworks/compile/slang/slang.cpp
b9cb37bba35f2bc70b7908140f09a37a6fcb4d9d 13-Sep-2016 I-Jui (Ray) Sung <ijsung@google.com> Added type name check for ODR validation

Bug: 31372470
Test: Ran RS CTS, RSTest and slang test.py for angler_aosp-eng

Added the missing field type name validation in ODR consistency check. It
was assuming that RSExportType::equal checks name equivalency, which
is not the case as of now. Revised comments to reflect so as well. Also
added a regression test case.

Change-Id: I34d7b17104d031ed3fc6eec6c6e1d59b9b0aeaa3
/frameworks/compile/slang/slang.cpp
dbdaecf5f71ead9b71d9bd43a129427ffb53dd38 16-Apr-2016 Stephen Hines <srhines@google.com> Set LangOpts.NativeHalfArgsAndReturns now that it is supported upstream.

Bug: http://b/28224559

Without this option, upstream Clang now goes back to lowering a single
half parameter as an integer on ARM. We support this as an official
native type in RenderScript (at least at the invoke/kernel layer), so we
don't want this unnecessary conversion.

Change-Id: I7acf4252d94bcaff5ea3c15b441a292861d4bc1e
/frameworks/compile/slang/slang.cpp
98cfae456bb1831336bce2b21979a04e2e31fed4 04-Mar-2016 Pirama Arumuga Nainar <pirama@google.com> Update slang for LLVM rebase to r256229

Bug: http://b/26987366

Change-Id: I816e6ad4a1d43d681f3d022d119e3082702251a1
/frameworks/compile/slang/slang.cpp
34e6205f1d5ceb90a73192cee8b215fa0b7ab306 05-Nov-2015 David Gross <dgross@google.com> Remove PragmaRecorder.

The PragmaRecorder class was acting as a catch-all for pragmas not
recognized by our collection of RS*PragmaHandler classes. It was
doing nothing other than rudimentary syntax checking and permitting
all pragmas to flow through the compilation process without clang
flagging them as unrecognized under -Wall.

Change-Id: I4a4c84c6e1114ac1e5454b3a06cf96e05c34a783
/frameworks/compile/slang/slang.cpp
d118c0278865c0760a5c37972b57cc3a016d0952 13-Oct-2015 Pirama Arumuga Nainar <pirama@google.com> Add rs_allocation_create as an RS header

https://android-review.googlesource.com/#/c/175582/ adds a new header
rs_allocation_create.rsh. This CL adds it to the list of headers
recognized by slang.

Change-Id: I5dc8f540ef2d09f06f0bbcaacc0ef84c2388e33d
/frameworks/compile/slang/slang.cpp
fac3b024d115fa1a71f3f7e0b7b29a9b03f9b436 11-Aug-2015 Stephen Hines <srhines@google.com> Always set CodeGenOpts.StackRealignment to 1.

Bug: 22718149

Clang's driver usually passes -mstackrealign directly to cc1 (unless the
-mno-stackrealign flag was passed to it). If -mstackrealign isn't passed
to cc1, Clang will automatically generate "no-realign-stack" attributes
on all functions, which precludes modifying the stack pointer for any
aligned operations. This was an unexpected behavior that breaks
alignment for some vector loads/stores. We thus force StackRealignment
to 1 in order to prevent this unexpected and broken behavior.

external/clang/test/Driver/stackrealign.c shows the cc1 flags being
passed along for a given invocation of top-level clang. r145909 is the
commit that explains how this is mostly supposed to work.

Change-Id: I7f28ee5273e35387ff689bafe180a70ef3c13750
/frameworks/compile/slang/slang.cpp
3fe4027f9acbc5047f8e7ca8f1575e3a6af76cf8 06-Aug-2015 David Gross <dgross@google.com> Merge "Enhance diagnostic options."
2770d0e31ef3b14cd51ca07273240ad0995dc5cd 03-Aug-2015 David Gross <dgross@google.com> Enhance diagnostic options.

- Support -m32/-m64 for non-cpp, if eng build.

- Add -ast-print option.

- Add options -debug, -print-before-all, -print-after-all (passthrough to LLVM).

Change-Id: I609750bd49a624d74f91666ef3f8c77ef711ff32
/frameworks/compile/slang/slang.cpp
21c94c9b4cc3c139c0d2c08f81e773aa3e269cff 23-Jul-2015 Ying Wang <wangying@google.com> Add "-MP" support to llvm-rs-cc.

Bug: 22666539
Change-Id: I2888b58abc4644040fe9525b1ee24ae46cde480d
/frameworks/compile/slang/slang.cpp
93efff329f0b18aea5ab8e52340f0ddc542824c0 18-Jul-2015 Stephen Hines <srhines@google.com> Merge "Added in change to ensure file name is passed through debug info"
bd0a7ddceac6c135ea975cefbac73877a1f9dae7 02-Jul-2015 Stephen Hines <srhines@google.com> Update llvm-rs-cc version to 23 for M.

Bug: 22179874

This change updates the compiler version, as well as marks the new APIs
usable by Android M.

Change-Id: I2a943274a701e6301b6c41ac3bb4302e0a66b9d0
/frameworks/compile/slang/slang.cpp
3f45a25c23fa0f2cca4070f4d8713dc1a83f5ff7 30-Jun-2015 Matt Wala <wala@google.com> slang: Improve handling of StringMapEntries.

In Slang::checkODR(), change a line that deletes an entry when it
fails to be inserted. There are two problems with this line:
(1) Calling delete is wrong, since the entry is malloc'ed.
(2) The line is unreachable.
Since the line is unreachable, replace it with an assert attesting to
this fact.

In RSContext::insertExportType(), the code properly cleans up an entry
that failed to be inserted with free(). However, given that malloc()
is not called anywhere in slang, this could be confusing. Use the
Destroy() member function instead.

Change-Id: Ifc0920a86bb010a89e93319a70a423d87fb97e3f
/frameworks/compile/slang/slang.cpp
68e562f8cac58df367861670e554c3c1f498426c 05-Jun-2015 Stephen McGroarty <stephen@codeplay.com> Added in change to ensure file name is passed through debug info

Added in a line to pass the name of the input file through to the
output file metadata to allow for source debugging.

Change-Id: I1a8cc178775d1698fe36a78d5d30b9f501404d87
Signed-off-by: Stephen McGroarty <stephen@codeplay.com>
/frameworks/compile/slang/slang.cpp
e4dd17d7b2a292a600756da7680beecd78f74033 07-Apr-2015 Pirama Arumuga Nainar <pirama@google.com> Add Half support in slang

Bug: 7342860

- Enable NativeHalfType and HalfArgsAndReturns for Langopts for API >=
23
- Add half and its vector variants to the list of reflected types
- Use addF16 as the FieldPacker method for setting Float16 values.
- Add tests that HalfArgumentsAndReturns is not enabled on API < 23.
This should serve as an indirect test that NativeHalfType is also
disabled.

Change-Id: I164ff6f8a3ed206326b904afa5430230b97d41c8
/frameworks/compile/slang/slang.cpp
5309b0cbeda2c75eedf6627e06f4471c77f98f83 02-May-2015 Jean-Luc Brouillet <jeanluc@google.com> Enable warnings in llvm_rs_cc

- Fixed a bug that prevented llvm_rs_cc from emitting many warnings.
- Add support so that we can do Wno-error (needed to avoid deprecation warnings
from breaking the build).
- Add test to verify deprecated warning works.
- Simplified slang top level to clean up handling of 32/64 bit compilation handling.

Change-Id: Ibacfa7d3d9708cb39a33b71da9621aee2718f758
/frameworks/compile/slang/slang.cpp
ff5abc6892aedb25215689bd679eb7cc1588a8e3 06-May-2015 Jean-Luc Brouillet <jeanluc@google.com> Fix problem with generated file names

Change-Id: I56698cd677be62e48b4e010e8dc0630233cf0e83
/frameworks/compile/slang/slang.cpp
8024ed54c23c08534434da14d3be99c3efcc5754 05-May-2015 Jean-Luc Brouillet <jeanluc@google.com> Merge Slang with SlangRS, Backend with RSBackend.

Change-Id: I4721f92c10ec14a886923778595289f96d3a8de5
/frameworks/compile/slang/slang.cpp
96da9e43005aa1286df3094bef43b99ea2800194 03-Feb-2015 Pirama Arumuga Nainar <pirama@google.com> Merge "Remove fatal_error_handler on compiler reset"
8d5130ac38f9e12909ee0f603b8b4bc0cfb6dd9e 03-Feb-2015 Pirama Arumuga Nainar <pirama@google.com> Remove fatal_error_handler on compiler reset

llvm-rs-cc:CompileFiles calls slang::init calls
llvm::install_fatal_error_handler.

We call llvm-rs-cc::compileFiles twice to compile for 32 and 64 bit.
This results in llvm::install_fatal_error_handler being called twice,
resulting in an assertion failure if libLLVM has asserts enabled. To
solve this, we call llvm::remove_fatal_error_handler in slang::reset.

Change-Id: I29926e58cac38c2736143c7ad3cf07012ebfd26a
/frameworks/compile/slang/slang.cpp
c43b0489296c67660a5a5a76f4430c9ced7ba2d1 21-Jan-2015 Stephen Hines <srhines@google.com> Remove confusing and unnecessary initialization code.

The RenderScript portable bitcode format is based on ARM originally, and is
intended to be target-independent. Initializing a different target is
unnecessary, because we hard-code the target later on in compilation.

Change-Id: I507479c88285ade18093844a53ea80ed717da531
/frameworks/compile/slang/slang.cpp
3eb819ad8beec566a73b288204f9b75c2bb1d4e6 25-Nov-2014 Stephen Hines <srhines@google.com> Update slang for LLVM rebase to r222494.

Change-Id: I19e441e193637ddb39b3afb3bc95579755ac0a90
/frameworks/compile/slang/slang.cpp
c546630bbcc631bc963609c2288d4d9a18753e8d 12-Nov-2014 Stephen Hines <srhines@google.com> Clear up some object lifetime issues for ASTContext and Preprocessor.

Bug: 18343568
https://code.google.com/p/android/issues/detail?id=79142

llvm-rs-cc was accidentally freeing memory that was still in use. The
ASTContext and Preprocessor contain several strings and other pieces
of data that are used during the generation of our reflected code.

Change-Id: Id00e54f998daeeb47332c64b0f5ba1acada3e711
/frameworks/compile/slang/slang.cpp
a2324a90a6ea0522988f0753b6372249fa5f43db 22-Aug-2014 Stephen Hines <srhines@google.com> am 03ec6ed2: am 10dc6f31: Merge "Replace the NULL macro with nullptr literal."

* commit '03ec6ed2ecb9adf0cf125b0fa6c96844f093d4d0':
Replace the NULL macro with nullptr literal.
5abbe0e9ca2508260b627ffef2bf01e2554e8357 13-Aug-2014 Chris Wailes <chriswailes@google.com> Replace the NULL macro with nullptr literal.

Change-Id: I33609969cd0d7aa55eaa83fb2c65f5faa6d55fa0
/frameworks/compile/slang/slang.cpp
2d504fd03c66be56ac3b4bb62c78cc72c75dd8b6 15-Aug-2014 Stephen Hines <srhines@google.com> Suppress warnings on our second compilation (for 64-bit).

Bug: 16031597
Bug: 17052573

Without this patch the 64-bit compilation path will print duplicate warning
diagnostics, since we call the frontend twice (for 32-bit, and then 64-bit).
The simplest fix is to not print warnings for the second compilation. A bug
(17052573) has been filed to track fixing this a better way (actually printing
out all warning diagnostics, but removing duplicates explicitly).

Change-Id: I78ac0ebd2b132713ec0c86c2cf234da2b620eecf
/frameworks/compile/slang/slang.cpp
7ac9d0de26d325071ad3f26f8d34514efca2d3d6 16-Jul-2014 Stephen Hines <srhines@google.com> Update slang for LLVM rebase to r212749.

Change-Id: I5819f9df3212ffcfa8f34c11d3cea29f1fd04878
/frameworks/compile/slang/slang.cpp
2eb9a3f7c48fe54eb4e813d80e3363bc79553a1e 16-Jul-2014 Stephen Hines <srhines@google.com> Update slang for LLVM rebase to r212749.

Change-Id: I5819f9df3212ffcfa8f34c11d3cea29f1fd04878
/frameworks/compile/slang/slang.cpp
9ae18b2bbee0b08afd400542e863dd665ff76059 11-Jun-2014 Stephen Hines <srhines@google.com> Add an option to emit 32-bit and 64-bit bitcode.

Bug: 16031597

Change-Id: Ifb3c4eca5e7ae16106260c2b5f5da6854c021a3a
/frameworks/compile/slang/slang.cpp
0e4ee65a2ba6b32fcd16c5d4a57fc7542d4032b4 10-Jun-2014 Stephen Hines <srhines@google.com> Run InitializePreprocessor() to ensure that all macros are set up properly.

Without this, we don't end up defining things like __LP64__ for 64-bit
compilation targets.

Change-Id: I11e11bde3498089056e7a70903c8d47d1030e01a
/frameworks/compile/slang/slang.cpp
75d471819f1810e0e65224d6e57fe1106af0d340 28-May-2014 Stephen Hines <srhines@google.com> Update slang for LLVM 3.5 rebase (r209713).

Change-Id: If0f510085358d2e48c865257851d9ff7f5846eb8
/frameworks/compile/slang/slang.cpp
ee4016d1247d3fbe50822de279d3da273d8aef4c 11-Apr-2014 Tim Murray <timmurray@google.com> Update Slang for Clang/LLVM 3.5a.

Change-Id: Icd59efa1197098076555c505c31939866e504a83
/frameworks/compile/slang/slang.cpp
eeb251e8db802b836af7461d0f6eb1252c527ab8 11-Feb-2014 Stephen Hines <srhines@google.com> Update slang for LLVM 3.4 rebase.

Remove LinkOnceODRAutoHideLinkage, since it is now just a special case of
LinkOnceODRLinkage.

Remove CaseRange expansion code from all bitcode writers, since it is now dead.

Fix up HeaderSearch constructor.

Change-Id: I38547486be509b16ea5d8218b43c31ae35b37d3b
/frameworks/compile/slang/slang.cpp
a1f95ee8df425089100148a42954cf61dc285015 09-Aug-2013 Stephen Hines <srhines@google.com> Update slang for LLVM merge up to r187914.

Move OptParser.td dependency to use LLVM's version.
Switch to llvm::sys::fs::F_* enums.
Switch to LLVM Option handling library (not in Clang any more).
Add new ALIASARGS field to OPTION macro.
Switch to clang::getLastArgIntValue() helper function.
Use llvm::sys::fs::OpenFlags as enum and not unsigned int.
Remove unused DisableSimplifyLibCalls().
Switch to llvm::sys::fs::create_directories().

Change-Id: I9b12e18b759536c762ea0dd43356907ee53dbddb
/frameworks/compile/slang/slang.cpp
f64e76657a98f66c0f3f26014c0a51f55204dc1c 14-May-2013 Stephen Hines <srhines@google.com> Turn off "lax vector conversions".

Bug: 7342914

This language option catches all the terrible implicit vector casts (but not
the explicit vector casts) that we are trying to forbid.

Change-Id: I7cd75326fc72e0c7c74b635c81d7263a257330dd
/frameworks/compile/slang/slang.cpp
4b3f3bada7155de983e7d92fa8b20091629b3bb3 07-May-2013 Stephen Hines <srhines@google.com> Adapt llvm-rs-cc for LLVM/Clang update.

Change-Id: Ic38ebc1d824f6d3ae26c6b354336a01b52d46136
/frameworks/compile/slang/slang.cpp
0da7f6c8201b27938d3b9f048d71fd784cd1df9a 06-Mar-2013 Stephen Hines <srhines@google.com> Updates for LLVM merge to r176139.

Change-Id: I0d0d32893b4638eef298c99ac8c862c9a9bca1a6
/frameworks/compile/slang/slang.cpp
23c4358f12bd9d0ba7166eceebd683db95a41b3f 10-Jan-2013 Stephen Hines <srhines@google.com> Updates for LLVM merge to r171906 on 20130108.

Change-Id: I4cf3718041d8876d4a23a412b6b4fa4226ec3b50
/frameworks/compile/slang/slang.cpp
43730fe3c839af391efe6bdf56b0479860121924 03-Aug-2012 Shih-wei Liao <sliao@google.com> Apply changes to migrate to CLANG-160673-20120724.

Change-Id: I666df2ff91532318883dd48ea1249178b2ebda81
/frameworks/compile/slang/slang.cpp
52d132c53a57c3bb4b517f87ec4f0148ef8a4216 02-Aug-2012 Stephen Hines <srhines@google.com> Set LangOpts.Renderscript = 1.

Change-Id: I7f80d124d11eeed776ce3acd520297fc0c3f08f6
/frameworks/compile/slang/slang.cpp
0444de0c0e7cfc8d8f8fed6f64cd97812bdd6a41 03-Mar-2012 Stephen Hines <srhines@google.com> Adapt to upstream Clang/LLVM changes.

Change-Id: Ib81ad97246dbee060341e2690fb7f27e9e0298f4
/frameworks/compile/slang/slang.cpp
e3cb21bc8654181da174ac441acec7726b5a78ec 02-Mar-2012 Jean-Baptiste Queru <jbq@google.com> am fa5209a2: am 9c459f0c: Merge "Enable emission of debugger-friendly bitcode"

* commit 'fa5209a2bd1e10f675a889c60d8d5a589e860d18':
Enable emission of debugger-friendly bitcode
c460b37ffb50819a32c2a8967754b6f784b28263 09-Jan-2012 mkopec1 <mkopec1@intel.com> Enable emission of debugger-friendly bitcode

- Add "-g" flag to llvm-rs-cc in order to emit debug metadata
- Add optimization level parameter -O and tests
- Add lit based tests (use llvm-lit from libbcc/tests/debuginfo)
-- Add README file for lit-tests directory

Change-Id: I5e2f6f9b6f536fa7a10de008b54ac0878cf352a9
/frameworks/compile/slang/slang.cpp
194d4039a37861368d0774682b6d104f10bcc262 28-Feb-2012 Stephen Hines <srhines@google.com> Force LangOpts.CharIsSigned=1 (although it is currently the default).

BUG=6080056

Change-Id: Ie3bbcd7f0536c432531c88ad5dff5b76bd2a8ab6
/frameworks/compile/slang/slang.cpp
e67239de8d94975e7e2216ee6860ae2e6cb8b15a 25-Feb-2012 Stephen Hines <srhines@google.com> Style violation cleanup.

Change-Id: Idb127f2fd6e637039454f47299360aec5a4edfe8
/frameworks/compile/slang/slang.cpp
ac4e18584b8768b3f68535fa5f16232e03974323 16-Dec-2011 Logan Chien <loganchien@google.com> Apply changes to migrate to upstream (Dec 16th 2011)

- clang::ModuleLoader has changed the interface of loadModule.

- Following constants has been removed from llvm::bitc by the
upstream, so we have to define our version.

- TYPE_BLOCK_ID_OLD 10
- TYPE_SYMTAB_BLOCK_ID_OLD 13
- TYPE_CODE_STRUCT_OLD 10

- llvm::TargetMachine::createTargetMachine now takes a new
parameter for options, such as float ABI, soft float, and
no frame elimination, and etc.

Change-Id: I75e51da9d2265207060a449735342b426cedf243
/frameworks/compile/slang/slang.cpp
8f4d972ef6c6796ffdde603e456979a7004d1e20 05-Dec-2011 Stephen Hines <srhines@google.com> Add support for warning flag processing.

BUG=5714569

Change-Id: I96567325df605c5eb0f0bf2f2371a1cea9718a5b
/frameworks/compile/slang/slang.cpp
4c622e0953afe3dca4da0aee364a811f3ccb61d9 11-Nov-2011 Stephen Hines <srhines@google.com> Adapt to upstream changes.

Change-Id: I9ab7bad890eb78621c5fc6dd516dbcacdad88471
/frameworks/compile/slang/slang.cpp
9207a2e495c8363606861e4f034504ec5c153dab 21-Oct-2011 Logan Chien <loganchien@google.com> Apply changes to migrate to LLVM upstream Oct 20th 2011.

- StructType::isAnonymous is renamed to StructType::isLiteral.

- PassManagerBuilder has been moved from
llvm/Support/PassManagerBuilder.h to
llvm/Transforms/IPO/PassManagerBuilder.h

- Include llvm/Transforms/IPO.h for llvm::createInternalizePass.

- clang::DiagClient has be renamed to clang::DiagnosticConsumer.
Besides, we have to implement one additional pure virtual method
'clone' for create a clone of slang::DiagnosticBuffer.

- llvm::Linker::LinkModules comes with one additional parameter.
Passing llvm::Linker::DestroySource should be equivalent to
the old code we were using.

- slang::Slang is now derived from clang::ModuleLoader and implemented
loadModule pure virtual method (though we will always return NULL.)

- clang::Preprocessor is taking one additional parameter for
clang::ModuleLoader.

- clang::Diagnostic has been changed. A lot of the method has been
moved to clang::DiagnosticsEngine, and we can no longer 'Report' a
diagnostic from clang::Diagnostic. We have to use
clang::DiagnosticEngine instead.

- llvm::setCodeModel has been removed.

Change-Id: I1f2a4cbeaf61a8ed1d0d635a5a0e1baa90d99d07
/frameworks/compile/slang/slang.cpp
c632be206ac4fe49a5db05cfa54942d774329dbe 24-Sep-2011 Stephen Hines <srhines@google.com> Generate warnings properly for multi-file compiles.

BUG=5367019

Slang (llvm-rs-cc) was clobbering warnings during multi-file compilation
because they are not part of the error count. When the diagnostics get reset,
we should be dumping whichever non-error (i.e. warning) diagnostics we have
accumulated. During investigation, I also found then that our dependency
generation path can cause duplicate warnings to be added to the diagnostic
client. Thus, to fix this bug, the change need dumps relevant diagnostics, but
then suppresses warnings if we are compiling the same file multiple times
(once for code generation and once for dependencies).

Change-Id: I4b94e962f93b96f31ff7e7d6cce45418fe39e1d1
/frameworks/compile/slang/slang.cpp
fcc654a1f4034978f7534479f9c5c33a92ca8546 22-Jun-2011 Shih-wei Liao <sliao@google.com> Fix llvm API changes to migrate to upstream r131807.

Now, llvm doesn't provide create*Passes() interface and removes StandardPasses.h.
Instead, we use PassManagerBuilder to replace StandardPasses.

Change-Id: I0979afd0ecb9bf2df6634aaff0a8c9a32d405f71
/frameworks/compile/slang/slang.cpp
6f4e0a9955a53a6f715af7e674e68ed15270a47c 09-Mar-2011 Logan Chien <tzuhsiang.chien@gmail.com> Migrate to newer API.

Following function (left) is deprecated, use the right version
instead:

llvm::sys::Path::getLast -> llvm::sys::path::filename
llvm::sys::Path::getBasename -> llvm::sys::path::stem
llvm::sys::Path::getDirname -> llvm::sys::path::parent_path
/frameworks/compile/slang/slang.cpp
be27482cdeaf08576bc39b72a15d35d13014a636 16-Feb-2011 Logan <tzuhsiang.chien@gmail.com> Apply changes to migrate to LLVM Mar 6th 2011.

- API for name mangling. (Changing from non-public APIs to the
public one)

- API changes for clang::Diagnostic::getNumErrors ->
clang::Diagnostic::hasErrorOccurred

- API changes for clang::CharUnits and Quantity type.

- API changes libLLVMSystem -> libLLVMSupport.

- Change clang::Token::eom -> clang::Token::eod.

- Remove SourceRange parameter for DeclRefExpr::Create and
MemberExpr::Create.

- Add const qualifier for several unsafe type cast.
/frameworks/compile/slang/slang.cpp
df5bcce1582d839eead432a5e24435236c90fb05 01-Mar-2011 Shih-wei Liao <sliao@google.com> NOTICE file and logn:
Apply changes to migrate to LLVM 2010 Nov 10th:

Change-Id: Ib8d3675b4701957f299f249ac72e8a43c2a6bc4c
/frameworks/compile/slang/slang.cpp
6e6578a360497f78a181e63d7783422a9c9bfb15 08-Feb-2011 Stephen Hines <srhines@google.com> Add support for assertions in llvm-rs-cc.

Bug: 3430674
Change-Id: I3400238652449cde84275cc2a770f405332d9544
/frameworks/compile/slang/slang.cpp
4cc67fce91f43215d61b2695746eab102a3db516 01-Feb-2011 Stephen Hines <srhines@google.com> Support for generating .java dependencies for RS.

This updates the -MD option to also emit .java targets to the dependency
information placed in our foo.d file.

Change-Id: I189cf6302bc1cbd6201487743a37dced87b5c5eb
/frameworks/compile/slang/slang.cpp
245eba133628ef5b52c78d6f538c9268c9bc5828 19-Jan-2011 Shih-wei Liao <sliao@google.com> Enforce C99 checking.

Change-Id: Id5c2afa01fdf88170d7fafcb7d321aa127d02e27
/frameworks/compile/slang/slang.cpp
3fd0a94a5cf1656569b1aea07043cc63939dcb46 18-Jan-2011 Stephen Hines <srhines@google.com> Refactor pragma handling (pass everything to LLVM)

Change-Id: Id09d4934af06f0880cd867456218602ce9a9e2de
/frameworks/compile/slang/slang.cpp
e639eb5caa2c386b4a60659a4929e8a6141a2cbe 09-Nov-2010 Stephen Hines <srhines@google.com> Improve code style.

Change-Id: I26e043849bce2a4b41ae132fbe0c882f4a6f112f
/frameworks/compile/slang/slang.cpp
41ebf534161bb67f6207a070c1f6a895dc853408 13-Oct-2010 Zonr Chang <zonr@google.com> Remove Slang::TargetDescription.

Clang and LLVM never read outside target description to configure the
target-dependent information needed during compilation and codegen. They
always use their own data layout string for specific, known target.
/frameworks/compile/slang/slang.cpp
641558f02fe6ce0ee3ae5076eb366c25e2ad5903 12-Oct-2010 Zonr Chang <zonr@google.com> Implement one-definition-rule (ODR) feature.

When compiling multiple RS files, we say two RS files A and B break ODR
iff:

1. They have at least one common struct named [S] and [S] will be reflected
to ScriptField_[S].java, and
2. [S] defined in A is not *exactly the same* (number of fields, field
type and field name) as the one defined in B.

This CL detects such error.
/frameworks/compile/slang/slang.cpp
c383a500aa59423264811be3874461bf8adbfea0 11-Oct-2010 Zonr Chang <zonr@google.com> Prepend legal announcement in all files.

Release libslang/llvm-rs-cc/llvm-rs-link under Apache 2.0 license.
/frameworks/compile/slang/slang.cpp
e8c263a1c5df81594cf302ecadd813909c894487 11-Oct-2010 Zonr Chang <zonr@google.com> Refactor a bit & -M bug fixed.

1. Use llvm::tool_output_file instead of llvm::raw_stream. The former
can automatically deleted itself from filesystem once the compilation failed.
2. Fix -M bug which causes segfault previously.
/frameworks/compile/slang/slang.cpp
b81c6a4cbd9c08e0b20ea4fbc615b416ac1bc9ec 10-Oct-2010 Shih-wei Liao <sliao@google.com> Revert "Revert "New implementation of llvm-rs-cc (replacement of slang_driver).""

This reverts commit a6d60672695f1438a63acdbf85eae7f97ce2b50d.
/frameworks/compile/slang/slang.cpp
a6d60672695f1438a63acdbf85eae7f97ce2b50d 10-Oct-2010 Shih-wei Liao <sliao@google.com> Revert "New implementation of llvm-rs-cc (replacement of slang_driver)."

This reverts commit 6791df284557f4173a9715b3634f4f4901a6bb8a.
/frameworks/compile/slang/slang.cpp
6791df284557f4173a9715b3634f4f4901a6bb8a 09-Oct-2010 Shih-wei Liao <sliao@google.com> New implementation of llvm-rs-cc (replacement of slang_driver).

Change-Id: I1b8b6cf3dad8ef8fe2f4d24d4df604099f45ff37
/frameworks/compile/slang/slang.cpp
b257301a1c711ba81458a4f8bf3c99c91c91a047 07-Oct-2010 Zonr Chang <zonr@google.com> Don't include rs_graphics.rsh by default.
Fix the Externalize in slang_driver.cpp.

Change-Id: Idce037b0150af3ea9968e39b7bce63a0e1b6d9a5
/frameworks/compile/slang/slang.cpp
08df36e5c0a990306d958c9f6d59a5de23b748f6 07-Oct-2010 Zonr Chang <zonr@google.com> Factor out shared library libslang.so from slang.

libslang.so can be regarded as a lightweight Clang compiler. Only C-like
language compilation is supported in libslang.so currently. Both llvm-rs-link
and slang now link to this library.

Change-Id: Ib8f8dc8568640bc36c2b1fe8dba1212c4c8a56c8
/frameworks/compile/slang/slang.cpp
8c6d9b2d36ed2d6d811279fd9bddc05fffe16803 07-Oct-2010 Zonr Chang <zonr@google.com> Use llvm::sys::Path to implement "mkdir -p".

Change-Id: I3bb36e1a8050bbd9744fd02935b6186d2f285015
/frameworks/compile/slang/slang.cpp
5457231d5201be02c3232ffc1c6d8bc408f276ab 08-Oct-2010 Ying Wang <wangying@google.com> Pass additional dep target to slang

By "slang -a out/foo/bar/RenderScript.stamp ...", additional dep target will be added to the .d file,
something like:
out/target/common/obj/APPS/Fountain_intermediates/src/RenderScript.stamp ./fountain.bc: \
frameworks/base/libs/rs/java/Fountain/src/com/android/fountain/fountain.rs \
...

Currently the .bc file is not used in the build system dependency graph, but the stamp file.

Change-Id: I1251dba0a4b003e4b6bc689f1064bddd4ffbccc1
/frameworks/compile/slang/slang.cpp
0b7ef1a176b9ddd1e0d437efdce20743373fd7db 08-Oct-2010 Stephen Hines <srhines@google.com> Add support to Slang for "-MD" option.

Change-Id: Ie01ccb3f07191f6de954b8094eec5ab47e703817
/frameworks/compile/slang/slang.cpp
f7de85223c8728d5dc147e8a19ddf039da72b431 06-Oct-2010 Stephen Hines <srhines@google.com> Fix a minor error checking bug.

Change-Id: I26c809d361071eba06efb734ea2b54c4dc560981
/frameworks/compile/slang/slang.cpp
cc0efad052e944f64bb71cfdaa8a825e30192e78 05-Oct-2010 Stephen Hines <srhines@google.com> Add "-M" dependency generation to Slang.

Change-Id: I26d1daf1005de7b3ad297fba5ad0d85a1aab1e45
/frameworks/compile/slang/slang.cpp
3a9ca1f0d6bd8f12c2bb2adea51f95c255996180 06-Oct-2010 Zonr Chang <zonr@google.com> Provide better abstraction of class Slang.

1. Remove the Slang C APIs support (not used by any other programs.)
2. All RS relatives are now in slang_rs_*.cpp.
/frameworks/compile/slang/slang.cpp
6315f76e3cc6ff2d012d1183a0b030d4ff0dc808 05-Oct-2010 zonr <zonr@google.com> More coding style fixing to improve the readability. No actual semantics
changed. This also makes cpplint happy.
/frameworks/compile/slang/slang.cpp
9ef2f785e0cc490af678dfd685995dec787321ff 01-Oct-2010 Shih-wei Liao <sliao@google.com> The Mother-of-All code review:
1. Fix AllowRSPrefix bug
2. Remove member mRS*Pragma in class RSContext
3. No longer only support 2x2, 3x3, 4x4 arrays
4. Fix Export All code for victorhsieh
5. Improve readability and maintainability
6. size_t -> int in calculating padding

Change-Id: I772aebd1440af66a89e2d2e688b193e500f38d69
/frameworks/compile/slang/slang.cpp
1ebc0ca6ffa7effb875883d18205ed4943ab8fc2 14-Sep-2010 Shih-wei Liao <sliao@google.com> Implement the ARM-specific struct layout ABI in exportable functions parameters for rs. Add the ABI-compliant #args when needed.
My old code inadvertently assumed x86 ABIs for structs, but ARM ABI/calling convention is tricky here, compared to x86's. Also, fixed the type promotion problem.
Note that the most portable fix is to add a shim layer in Clang which is a BIG undertaking like PNaCl. Let's put in the potential fix for b/2988615 now.

Change-Id: I1d9fe4d803485b55bb72112ea8e17c1f4a19dd32
/frameworks/compile/slang/slang.cpp
f52a620440fa62257dfdcf2583f0f9df5b855c76 11-Sep-2010 Shih-wei Liao <sliao@google.com> Apply changes on slang such that it can work with LLVM/Clang upstream r112364/r112367.

Change-Id: If38da28502a6111b855105c2fceb23fdb0caefa4
/frameworks/compile/slang/slang.cpp
3f8b44dba57685b437cecc208f2a20a4ed93ed36 04-Sep-2010 Ying Wang <wangying@google.com> Encode the bitcode binary files into Java source files.

So that the apps don't need to have the bc files as resources.
The bitcode java files will be put at the same dir as the reflected java files.
The bitcode java file name will be <ClassName>BitCode.java.
The bitcode is represented as byte array and you can reference it as:
byte[] bitcode = <ClassName>BitCode.getBitCode();

To enable this feature, pass "-s jc" to the command line.

The class name <ClassName> is converted from the .rs file name, for example:
foo.rs -> FooBitCode.java
foo_bar.rs -> FooBarBitCode.java
fooBar.rs -> FooBarBitCode.java
foobar.rs -> FoobarBitCode.java

i.e., any non-alnum characters in the rs file name are filtered
and the rest are converted to camel case.

The above method is also applied to the reflected java classes now.

Change-Id: Idf234d4c017e33740a13d6cd68bc3e14710ec149
/frameworks/compile/slang/slang.cpp
e2e522f0d23c074ecd1025f1f2ed161ed485d9c8 01-Sep-2010 Ying Wang <wangying@google.com> Customized header search paths

1. Use "-I <path>" (or "--include-path <path>") to add a header search path.
2. You can specify more than 1 search path and the preceding path takes precedence.
3. System include path is moved out of the code -- they are inserted in the build system instead.

Change-Id: Idfaee4763e8bf0cd71deeecdf1dc1ec515e44d0f
/frameworks/compile/slang/slang.cpp
4c9f742efa36b1037acc640184681d421aa0f6ba 05-Aug-2010 Shih-wei Liao <sliao@google.com> Right usage of linking. Enable the reuse of the same Slang object across multiple input files.

Change-Id: Id036c300ece9a245437ea2bdd0a9c0da436f558d
/frameworks/compile/slang/slang.cpp
f83d3c396d5d7eacd97cf0a5d3b6a01d75535b67 31-Jul-2010 Shih-wei Liao <sliao@google.com> Support multiple .rs files. Change "-o" to denote output path for .bc, NOT the output .bc file.

Change-Id: I168b3f96de37b0d6a787b3a83306ac84a0ebebb5
/frameworks/compile/slang/slang.cpp
60de5bd34649e3a0acfdbc881a07b16781fd2661 21-Jul-2010 Shih-wei Liao <sliao@google.com> Change the Preprocessor to automatically include rs_types.rsh and rs_math.rsh. They are part of the standard RenderScript APIs.

Change-Id: Ib79d624bec877869f420f7f4c2bc294b139db597
/frameworks/compile/slang/slang.cpp
9089828a995422a5ed3beeed0890b755c4abe188 20-Jul-2010 Shih-wei Liao <sliao@google.com> Add curr directory to include path.

Change-Id: I67eba0fd18a703d9349d58446fbafbcd32a08dfb
/frameworks/compile/slang/slang.cpp
8eac0940b8d13f8c4bad50942bf8527d64ccd12c 19-Jul-2010 Shih-wei Liao <sliao@google.com> Add frameworks/base/libs/rs/scriptc to system include path.

Change-Id: I5b28bdefb7ddc99b9861dc49bd088c813806f0f4
/frameworks/compile/slang/slang.cpp
66819a96bda9362f86e4f26ed8a9b1f73961b27a 19-Jul-2010 Shih-wei Liao <sliao@google.com> Clean up printing.

Change-Id: I0c335d1e8203fe412466b0e2b83ceda0ea33b56b
/frameworks/compile/slang/slang.cpp
68e8e9f98730b3672fb96d49e33b9db70a90ed3f 19-Jul-2010 Shih-wei Liao <sliao@google.com> Add include path and deal with the case that "-p" flag on path is unspecified.

Change-Id: I592b23ac1e08b62088a9a9e1bfc8109b56929386
/frameworks/compile/slang/slang.cpp
807a0eaf3c19dc067becdca46a10e8c703d1e871 17-Jul-2010 Che-Liang Chiou <clchiou@google.com> Handle corner case if file path is too long.

Change-Id: Idf6cd3530d45d21ae40d8d27265368619e70155f
/frameworks/compile/slang/slang.cpp
b55d7ef3333534fc6aad80f9a9133f2bf945faf1 16-Jul-2010 Shih-wei Liao <sliao@google.com> Change "-o" to create parent directories if it's needed.

Change-Id: I98de7f29d338c5849f5fcd7fb598c00150140d5a
/frameworks/compile/slang/slang.cpp
6de89272b00a31f2a73e2f56edf9cc511df46265 16-Jul-2010 Shih-wei Liao <sliao@google.com> Add --output-java-reflection-path | -p

Change-Id: I951a3540aa653060f81ff76b670ffb4b0029a3ca
/frameworks/compile/slang/slang.cpp
1fd8579fe65b13a26cfaad12d056d2fc9b46475a 07-Jul-2010 Kirk Stewart <kstewart@google.com> Add a command-line option to allow function names with the "rs" prefix (--allow-rs-prefix). When not specified, user-defined functions with that prefix will be treated as an error.

Change-Id: Ieefc8bb55d61980241d5392ffb32770a303ce6a7
/frameworks/compile/slang/slang.cpp
001fb6dddbf1cc794532eeb6a55f7b500eab1abc 21-Jun-2010 Shih-wei Liao <sliao@google.com> 1. Add comments to clarify (E.g., don't worry. "syntax error will be triggered by predecessor later")
2. Create ASTContext before RSContext creation and pass it to RSContext for using later

Change-Id: I6c11af70f1a13036c560aa34d311808548390864
/frameworks/compile/slang/slang.cpp
462aefd62cc646d2ff753c1d003ef3cd7bbea262 05-Jun-2010 Shih-wei Liao <sliao@google.com> Initialize slang and Android.mk.

Change-Id: If74da8e54d45511c8c9bb236bcfeec508f4f2439
/frameworks/compile/slang/slang.cpp