diff options
author | Alex Lorenz <arphaman@gmail.com> | 2015-08-11 22:32:00 +0000 |
---|---|---|
committer | Alex Lorenz <arphaman@gmail.com> | 2015-08-11 22:32:00 +0000 |
commit | c49e4fe9ccff7587a271d5c17ecad130d2dea201 (patch) | |
tree | 0f2669c19c0fa1cb5d9f26c2e2395ef0800c0fea /llvm/lib | |
parent | bceefe85c6ce2233301ef982c94e20b632cf5bb4 (diff) | |
download | bcm5719-llvm-c49e4fe9ccff7587a271d5c17ecad130d2dea201.tar.gz bcm5719-llvm-c49e4fe9ccff7587a271d5c17ecad130d2dea201.zip |
PseudoSourceValue: Introduce a 'PSVKind' enumerator.
This commit introduces a new enumerator named 'PSVKind' in the
'PseudoSourceValue' class. This enumerator is now used to distinguish between
the various kinds of pseudo source values.
This change is done in preparation for the changes to the pseudo source value
object management and to the PseudoSourceValue's class hierarchy - the next two
PseudoSourceValue commits will get rid of the global variable that manages the
pseudo source values and the mips specific MipsCallEntry subclass.
Reviewers: Akira Hatanaka
llvm-svn: 244687
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/PseudoSourceValue.cpp | 36 | ||||
-rw-r--r-- | llvm/lib/Target/Mips/MipsMachineFunction.cpp | 5 |
2 files changed, 22 insertions, 19 deletions
diff --git a/llvm/lib/CodeGen/PseudoSourceValue.cpp b/llvm/lib/CodeGen/PseudoSourceValue.cpp index f0127766f71..612293555e6 100644 --- a/llvm/lib/CodeGen/PseudoSourceValue.cpp +++ b/llvm/lib/CodeGen/PseudoSourceValue.cpp @@ -25,11 +25,14 @@ using namespace llvm; namespace { struct PSVGlobalsTy { // PseudoSourceValues are immutable so don't need locking. - const PseudoSourceValue PSVs[4]; + const PseudoSourceValue StackPSV, GOTPSV, JumpTablePSV, ConstantPoolPSV; sys::Mutex Lock; // Guards FSValues, but not the values inside it. std::map<int, const PseudoSourceValue *> FSValues; - PSVGlobalsTy() : PSVs() {} + PSVGlobalsTy() + : StackPSV(PseudoSourceValue::Stack), GOTPSV(PseudoSourceValue::GOT), + JumpTablePSV(PseudoSourceValue::JumpTable), + ConstantPoolPSV(PseudoSourceValue::ConstantPool) {} ~PSVGlobalsTy() { for (std::map<int, const PseudoSourceValue *>::iterator I = FSValues.begin(), @@ -45,27 +48,27 @@ static ManagedStatic<PSVGlobalsTy> PSVGlobals; } // anonymous namespace const PseudoSourceValue *PseudoSourceValue::getStack() { - return &PSVGlobals->PSVs[0]; + return &PSVGlobals->StackPSV; } const PseudoSourceValue *PseudoSourceValue::getGOT() { - return &PSVGlobals->PSVs[1]; + return &PSVGlobals->GOTPSV; } const PseudoSourceValue *PseudoSourceValue::getJumpTable() { - return &PSVGlobals->PSVs[2]; + return &PSVGlobals->JumpTablePSV; } const PseudoSourceValue *PseudoSourceValue::getConstantPool() { - return &PSVGlobals->PSVs[3]; + return &PSVGlobals->ConstantPoolPSV; } -static const char *const PSVNames[] = {"Stack", "GOT", "JumpTable", - "ConstantPool"}; +static const char *const PSVNames[] = { + "Stack", "GOT", "JumpTable", "ConstantPool", "FixedStack", "MipsCallEntry"}; -PseudoSourceValue::PseudoSourceValue(bool IsFixed) : IsFixed(IsFixed) {} +PseudoSourceValue::PseudoSourceValue(PSVKind Kind) : Kind(Kind) {} PseudoSourceValue::~PseudoSourceValue() {} void PseudoSourceValue::printCustom(raw_ostream &O) const { - O << PSVNames[this - PSVGlobals->PSVs]; + O << PSVNames[Kind]; } const PseudoSourceValue *PseudoSourceValue::getFixedStack(int FI) { @@ -78,22 +81,21 @@ const PseudoSourceValue *PseudoSourceValue::getFixedStack(int FI) { } bool PseudoSourceValue::isConstant(const MachineFrameInfo *) const { - if (this == getStack()) + if (isStack()) return false; - if (this == getGOT() || this == getConstantPool() || this == getJumpTable()) + if (isGOT() || isConstantPool() || isJumpTable()) return true; llvm_unreachable("Unknown PseudoSourceValue!"); } -bool PseudoSourceValue::isAliased(const MachineFrameInfo *MFI) const { - if (this == getStack() || this == getGOT() || this == getConstantPool() || - this == getJumpTable()) +bool PseudoSourceValue::isAliased(const MachineFrameInfo *) const { + if (isStack() || isGOT() || isConstantPool() || isJumpTable()) return false; llvm_unreachable("Unknown PseudoSourceValue!"); } -bool PseudoSourceValue::mayAlias(const MachineFrameInfo *MFI) const { - if (this == getGOT() || this == getConstantPool() || this == getJumpTable()) +bool PseudoSourceValue::mayAlias(const MachineFrameInfo *) const { + if (isGOT() || isConstantPool() || isJumpTable()) return false; return true; } diff --git a/llvm/lib/Target/Mips/MipsMachineFunction.cpp b/llvm/lib/Target/Mips/MipsMachineFunction.cpp index 0d1ee046f0d..ebc5ac0486c 100644 --- a/llvm/lib/Target/Mips/MipsMachineFunction.cpp +++ b/llvm/lib/Target/Mips/MipsMachineFunction.cpp @@ -25,14 +25,15 @@ FixGlobalBaseReg("mips-fix-global-base-reg", cl::Hidden, cl::init(true), cl::desc("Always use $gp as the global base register.")); // class MipsCallEntry. -MipsCallEntry::MipsCallEntry(StringRef N) { +MipsCallEntry::MipsCallEntry(StringRef N) : PseudoSourceValue(MipsPSV) { #ifndef NDEBUG Name = N; Val = nullptr; #endif } -MipsCallEntry::MipsCallEntry(const GlobalValue *V) { +MipsCallEntry::MipsCallEntry(const GlobalValue *V) + : PseudoSourceValue(MipsPSV) { #ifndef NDEBUG Val = V; #endif |