aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/PowerPC/PPCSubtarget.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-06-16 17:50:12 +0000
committerChris Lattner <sabre@nondot.org>2006-06-16 17:50:12 +0000
commit7c1fb5f08c7c1e9550b7eb2d8d32c93648a6d08e (patch)
tree262f6b6f979527773aa05eaf11c2df76c551c4e7 /lib/Target/PowerPC/PPCSubtarget.cpp
parenta7a5854f1c3710f4bedf069be4771b81e449f2a3 (diff)
Document the subtarget features better, make sure that 64-bit mode, 64-bit
support, and 64-bit register use are all consistent with each other. Add a new "IsPPC" feature, to distinguish ppc32 vs ppc64 targets, use this to configure TargetData differently. This not makes ppc64 blow up on lots of stuff :) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28825 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/PowerPC/PPCSubtarget.cpp')
-rw-r--r--lib/Target/PowerPC/PPCSubtarget.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/Target/PowerPC/PPCSubtarget.cpp b/lib/Target/PowerPC/PPCSubtarget.cpp
index b228ba7a9c..f7a9560cda 100644
--- a/lib/Target/PowerPC/PPCSubtarget.cpp
+++ b/lib/Target/PowerPC/PPCSubtarget.cpp
@@ -16,6 +16,7 @@
#include "llvm/Module.h"
#include "llvm/Support/CommandLine.h"
#include "PPCGenSubtarget.inc"
+#include <iostream>
using namespace llvm;
PPCTargetEnum llvm::PPCTarget = TargetDefault;
@@ -75,6 +76,7 @@ PPCSubtarget::PPCSubtarget(const Module &M, const std::string &FS, bool is64Bit)
, IsGigaProcessor(false)
, Has64BitSupport(false)
, Use64BitRegs(false)
+ , IsPPC64(is64Bit)
, HasAltivec(false)
, HasFSQRT(false)
, HasSTFIWX(false)
@@ -90,6 +92,25 @@ PPCSubtarget::PPCSubtarget(const Module &M, const std::string &FS, bool is64Bit)
// Parse features string.
ParseSubtargetFeatures(FS, CPU);
+ // If we are generating code for ppc64, verify that options make sense.
+ if (is64Bit) {
+ if (!has64BitSupport()) {
+ std::cerr << "PPC: Generation of 64-bit code for a 32-bit processor "
+ "requested. Ignoring 32-bit processor feature.\n";
+ Has64BitSupport = true;
+ // Silently force 64-bit register use on ppc64.
+ Use64BitRegs = true;
+ }
+ }
+
+ // If the user requested use of 64-bit regs, but the cpu selected doesn't
+ // support it, warn and ignore.
+ if (use64BitRegs() && !has64BitSupport()) {
+ std::cerr << "PPC: 64-bit registers requested on CPU without support. "
+ "Disabling 64-bit register use.\n";
+ Use64BitRegs = false;
+ }
+
// Set the boolean corresponding to the current target triple, or the default
// if one cannot be determined, to true.
const std::string& TT = M.getTargetTriple();