summaryrefslogtreecommitdiffstats
path: root/lib/Basic/Targets.cpp
diff options
context:
space:
mode:
authorSebastian Pop <spop@codeaurora.org>2012-01-13 20:37:10 +0000
committerSebastian Pop <spop@codeaurora.org>2012-01-13 20:37:10 +0000
commit43115d4904431917ef6852ee089a8520b9940ba5 (patch)
tree0730c46b2630b7ec0bd43ca09e7266770c257585 /lib/Basic/Targets.cpp
parentedd4f3c39101912605c2a1868dd2be71aa218798 (diff)
remove assertions in the Hexagon backend specific clang driver
Patch from Jyotsna Verma: I have made the changes to remove assertions in the Hexagon backend specific clang driver. Instead of asserting on invalid arch name, it has been modified to use the default value. I have changed the implementation of the CPU flag validation for the Hexagon backend. Earlier, the clang driver performed the check and asserted on invalid inputs. In the new implementation, the driver passes the last CPU flag (or sets to "v4" if not specified) to the compiler (and also to the assembler and linker which perform their own check) instead of asserting on incorrect values. This patch changes the setCPU function for the Hexagon backend in clang/lib/Basic/Targets.cpp which causes the compiler to error out on incorrect CPU flag values. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148139 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic/Targets.cpp')
-rw-r--r--lib/Basic/Targets.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp
index b08a3d30f1..47598f8152 100644
--- a/lib/Basic/Targets.cpp
+++ b/lib/Basic/Targets.cpp
@@ -2963,7 +2963,19 @@ public:
virtual const char *getClobbers() const {
return "";
}
+
+ static const char *getHexagonCPUSuffix(StringRef Name) {
+ return llvm::StringSwitch<const char*>(Name)
+ .Case("hexagonv2", "2")
+ .Case("hexagonv3", "3")
+ .Case("hexagonv4", "4")
+ .Default(0);
+ }
+
virtual bool setCPU(const std::string &Name) {
+ if (!getHexagonCPUSuffix(Name))
+ return false;
+
CPU = Name;
return true;
}