diff options
author | I-Jui (Ray) Sung <ijsung@google.com> | 2017-03-07 02:43:08 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-03-07 02:43:08 +0000 |
commit | 416488e4a08d9b84c9677898bd406bb98cba1654 (patch) | |
tree | 6b647e6c8961990955c154c6a2a79c502c4aec37 /rsov | |
parent | 0a9cbaa493eb902334bb9e6f2418e83cffa506e2 (diff) | |
parent | 3232846582459bc58d76acf7d2d41c1c097c560b (diff) | |
download | rs-416488e4a08d9b84c9677898bd406bb98cba1654.tar.gz |
Merge "Added addString() method to android::spirit::Module" am: 3c38a741f6 am: 8f55a77abc
am: 3232846582
Change-Id: Idc24dc8308d8e2790a846a0cc5614c44fa8896e7
Diffstat (limited to 'rsov')
-rw-r--r-- | rsov/compiler/spirit/builder_test.cpp | 2 | ||||
-rw-r--r-- | rsov/compiler/spirit/module.cpp | 14 | ||||
-rw-r--r-- | rsov/compiler/spirit/module.h | 2 |
3 files changed, 18 insertions, 0 deletions
diff --git a/rsov/compiler/spirit/builder_test.cpp b/rsov/compiler/spirit/builder_test.cpp index 48030aeb..bb935b66 100644 --- a/rsov/compiler/spirit/builder_test.cpp +++ b/rsov/compiler/spirit/builder_test.cpp @@ -44,6 +44,7 @@ TEST(BuilderTest, testBuildAndSerialize) { m->addSourceExtension("GL_ARB_shading_language_420pack"); m->addSourceExtension("GL_GOOGLE_cpp_style_line_directive"); m->addSourceExtension("GL_GOOGLE_include_directive"); + m->addString("Foo Bar Baz"); auto FloatTy = m->getFloatType(32); auto VF4Ty = m->getVectorType(FloatTy, 4); @@ -178,6 +179,7 @@ TEST(BuilderTest, testBuildAndSerialize) { EXPECT_EQ(2, countEntity<TypeRuntimeArrayInst>(m)); EXPECT_EQ(2, countEntity<TypeStructInst>(m)); EXPECT_EQ(5, countEntity<TypePointerInst>(m)); + EXPECT_EQ(1, countEntity<StringInst>(m)); m->consolidateAnnotations(); diff --git a/rsov/compiler/spirit/module.cpp b/rsov/compiler/spirit/module.cpp index 98001124..9880f780 100644 --- a/rsov/compiler/spirit/module.cpp +++ b/rsov/compiler/spirit/module.cpp @@ -214,6 +214,14 @@ Module *Module::addSourceExtension(const char *ext) { return this; } +Module *Module::addString(const char *str) { + if (!mDebugInfo) { + mDebugInfo.reset(mBuilder->MakeDebugInfoSection()); + } + mDebugInfo->addString(str); + return this; +} + Module *Module::addEntryPoint(EntryPointDefinition *entry) { mEntryPoints.push_back(entry); auto newModes = entry->getExecutionModes(); @@ -515,6 +523,12 @@ DebugInfoSection *DebugInfoSection::addSourceExtension(const char *ext) { return this; } +DebugInfoSection *DebugInfoSection::addString(const char *str) { + StringInst *source = mBuilder->MakeString(str); + mSources.push_back(source); + return this; +} + Instruction *DebugInfoSection::lookupByName(const char *name) const { for (auto inst : mNames) { if (inst->getOpCode() == OpName) { diff --git a/rsov/compiler/spirit/module.h b/rsov/compiler/spirit/module.h index a69d255f..33011602 100644 --- a/rsov/compiler/spirit/module.h +++ b/rsov/compiler/spirit/module.h @@ -124,6 +124,7 @@ public: Module *addExtInstImport(const char *extName); Module *addSource(SourceLanguage lang, int version); Module *addSourceExtension(const char *ext); + Module *addString(const char *ext); Module *addEntryPoint(EntryPointDefinition *entry); ExtInstImportInst *getGLExt() const { return mGLExt; } @@ -312,6 +313,7 @@ public: DebugInfoSection *addSource(SourceLanguage lang, int version); DebugInfoSection *addSourceExtension(const char *ext); + DebugInfoSection *addString(const char *str); Instruction *lookupByName(const char *name) const; const char *lookupNameByInstruction(const Instruction *) const; |