aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiao Wang <miaowang@google.com>2015-06-25 15:04:35 -0700
committerMiao Wang <miaowang@google.com>2015-06-25 16:25:22 -0700
commitbb68ab31a5b44d62ab1dafa612cdc9a3f2d2c4e3 (patch)
treec821b3f0e20bc7c01283f6f2df55018eea8d2f0e
parent218a57b13503529a614008f281b5bcac60d8401f (diff)
downloadandroid_frameworks_compile_slang-bb68ab31a5b44d62ab1dafa612cdc9a3f2d2c4e3.tar.gz
android_frameworks_compile_slang-bb68ab31a5b44d62ab1dafa612cdc9a3f2d2c4e3.tar.bz2
android_frameworks_compile_slang-bb68ab31a5b44d62ab1dafa612cdc9a3f2d2c4e3.zip
Make llvm-rs-cc able to emit 64bit bitcode for RS C++ API
bug:21934603 Change-Id: I7c69b64739d0ce8b2fadfeb32307ec17ae06b382
-rw-r--r--llvm-rs-cc.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/llvm-rs-cc.cpp b/llvm-rs-cc.cpp
index c860c9e..905f2e7 100644
--- a/llvm-rs-cc.cpp
+++ b/llvm-rs-cc.cpp
@@ -264,13 +264,20 @@ int main(int argc, const char **argv) {
NamePairList DepFiles32;
makeFileList(&IOFiles32, &DepFiles32, Inputs, Opts, &SavedStrings);
- std::unique_ptr<slang::Slang> Compiler(
- new slang::Slang(32, &DiagEngine, &DiagsBuffer));
- int CompileFailed =
- !Compiler->compile(IOFiles32, IOFiles32, DepFiles32, Opts, *DiagOpts);
+ int CompileFailed = 0;
+ // Handle 32-bit case for Java and C++ reflection.
+ // For Java, both 32bit and 64bit will be generated.
+ // For C++, either 64bit or 32bit will be generated based on the target.
+ if (Opts.mEmit3264 || Opts.mBitWidth == 32) {
+ std::unique_ptr<slang::Slang> Compiler(
+ new slang::Slang(32, &DiagEngine, &DiagsBuffer));
+ CompileFailed =
+ !Compiler->compile(IOFiles32, IOFiles32, DepFiles32, Opts, *DiagOpts);
+ }
// Handle the 64-bit case too!
- if (Opts.mEmit3264 && !CompileFailed) {
+ bool needEmit64 = Opts.mEmit3264 || Opts.mBitWidth == 64;
+ if (needEmit64 && !CompileFailed) {
Opts.mBitWidth = 64;
NamePairList IOFiles64;
NamePairList DepFiles64;