[Lldb-commits] [PATCH] D17022: [LLDB][MIPS] Provide CPU string to compiler for appropriate code generation for MIPS

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Thu Feb 11 10:34:07 PST 2016

clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

Don't assert in ArchSpec::GetClangTargetCPU () and always call this function. See inlined comments.

Comment at: source/Core/ArchSpec.cpp:558
@@ +557,3 @@
+        default:
+            assert(false && "unexpected core");
+            break;
I would remove the assert and let people opt into supplying a valid target CPU for their architecture if they ever need to. We shouldn't crash.

Comment at: source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp:240-246
@@ -233,1 +239,9 @@
+    if (target_machine == llvm::Triple::mips ||
+        target_machine == llvm::Triple::mipsel ||
+        target_machine == llvm::Triple::mips64 ||
+        target_machine == llvm::Triple::mips64el)
+    {
+        m_compiler->getTargetOpts().CPU = target_arch.GetClangTargetCPU();
+    }
If we remove the assert, can we just always assign this (remove the "if (is_mips)")? Is the CPU string empty before this call all the time? If so "ArchSpec::GetClangTargetCPU ()" can just return an empty string for any CPU that doesn't really need to make a special CPU string..



More information about the lldb-commits mailing list