mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
Fix MemoryLocation.h use without Instructions.h
MemoryLocation.h was changed to only include Instruction.h. However, cast<> still needs the full definiton, so move MemoryLocation::getOrNone to the cpp file.
This commit is contained in:
parent
83af7955f8
commit
bd4b8dd3ba
@ -221,22 +221,7 @@ public:
|
||||
static MemoryLocation get(const Instruction *Inst) {
|
||||
return *MemoryLocation::getOrNone(Inst);
|
||||
}
|
||||
static Optional<MemoryLocation> getOrNone(const Instruction *Inst) {
|
||||
switch (Inst->getOpcode()) {
|
||||
case Instruction::Load:
|
||||
return get(cast<LoadInst>(Inst));
|
||||
case Instruction::Store:
|
||||
return get(cast<StoreInst>(Inst));
|
||||
case Instruction::VAArg:
|
||||
return get(cast<VAArgInst>(Inst));
|
||||
case Instruction::AtomicCmpXchg:
|
||||
return get(cast<AtomicCmpXchgInst>(Inst));
|
||||
case Instruction::AtomicRMW:
|
||||
return get(cast<AtomicRMWInst>(Inst));
|
||||
default:
|
||||
return None;
|
||||
}
|
||||
}
|
||||
static Optional<MemoryLocation> getOrNone(const Instruction *Inst);
|
||||
|
||||
/// Return a location representing the source of a memory transfer.
|
||||
static MemoryLocation getForSource(const MemTransferInst *MTI);
|
||||
|
@ -83,6 +83,23 @@ MemoryLocation MemoryLocation::get(const AtomicRMWInst *RMWI) {
|
||||
AATags);
|
||||
}
|
||||
|
||||
Optional<MemoryLocation> MemoryLocation::getOrNone(const Instruction *Inst) {
|
||||
switch (Inst->getOpcode()) {
|
||||
case Instruction::Load:
|
||||
return get(cast<LoadInst>(Inst));
|
||||
case Instruction::Store:
|
||||
return get(cast<StoreInst>(Inst));
|
||||
case Instruction::VAArg:
|
||||
return get(cast<VAArgInst>(Inst));
|
||||
case Instruction::AtomicCmpXchg:
|
||||
return get(cast<AtomicCmpXchgInst>(Inst));
|
||||
case Instruction::AtomicRMW:
|
||||
return get(cast<AtomicRMWInst>(Inst));
|
||||
default:
|
||||
return None;
|
||||
}
|
||||
}
|
||||
|
||||
MemoryLocation MemoryLocation::getForSource(const MemTransferInst *MTI) {
|
||||
return getForSource(cast<AnyMemTransferInst>(MTI));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user