summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2014-05-13 20:49:08 +0000
committerEric Christopher <echristo@gmail.com>2014-05-13 20:49:08 +0000
commit7d87049ef1fec70650b0c36ab3e9251add112675 (patch)
tree17cc52f82b43336588e7efa58a258bcd65e23efe
parente02c34ba2ac2f9150236eccc0f495866f85dff9a (diff)
downloadllvm-7d87049ef1fec70650b0c36ab3e9251add112675.tar.gz
llvm-7d87049ef1fec70650b0c36ab3e9251add112675.tar.bz2
llvm-7d87049ef1fec70650b0c36ab3e9251add112675.tar.xz
Save the optimization level the subtarget was created with in a
member variable and sink the initialization of crbits into the subtarget feature reset code. No functional change, but this refactor will be used in a future commit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208726 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/PowerPC/PPCSubtarget.cpp26
-rw-r--r--lib/Target/PowerPC/PPCSubtarget.h3
2 files changed, 14 insertions, 15 deletions
diff --git a/lib/Target/PowerPC/PPCSubtarget.cpp b/lib/Target/PowerPC/PPCSubtarget.cpp
index d02914cf37..ea9daee4f8 100644
--- a/lib/Target/PowerPC/PPCSubtarget.cpp
+++ b/lib/Target/PowerPC/PPCSubtarget.cpp
@@ -35,22 +35,10 @@ using namespace llvm;
PPCSubtarget::PPCSubtarget(const std::string &TT, const std::string &CPU,
const std::string &FS, bool is64Bit,
CodeGenOpt::Level OptLevel)
- : PPCGenSubtargetInfo(TT, CPU, FS)
- , IsPPC64(is64Bit)
- , TargetTriple(TT) {
+ : PPCGenSubtargetInfo(TT, CPU, FS), IsPPC64(is64Bit), TargetTriple(TT),
+ OptLevel(OptLevel) {
initializeEnvironment();
-
- std::string FullFS = FS;
-
- // At -O2 and above, track CR bits as individual registers.
- if (OptLevel >= CodeGenOpt::Default) {
- if (!FullFS.empty())
- FullFS = "+crbits," + FullFS;
- else
- FullFS = "+crbits";
- }
-
- resetSubtargetFeatures(CPU, FullFS);
+ resetSubtargetFeatures(CPU, FS);
}
/// SetJITMode - This is called to inform the subtarget info that we are
@@ -140,6 +128,14 @@ void PPCSubtarget::resetSubtargetFeatures(StringRef CPU, StringRef FS) {
FullFS = "+64bit";
}
+ // At -O2 and above, track CR bits as individual registers.
+ if (OptLevel >= CodeGenOpt::Default) {
+ if (!FullFS.empty())
+ FullFS = "+crbits," + FullFS;
+ else
+ FullFS = "+crbits";
+ }
+
// Parse features string.
ParseSubtargetFeatures(CPUName, FullFS);
diff --git a/lib/Target/PowerPC/PPCSubtarget.h b/lib/Target/PowerPC/PPCSubtarget.h
index 75dff0679f..76f4a318e8 100644
--- a/lib/Target/PowerPC/PPCSubtarget.h
+++ b/lib/Target/PowerPC/PPCSubtarget.h
@@ -99,6 +99,9 @@ protected:
/// TargetTriple - What processor and OS we're targeting.
Triple TargetTriple;
+ /// OptLevel - What default optimization level we're emitting code for.
+ CodeGenOpt::Level OptLevel;
+
public:
/// This constructor initializes the data members to match that
/// of the specified triple.