summaryrefslogtreecommitdiff
path: root/rsov
diff options
context:
space:
mode:
authorYang Ni <yangni@google.com>2017-03-02 17:22:10 -0800
committerYang Ni <yangni@google.com>2017-03-06 09:03:24 -0800
commitae8d5acd42d52078894cdfc1a2d71988387b2e23 (patch)
tree9673503af9b597d89e3a9d7ea6f1bfd4ee06209c /rsov
parent636006e2ae9e26d856124d2c6da478eec9d779dc (diff)
downloadrs-ae8d5acd42d52078894cdfc1a2d71988387b2e23.tar.gz
Removed KernelSignature class
Bug: 30964317 No longer used. Also made other minor cleanups: Moved an #include from a .h to .cpp file; And removed an unused unimplemented method. Test: lit tests Change-Id: I0cbf4bba42b90acecd466beb255d5593faaa186f
Diffstat (limited to 'rsov')
-rw-r--r--rsov/compiler/Android.mk1
-rw-r--r--rsov/compiler/KernelSignature.cpp86
-rw-r--r--rsov/compiler/KernelSignature.h63
-rw-r--r--rsov/compiler/RSAllocationUtils.cpp1
-rw-r--r--rsov/compiler/RSAllocationUtils.h4
5 files changed, 3 insertions, 152 deletions
diff --git a/rsov/compiler/Android.mk b/rsov/compiler/Android.mk
index 0b03c45d..d78adfe5 100644
--- a/rsov/compiler/Android.mk
+++ b/rsov/compiler/Android.mk
@@ -29,7 +29,6 @@ RS2SPIRV_SOURCES := \
GlobalAllocSPIRITPass.cpp \
GlobalMergePass.cpp \
InlinePreparationPass.cpp \
- KernelSignature.cpp \
RemoveNonkernelsPass.cpp \
RSAllocationUtils.cpp \
RSSPIRVWriter.cpp \
diff --git a/rsov/compiler/KernelSignature.cpp b/rsov/compiler/KernelSignature.cpp
deleted file mode 100644
index 6367ed4c..00000000
--- a/rsov/compiler/KernelSignature.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright 2017, The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "KernelSignature.h"
-
-#include "llvm/Support/Debug.h"
-#include "llvm/Support/raw_ostream.h"
-
-using namespace llvm;
-
-namespace {
-std::string TypeToString(const Type *Ty) {
- assert(Ty);
- if (Ty->isVoidTy())
- return "void";
-
- if (auto *IT = dyn_cast<IntegerType>(Ty)) {
- if (IT->getBitWidth() == 32)
- return "int";
- else if (IT->getBitWidth() == 8)
- return "uchar";
- }
-
- if (Ty->isFloatTy())
- return "float";
-
- if (auto *VT = dyn_cast<VectorType>(Ty)) {
- auto *ET = VT->getElementType();
- if (auto *IT = dyn_cast<IntegerType>(ET)) {
- if (IT->getBitWidth() == 32)
- return "int4";
- else if (IT->getBitWidth() == 8)
- return "uchar4";
- }
- if (ET->isFloatTy())
- return "float4";
- }
-
- std::string badNameString;
- raw_string_ostream badNameStream(badNameString);
- badNameStream << '[';
- Ty->print(badNameStream);
- badNameStream << ']';
- return badNameStream.str();
-}
-} // namespace
-
-namespace rs2spirv {
-
-const std::string KernelSignature::wrapperPrefix = "%__rsov_";
-
-KernelSignature::KernelSignature(const FunctionType *FT,
- const std::string Fname, Coords CK)
- : returnType(TypeToString(FT->getReturnType())), name(Fname),
- coordsKind(CK) {
- for (const auto *ArgT : FT->params()) {
- argumentTypes.push_back(TypeToString(ArgT));
- }
- // Drop special arguments
- // TODO: handle all special argument cases.
- argumentTypes.resize(argumentTypes.size()-size_t(CK));
-}
-
-void KernelSignature::dump() const {
- dbgs() << returnType << ' ' << name << '(' << argumentTypes[0];
- const auto CoordsNum = size_t(coordsKind);
- for (size_t i = 0; i != CoordsNum; ++i)
- dbgs() << ", " << CoordsNames[i];
-
- dbgs() << ")\n";
-}
-
-} // namespace rs2spirv
diff --git a/rsov/compiler/KernelSignature.h b/rsov/compiler/KernelSignature.h
deleted file mode 100644
index 32adcf5f..00000000
--- a/rsov/compiler/KernelSignature.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright 2016, The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef RS_KERNEL_SIGNATURE_H
-#define RS_KERNEL_SIGNATURE_H
-
-#include "llvm/ADT/StringRef.h"
-#include "llvm/IR/DerivedTypes.h"
-
-#include <string>
-#include <vector>
-
-namespace rs2spirv {
-
-static const llvm::StringRef CoordsNames[] = {"x", "y", "z"};
-
-// Numeric value corresponds to the number of components.
-enum class Coords : size_t { None = 0, X, XY, XYZ, Last = XYZ };
-
-struct KernelSignature {
- typedef std::vector<std::string> ArgumentTypes;
- std::string returnType;
- std::string name;
- ArgumentTypes argumentTypes;
- Coords coordsKind;
-
- KernelSignature(const llvm::FunctionType *FT, const std::string Fname,
- Coords CK);
-
- void dump() const;
-
- inline std::string getWrapperName(void) const {
- return wrapperPrefix + "entry_" + name;
- }
-
- inline std::string getTempName(const std::string suffix) const {
- return wrapperPrefix + name + "_" + suffix;
- }
-
- static bool isWrapper(const llvm::StringRef &id) {
- return id.startswith(wrapperPrefix);
- }
-
-private:
- static const std::string wrapperPrefix;
-};
-
-} // namespace rs2spirv
-
-#endif
diff --git a/rsov/compiler/RSAllocationUtils.cpp b/rsov/compiler/RSAllocationUtils.cpp
index 2c6b8911..b9d016b4 100644
--- a/rsov/compiler/RSAllocationUtils.cpp
+++ b/rsov/compiler/RSAllocationUtils.cpp
@@ -16,6 +16,7 @@
#include "RSAllocationUtils.h"
+#include "llvm/ADT/StringRef.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/Instructions.h"
diff --git a/rsov/compiler/RSAllocationUtils.h b/rsov/compiler/RSAllocationUtils.h
index 23884d19..a3c22d1c 100644
--- a/rsov/compiler/RSAllocationUtils.h
+++ b/rsov/compiler/RSAllocationUtils.h
@@ -19,7 +19,8 @@
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/SmallVector.h"
-#include "llvm/ADT/StringRef.h"
+
+#include <string>
namespace llvm {
class CallInst;
@@ -46,7 +47,6 @@ struct RSAllocationCallInfo {
};
bool isRSAllocation(const llvm::GlobalVariable &GV);
-llvm::Optional<llvm::StringRef> getRSTypeName(const llvm::GlobalVariable &GV);
bool getRSAllocationInfo(llvm::Module &M,
llvm::SmallVectorImpl<RSAllocationInfo> &Allocs);
bool getRSAllocAccesses(llvm::SmallVectorImpl<RSAllocationInfo> &Allocs,