Inline some methods from .cpp files into .h files, minor cleanups

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4313 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2002-10-28 01:21:55 +00:00
parent 6b9445389a
commit 51a8d85281
6 changed files with 41 additions and 51 deletions

View File

@ -1,8 +1,8 @@
//===-- llvm/CodeGen/MachineBasicBlock.h ------------------------*- C++ -*--=// //===-- llvm/CodeGen/MachineBasicBlock.h ------------------------*- C++ -*-===//
// //
// Collect the sequence of machine instructions for a basic block. // Collect the sequence of machine instructions for a basic block.
// //
//===---------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#ifndef LLVM_CODEGEN_MACHINEBASICBLOCK_H #ifndef LLVM_CODEGEN_MACHINEBASICBLOCK_H
#define LLVM_CODEGEN_MACHINEBASICBLOCK_H #define LLVM_CODEGEN_MACHINEBASICBLOCK_H
@ -19,7 +19,7 @@ typedef MachineBasicBlock MachineCodeForBasicBlock;
class MachineBasicBlock: public Annotation { class MachineBasicBlock: public Annotation {
std::vector<MachineInstr*> Insts; std::vector<MachineInstr*> Insts;
public: public:
MachineBasicBlock(); MachineBasicBlock() : Annotation(MCFBB_AID) {}
~MachineBasicBlock() {} ~MachineBasicBlock() {}
// Static methods to retrieve or destroy the MachineBasicBlock // Static methods to retrieve or destroy the MachineBasicBlock

View File

@ -1,8 +1,8 @@
//===-- llvm/CodeGen/MachineBasicBlock.h ------------------------*- C++ -*--=// //===-- llvm/CodeGen/MachineBasicBlock.h ------------------------*- C++ -*-===//
// //
// Collect the sequence of machine instructions for a basic block. // Collect the sequence of machine instructions for a basic block.
// //
//===---------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#ifndef LLVM_CODEGEN_MACHINEBASICBLOCK_H #ifndef LLVM_CODEGEN_MACHINEBASICBLOCK_H
#define LLVM_CODEGEN_MACHINEBASICBLOCK_H #define LLVM_CODEGEN_MACHINEBASICBLOCK_H
@ -19,7 +19,7 @@ typedef MachineBasicBlock MachineCodeForBasicBlock;
class MachineBasicBlock: public Annotation { class MachineBasicBlock: public Annotation {
std::vector<MachineInstr*> Insts; std::vector<MachineInstr*> Insts;
public: public:
MachineBasicBlock(); MachineBasicBlock() : Annotation(MCFBB_AID) {}
~MachineBasicBlock() {} ~MachineBasicBlock() {}
// Static methods to retrieve or destroy the MachineBasicBlock // Static methods to retrieve or destroy the MachineBasicBlock

View File

@ -24,15 +24,22 @@ class MachineInstr;
class Instruction; class Instruction;
class Value; class Value;
extern AnnotationID MCFI_AID;
class MachineCodeForInstruction : public Annotation { class MachineCodeForInstruction : public Annotation {
std::vector<Value*> tempVec; // used by m/c instr but not VM instr std::vector<Value*> tempVec; // used by m/c instr but not VM instr
std::vector<MachineInstr*> Contents; std::vector<MachineInstr*> Contents;
public: public:
MachineCodeForInstruction(); MachineCodeForInstruction() : Annotation(MCFI_AID) {}
~MachineCodeForInstruction(); ~MachineCodeForInstruction();
static MachineCodeForInstruction &get(const Instruction *I); static MachineCodeForInstruction &get(const Instruction *I) {
static void destroy(const Instruction *I); assert(I != NULL);
return *(MachineCodeForInstruction*)I->getOrCreateAnnotation(MCFI_AID);
}
static void destroy(const Instruction *I) {
I->deleteAnnotation(MCFI_AID);
}
// Access to underlying machine instructions... // Access to underlying machine instructions...
typedef std::vector<MachineInstr*>::iterator iterator; typedef std::vector<MachineInstr*>::iterator iterator;

View File

@ -1,8 +1,8 @@
//===-- llvm/CodeGen/MachineCodeForBasicBlock.cpp ---------------*- C++ -*--=// //===-- MachineCodeForBasicBlock.cpp --------------------------------------===//
// //
// Purpose:
// Collect the sequence of machine instructions for a basic block. // Collect the sequence of machine instructions for a basic block.
//===---------------------------------------------------------------------===// //
//===----------------------------------------------------------------------===//
#include "llvm/CodeGen/MachineCodeForBasicBlock.h" #include "llvm/CodeGen/MachineCodeForBasicBlock.h"
@ -21,8 +21,3 @@ static struct MCFBBInitializer {
} }
} RegisterCreateMCFBB; } RegisterCreateMCFBB;
MachineBasicBlock::MachineBasicBlock()
: Annotation(MCFBB_AID)
{}

View File

@ -1,18 +1,17 @@
//===-- MachineCodeForInstruction.cpp -------------------------------------===// //===-- MachineCodeForInstruction.cpp -------------------------------------===//
// //
// Representation of the sequence of machine instructions created // Representation of the sequence of machine instructions created for a single
// for a single VM instruction. Additionally records information // VM instruction. Additionally records information about hidden and implicit
// about hidden and implicit values used by the machine instructions: // values used by the machine instructions: about hidden values used by the
// about hidden values used by the machine instructions: // machine instructions:
// //
// "Temporary values" are intermediate values used in the machine // "Temporary values" are intermediate values used in the machine instruction
// instruction sequence, but not in the VM instruction // sequence, but not in the VM instruction Note that such values should be
// Note that such values should be treated as pure SSA values with // treated as pure SSA values with no interpretation of their operands (i.e., as
// no interpretation of their operands (i.e., as a TmpInstruction // a TmpInstruction object which actually represents such a value).
// object which actually represents such a value).
// //
// (2) "Implicit uses" are values used in the VM instruction but not in // (2) "Implicit uses" are values used in the VM instruction but not in the
// the machine instruction sequence // machine instruction sequence
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
@ -20,7 +19,7 @@
#include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/InstrSelection.h" #include "llvm/CodeGen/InstrSelection.h"
static AnnotationID MCFI_AID( AnnotationID MCFI_AID(
AnnotationManager::getID("CodeGen::MachineCodeForInstruction")); AnnotationManager::getID("CodeGen::MachineCodeForInstruction"));
static Annotation *CreateMCFI(AnnotationID AID, const Annotable *, void *) { static Annotation *CreateMCFI(AnnotationID AID, const Annotable *, void *) {
@ -36,19 +35,6 @@ static struct MCFIInitializer {
} RegisterCreateMCFI; } RegisterCreateMCFI;
MachineCodeForInstruction&
MachineCodeForInstruction::get(const Instruction *I){
assert(I != NULL);
return *(MachineCodeForInstruction*)I->getOrCreateAnnotation(MCFI_AID);
}
void
MachineCodeForInstruction::destroy(const Instruction *I) {
I->deleteAnnotation(MCFI_AID);
}
void void
MachineCodeForInstruction::dropAllReferences() MachineCodeForInstruction::dropAllReferences()
{ {
@ -57,11 +43,6 @@ MachineCodeForInstruction::dropAllReferences()
} }
MachineCodeForInstruction::MachineCodeForInstruction()
: Annotation(MCFI_AID)
{}
MachineCodeForInstruction::~MachineCodeForInstruction() MachineCodeForInstruction::~MachineCodeForInstruction()
{ {
// Let go of all uses in temp. instructions // Let go of all uses in temp. instructions

View File

@ -24,15 +24,22 @@ class MachineInstr;
class Instruction; class Instruction;
class Value; class Value;
extern AnnotationID MCFI_AID;
class MachineCodeForInstruction : public Annotation { class MachineCodeForInstruction : public Annotation {
std::vector<Value*> tempVec; // used by m/c instr but not VM instr std::vector<Value*> tempVec; // used by m/c instr but not VM instr
std::vector<MachineInstr*> Contents; std::vector<MachineInstr*> Contents;
public: public:
MachineCodeForInstruction(); MachineCodeForInstruction() : Annotation(MCFI_AID) {}
~MachineCodeForInstruction(); ~MachineCodeForInstruction();
static MachineCodeForInstruction &get(const Instruction *I); static MachineCodeForInstruction &get(const Instruction *I) {
static void destroy(const Instruction *I); assert(I != NULL);
return *(MachineCodeForInstruction*)I->getOrCreateAnnotation(MCFI_AID);
}
static void destroy(const Instruction *I) {
I->deleteAnnotation(MCFI_AID);
}
// Access to underlying machine instructions... // Access to underlying machine instructions...
typedef std::vector<MachineInstr*>::iterator iterator; typedef std::vector<MachineInstr*>::iterator iterator;