mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-23 04:28:30 +00:00
Do not find these ugly sparc-specific objects by using the annotation API on
instructions. Instead, keep a map of instructions -> MCFI objects in the already sparc-specific class MachineFunctionInfo. This will slow down the sparc backend a bit, but it does not penalize the rest of LLVM! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14438 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ea104df2b1
commit
4e7244e68e
@ -23,36 +23,22 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/CodeGen/MachineCodeForInstruction.h"
|
||||
#include "llvm/Function.h"
|
||||
#include "llvm/CodeGen/MachineInstr.h"
|
||||
#include "llvm/CodeGen/MachineFunction.h"
|
||||
#include "llvm/CodeGen/MachineFunctionInfo.h"
|
||||
#include "../Target/SparcV9/MachineInstrAnnot.h"
|
||||
#include "llvm/Instruction.h"
|
||||
using namespace llvm;
|
||||
|
||||
MachineCodeForInstruction &MachineCodeForInstruction::get(const Instruction *I){
|
||||
return *(MachineCodeForInstruction*)I->getOrCreateAnnotation(MCFI_AID);
|
||||
MachineFunction &MF = MachineFunction::get(I->getParent()->getParent());
|
||||
return MF.getInfo()->MCFIEntries[I];
|
||||
}
|
||||
void MachineCodeForInstruction::destroy(const Instruction *I) {
|
||||
I->deleteAnnotation(MCFI_AID);
|
||||
MachineFunction &MF = MachineFunction::get(I->getParent()->getParent());
|
||||
MF.getInfo()->MCFIEntries.erase(I);
|
||||
}
|
||||
|
||||
|
||||
|
||||
AnnotationID llvm::MCFI_AID(
|
||||
AnnotationManager::getID("CodeGen::MachineCodeForInstruction"));
|
||||
|
||||
static Annotation *CreateMCFI(AnnotationID AID, const Annotable *, void *) {
|
||||
assert(AID == MCFI_AID);
|
||||
return new MachineCodeForInstruction(); // Invoke constructor!
|
||||
}
|
||||
|
||||
// Register the annotation with the annotation factory
|
||||
static struct MCFIInitializer {
|
||||
MCFIInitializer() {
|
||||
AnnotationManager::registerAnnotationFactory(MCFI_AID, &CreateMCFI);
|
||||
}
|
||||
} RegisterCreateMCFI;
|
||||
|
||||
|
||||
void
|
||||
MachineCodeForInstruction::dropAllReferences()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user