[llvm-branch-commits] [lldb] r271381 - Merging r269407:
Mohit K. Bhakkad via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Jun 1 04:45:10 PDT 2016
Author: mohit.bhakkad
Date: Wed Jun 1 06:41:12 2016
New Revision: 271381
URL: http://llvm.org/viewvc/llvm-project?rev=271381&view=rev
Log:
Merging r269407:
------------------------------------------------------------------------
r269407 | slthakur | 2016-05-13 16:34:47 +0530 (Fri, 13 May 2016) | 10 lines
[LLDB][MIPS] Provide ABI string to compiler for appropriate code generation for MIPS
Patch by Nitesh Jain.
Summary: These patch will set clang::TargetOptions::ABI and accordingly code will be generated for MIPS target.
Reviewers: ovyalov, clayborg
Subscribers: lldb-commits, mohit.bhakkad, sagar, jaydeep, bhushan
Differential: D18638
------------------------------------------------------------------------
Modified:
lldb/branches/release_38/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
lldb/branches/release_38/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h
Modified: lldb/branches/release_38/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/release_38/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp?rev=271381&r1=271380&r2=271381&view=diff
==============================================================================
--- lldb/branches/release_38/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp (original)
+++ lldb/branches/release_38/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp Wed Jun 1 06:41:12 2016
@@ -175,6 +175,7 @@ ClangExpressionParser::ClangExpressionPa
if (exe_scope)
target_sp = exe_scope->CalculateTarget();
+ std::string abi;
ArchSpec target_arch;
if (target_sp)
target_arch = target_sp->GetArchitecture();
@@ -218,6 +219,11 @@ ClangExpressionParser::ClangExpressionPa
// This will be empty for any CPU that doesn't really need to make a special CPU string.
m_compiler->getTargetOpts().CPU = target_arch.GetClangTargetCPU();
+ // Set the target ABI
+ abi = GetClangTargetABI(target_arch);
+ if (!abi.empty())
+ m_compiler->getTargetOpts().ABI = abi;
+
// Create the target instance.
m_compiler->setTarget(TargetInfo::CreateTargetInfo(
m_compiler->getDiagnostics(), m_compiler->getInvocation().TargetOpts));
@@ -514,6 +520,29 @@ ClangExpressionParser::Parse (Stream &st
return num_errors;
}
+std::string
+ClangExpressionParser::GetClangTargetABI (const ArchSpec &target_arch)
+{
+ std::string abi;
+ const llvm::Triple::ArchType machine = target_arch.GetMachine();
+
+ if(target_arch.IsMIPS())
+ {
+ switch (target_arch.GetFlags () & ArchSpec::eMIPSABI_mask)
+ {
+ case ArchSpec::eMIPSABI_N64:
+ abi = "n64"; break;
+ case ArchSpec::eMIPSABI_N32:
+ abi = "n32"; break;
+ case ArchSpec::eMIPSABI_O32:
+ abi = "o32"; break;
+ default:
+ break;
+ }
+ }
+ return abi;
+}
+
static bool FindFunctionInModule (ConstString &mangled_name,
llvm::Module *module,
const char *orig_name)
Modified: lldb/branches/release_38/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/release_38/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h?rev=271381&r1=271380&r2=271381&view=diff
==============================================================================
--- lldb/branches/release_38/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h (original)
+++ lldb/branches/release_38/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h Wed Jun 1 06:41:12 2016
@@ -117,6 +117,19 @@ public:
ExecutionContext &exe_ctx,
bool &can_interpret,
lldb_private::ExecutionPolicy execution_policy) override;
+
+ //------------------------------------------------------------------
+ /// Returns a string representing current ABI.
+ ///
+ /// @param[in] target_arch
+ /// The target architecture.
+ ///
+ /// @return
+ /// A string representing target ABI for the current architecture.
+ //-------------------------------------------------------------------
+ std::string
+ GetClangTargetABI (const ArchSpec &target_arch);
+
private:
std::unique_ptr<llvm::LLVMContext> m_llvm_context; ///< The LLVM context to generate IR into
More information about the llvm-branch-commits
mailing list