diff options
author | Akira Hatanaka <ahatanaka@mips.com> | 2013-09-27 22:30:36 +0000 |
---|---|---|
committer | Akira Hatanaka <ahatanaka@mips.com> | 2013-09-27 22:30:36 +0000 |
commit | e0657b24196f341f252222968916463b54b81d6a (patch) | |
tree | df5eebc8cbc7781580d5ea95e3e66a3a2e32a79f /llvm/lib/Target/Mips/MipsMachineFunction.cpp | |
parent | 826eec5913785e0bb26a663d27e099191ba8d369 (diff) | |
download | bcm5719-llvm-e0657b24196f341f252222968916463b54b81d6a.tar.gz bcm5719-llvm-e0657b24196f341f252222968916463b54b81d6a.zip |
[mips] Define a derived class of PseudoSourceValue that represents a GOT entry
resolved by lazy-binding.
llvm-svn: 191578
Diffstat (limited to 'llvm/lib/Target/Mips/MipsMachineFunction.cpp')
-rw-r--r-- | llvm/lib/Target/Mips/MipsMachineFunction.cpp | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/llvm/lib/Target/Mips/MipsMachineFunction.cpp b/llvm/lib/Target/Mips/MipsMachineFunction.cpp index a7299d73a82..c32f56c0ddc 100644 --- a/llvm/lib/Target/Mips/MipsMachineFunction.cpp +++ b/llvm/lib/Target/Mips/MipsMachineFunction.cpp @@ -22,6 +22,53 @@ static cl::opt<bool> 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(const StringRef &N) { +#ifndef NDEBUG + Name = N; + Val = 0; +#endif +} + +MipsCallEntry::MipsCallEntry(const GlobalValue *V) { +#ifndef NDEBUG + Val = V; +#endif +} + +bool MipsCallEntry::isConstant(const MachineFrameInfo *) const { + return false; +} + +bool MipsCallEntry::isAliased(const MachineFrameInfo *) const { + return false; +} + +bool MipsCallEntry::mayAlias(const MachineFrameInfo *) const { + return false; +} + +void MipsCallEntry::printCustom(raw_ostream &O) const { + O << "MipsCallEntry: "; +#ifndef NDEBUG + if (Val) + O << Val->getName(); + else + O << Name; +#endif +} + +MipsFunctionInfo::~MipsFunctionInfo() { + for (StringMap<const MipsCallEntry *>::iterator + I = ExternalCallEntries.begin(), E = ExternalCallEntries.end(); I != E; + ++I) + delete I->getValue(); + + for (ValueMap<const GlobalValue *, const MipsCallEntry *>::iterator + I = GlobalCallEntries.begin(), E = GlobalCallEntries.end(); I != E; ++I) + delete I->second; +} + bool MipsFunctionInfo::globalBaseRegSet() const { return GlobalBaseReg; } @@ -72,4 +119,26 @@ bool MipsFunctionInfo::isEhDataRegFI(int FI) const { || FI == EhDataRegFI[2] || FI == EhDataRegFI[3]); } +MachinePointerInfo MipsFunctionInfo::callPtrInfo(const StringRef &Name) { + StringMap<const MipsCallEntry *>::const_iterator I; + I = ExternalCallEntries.find(Name); + + if (I != ExternalCallEntries.end()) + return MachinePointerInfo(I->getValue()); + + const MipsCallEntry *E = ExternalCallEntries[Name] = new MipsCallEntry(Name); + return MachinePointerInfo(E); +} + +MachinePointerInfo MipsFunctionInfo::callPtrInfo(const GlobalValue *Val) { + ValueMap<const GlobalValue *, const MipsCallEntry *>::const_iterator I; + I = GlobalCallEntries.find(Val); + + if (I != GlobalCallEntries.end()) + return MachinePointerInfo(I->second); + + const MipsCallEntry *E = GlobalCallEntries[Val] = new MipsCallEntry(Val); + return MachinePointerInfo(E); +} + void MipsFunctionInfo::anchor() { } |