aboutsummaryrefslogtreecommitdiff
path: root/source/Core/ArchSpec.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/Core/ArchSpec.cpp')
-rw-r--r--source/Core/ArchSpec.cpp45
1 files changed, 40 insertions, 5 deletions
diff --git a/source/Core/ArchSpec.cpp b/source/Core/ArchSpec.cpp
index 24aba81350a6..efdbf11d93e3 100644
--- a/source/Core/ArchSpec.cpp
+++ b/source/Core/ArchSpec.cpp
@@ -519,11 +519,46 @@ ArchSpec::IsMIPS() const
return false;
}
-std::string
-ArchSpec::GetClangTargetCPU ()
-{
- std::string cpu;
- const llvm::Triple::ArchType machine = GetMachine();
+
+std::string ArchSpec::GetTargetABI() const {
+
+ std::string abi;
+
+ if (IsMIPS()) {
+ switch (GetFlags() & ArchSpec::eMIPSABI_mask) {
+ case ArchSpec::eMIPSABI_N64:
+ abi = "n64";
+ return abi;
+ case ArchSpec::eMIPSABI_N32:
+ abi = "n32";
+ return abi;
+ case ArchSpec::eMIPSABI_O32:
+ abi = "o32";
+ return abi;
+ default:
+ return abi;
+ }
+ }
+ return abi;
+}
+
+void ArchSpec::SetFlags(std::string elf_abi) {
+
+ uint32_t flag = GetFlags();
+ if (IsMIPS()) {
+ if (elf_abi == "n64")
+ flag |= ArchSpec::eMIPSABI_N64;
+ else if (elf_abi == "n32")
+ flag |= ArchSpec::eMIPSABI_N32;
+ else if (elf_abi == "o32")
+ flag |= ArchSpec::eMIPSABI_O32;
+ }
+ SetFlags(flag);
+}
+
+std::string ArchSpec::GetClangTargetCPU() {
+ std::string cpu;
+ const llvm::Triple::ArchType machine = GetMachine();
if (machine == llvm::Triple::mips ||
machine == llvm::Triple::mipsel ||