diff options
author | Quentin Colombet <qcolombet@apple.com> | 2016-03-07 22:47:23 +0000 |
---|---|---|
committer | Quentin Colombet <qcolombet@apple.com> | 2016-03-07 22:47:23 +0000 |
commit | 41bea872ddb518c4c004d649002f2937ae1d2896 (patch) | |
tree | d652c438c7c0e38037b0e2cd1cd79cc0b0809d61 /llvm/lib/CodeGen/MachineInstr.cpp | |
parent | e7964789dabaa5b9fb26c50f54deafb7fb8db4d6 (diff) | |
download | llvm-41bea872ddb518c4c004d649002f2937ae1d2896.zip llvm-41bea872ddb518c4c004d649002f2937ae1d2896.tar.gz llvm-41bea872ddb518c4c004d649002f2937ae1d2896.tar.bz2 |
[MachineInstr] Get rid of some GlobalISel ifdefs.
Now the type API is always available, but when global-isel is not
built the implementation does nothing.
Note: The implementation free of ifdefs is WIP and tracked here in PR26576.
llvm-svn: 262873
Diffstat (limited to 'llvm/lib/CodeGen/MachineInstr.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineInstr.cpp | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp index e1c682e..bc99a06 100644 --- a/llvm/lib/CodeGen/MachineInstr.cpp +++ b/llvm/lib/CodeGen/MachineInstr.cpp @@ -705,6 +705,25 @@ MachineRegisterInfo *MachineInstr::getRegInfo() { return nullptr; } +// Implement dummy setter and getter for type when +// global-isel is not built. +// The proper implementation is WIP and is tracked here: +// PR26576. +#ifndef LLVM_BUILD_GLOBAL_ISEL +void MachineInstr::setType(Type *Ty) {} + +Type *MachineInstr::getType() const { return nullptr; } + +#else +void MachineInstr::setType(Type *Ty) { + assert((!Ty || isPreISelGenericOpcode(getOpcode())) && + "Non generic instructions are not supposed to be typed"); + this->Ty = Ty; +} + +Type *MachineInstr::getType() const { return Ty; } +#endif // LLVM_BUILD_GLOBAL_ISEL + /// RemoveRegOperandsFromUseLists - Unlink all of the register operands in /// this instruction from their respective use lists. This requires that the /// operands already be on their use lists. @@ -1688,11 +1707,11 @@ void MachineInstr::print(raw_ostream &OS, ModuleSlotTracker &MST, else OS << "UNKNOWN"; - -#ifdef LLVM_BUILD_GLOBAL_ISEL - if (Ty) - OS << ' ' << *Ty << ' '; -#endif + if (getType()) { + OS << ' '; + getType()->print(OS, /*IsForDebug*/ false, /*NoDetails*/ true); + OS << ' '; + } if (SkipOpers) return; |