Skip to content

Commit

Permalink
Save the optimization level the subtarget was created with in a
Browse files Browse the repository at this point in the history
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
  • Loading branch information
echristo committed May 13, 2014
1 parent e02c34b commit 7d87049
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
26 changes: 11 additions & 15 deletions lib/Target/PowerPC/PPCSubtarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);

Expand Down
3 changes: 3 additions & 0 deletions lib/Target/PowerPC/PPCSubtarget.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ class PPCSubtarget : public PPCGenSubtargetInfo {
/// 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.
Expand Down

0 comments on commit 7d87049

Please sign in to comment.