summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineCodeForInstruction.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-06-27 18:52:17 +0000
committerChris Lattner <sabre@nondot.org>2004-06-27 18:52:17 +0000
commitd22d9cb8009112ffba7cc28a6d4e7191c2eaa5c4 (patch)
tree56bd815082b5362c6d9b60c848c2943929f13f52 /llvm/lib/CodeGen/MachineCodeForInstruction.cpp
parent2b04d102f0daa950207197b56d65f0bf8130b1da (diff)
downloadbcm5719-llvm-d22d9cb8009112ffba7cc28a6d4e7191c2eaa5c4.tar.gz
bcm5719-llvm-d22d9cb8009112ffba7cc28a6d4e7191c2eaa5c4.zip
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! llvm-svn: 14438
Diffstat (limited to 'llvm/lib/CodeGen/MachineCodeForInstruction.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineCodeForInstruction.cpp28
1 files changed, 7 insertions, 21 deletions
diff --git a/llvm/lib/CodeGen/MachineCodeForInstruction.cpp b/llvm/lib/CodeGen/MachineCodeForInstruction.cpp
index d6094cef409..c50c8b8c6ae 100644
--- a/llvm/lib/CodeGen/MachineCodeForInstruction.cpp
+++ b/llvm/lib/CodeGen/MachineCodeForInstruction.cpp
@@ -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()
{
OpenPOWER on IntegriCloud