From 51a8d8528135ba4e3e4cf7cd711a9e47b19078a3 Mon Sep 17 00:00:00 2001
From: Chris Lattner <sabre@nondot.org>
Date: Mon, 28 Oct 2002 01:21:55 +0000
Subject: [PATCH] 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
---
 include/llvm/CodeGen/MachineBasicBlock.h      |  6 +--
 .../llvm/CodeGen/MachineCodeForBasicBlock.h   |  6 +--
 .../llvm/CodeGen/MachineCodeForInstruction.h  | 13 ++++--
 lib/CodeGen/MachineBasicBlock.cpp             | 13 ++----
 lib/CodeGen/MachineCodeForInstruction.cpp     | 41 +++++--------------
 .../SparcV9/MachineCodeForInstruction.h       | 13 ++++--
 6 files changed, 41 insertions(+), 51 deletions(-)

diff --git a/include/llvm/CodeGen/MachineBasicBlock.h b/include/llvm/CodeGen/MachineBasicBlock.h
index 1a3c7a00f64..62454de3fd4 100644
--- a/include/llvm/CodeGen/MachineBasicBlock.h
+++ b/include/llvm/CodeGen/MachineBasicBlock.h
@@ -1,8 +1,8 @@
-//===-- llvm/CodeGen/MachineBasicBlock.h ------------------------*- C++ -*--=//
+//===-- llvm/CodeGen/MachineBasicBlock.h ------------------------*- C++ -*-===//
 // 
 // Collect the sequence of machine instructions for a basic block.
 //
-//===---------------------------------------------------------------------===//
+//===----------------------------------------------------------------------===//
 
 #ifndef LLVM_CODEGEN_MACHINEBASICBLOCK_H
 #define LLVM_CODEGEN_MACHINEBASICBLOCK_H
@@ -19,7 +19,7 @@ typedef MachineBasicBlock MachineCodeForBasicBlock;
 class MachineBasicBlock: public Annotation {
   std::vector<MachineInstr*> Insts;
 public:
-  MachineBasicBlock();
+  MachineBasicBlock() : Annotation(MCFBB_AID) {}
   ~MachineBasicBlock() {}
   
   // Static methods to retrieve or destroy the MachineBasicBlock
diff --git a/include/llvm/CodeGen/MachineCodeForBasicBlock.h b/include/llvm/CodeGen/MachineCodeForBasicBlock.h
index 1a3c7a00f64..62454de3fd4 100644
--- a/include/llvm/CodeGen/MachineCodeForBasicBlock.h
+++ b/include/llvm/CodeGen/MachineCodeForBasicBlock.h
@@ -1,8 +1,8 @@
-//===-- llvm/CodeGen/MachineBasicBlock.h ------------------------*- C++ -*--=//
+//===-- llvm/CodeGen/MachineBasicBlock.h ------------------------*- C++ -*-===//
 // 
 // Collect the sequence of machine instructions for a basic block.
 //
-//===---------------------------------------------------------------------===//
+//===----------------------------------------------------------------------===//
 
 #ifndef LLVM_CODEGEN_MACHINEBASICBLOCK_H
 #define LLVM_CODEGEN_MACHINEBASICBLOCK_H
@@ -19,7 +19,7 @@ typedef MachineBasicBlock MachineCodeForBasicBlock;
 class MachineBasicBlock: public Annotation {
   std::vector<MachineInstr*> Insts;
 public:
-  MachineBasicBlock();
+  MachineBasicBlock() : Annotation(MCFBB_AID) {}
   ~MachineBasicBlock() {}
   
   // Static methods to retrieve or destroy the MachineBasicBlock
diff --git a/include/llvm/CodeGen/MachineCodeForInstruction.h b/include/llvm/CodeGen/MachineCodeForInstruction.h
index 050a626c2ba..aa6ddd55ca1 100644
--- a/include/llvm/CodeGen/MachineCodeForInstruction.h
+++ b/include/llvm/CodeGen/MachineCodeForInstruction.h
@@ -24,15 +24,22 @@ class MachineInstr;
 class Instruction;
 class Value;
 
+extern AnnotationID MCFI_AID;
+
 class MachineCodeForInstruction : public Annotation {
   std::vector<Value*> tempVec;         // used by m/c instr but not VM instr
   std::vector<MachineInstr*> Contents;
 public:
-  MachineCodeForInstruction();
+  MachineCodeForInstruction() : Annotation(MCFI_AID) {}
   ~MachineCodeForInstruction();
   
-  static MachineCodeForInstruction &get(const Instruction *I);
-  static void destroy(const Instruction *I);
+  static MachineCodeForInstruction &get(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...
   typedef std::vector<MachineInstr*>::iterator iterator;
diff --git a/lib/CodeGen/MachineBasicBlock.cpp b/lib/CodeGen/MachineBasicBlock.cpp
index 92dc79b598b..1b78d7a90b1 100644
--- a/lib/CodeGen/MachineBasicBlock.cpp
+++ b/lib/CodeGen/MachineBasicBlock.cpp
@@ -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"
 
@@ -21,8 +21,3 @@ static struct MCFBBInitializer {
   }
 } RegisterCreateMCFBB;
 
-
-MachineBasicBlock::MachineBasicBlock()
-  : Annotation(MCFBB_AID)
-{}
-
diff --git a/lib/CodeGen/MachineCodeForInstruction.cpp b/lib/CodeGen/MachineCodeForInstruction.cpp
index 61563992241..f3080628ee8 100644
--- a/lib/CodeGen/MachineCodeForInstruction.cpp
+++ b/lib/CodeGen/MachineCodeForInstruction.cpp
@@ -1,18 +1,17 @@
 //===-- MachineCodeForInstruction.cpp -------------------------------------===//
 //
-//   Representation of the sequence of machine instructions created
-//   for a single VM instruction.  Additionally records information
-//   about hidden and implicit values used by the machine instructions:
-//   about hidden values used by the machine instructions:
+// Representation of the sequence of machine instructions created for a single
+// VM instruction.  Additionally records information about hidden and implicit
+// values used by the machine instructions: about hidden values used by the
+// machine instructions:
 // 
-//   "Temporary values" are intermediate values used in the machine
-//   instruction sequence, but not in the VM instruction
-//   Note that such values should be treated as pure SSA values with
-//   no interpretation of their operands (i.e., as a TmpInstruction
-//   object which actually represents such a value).
+// "Temporary values" are intermediate values used in the machine instruction
+// sequence, but not in the VM instruction Note that such values should be
+// treated as pure SSA values with no interpretation of their operands (i.e., as
+// a TmpInstruction object which actually represents such a value).
 // 
-//   (2) "Implicit uses" are values used in the VM instruction but not in
-//       the machine instruction sequence
+// (2) "Implicit uses" are values used in the VM instruction but not in the
+//     machine instruction sequence
 // 
 //===----------------------------------------------------------------------===//
 
@@ -20,7 +19,7 @@
 #include "llvm/CodeGen/MachineInstr.h"
 #include "llvm/CodeGen/InstrSelection.h"
 
-static AnnotationID MCFI_AID(
+AnnotationID MCFI_AID(
              AnnotationManager::getID("CodeGen::MachineCodeForInstruction"));
 
 static Annotation *CreateMCFI(AnnotationID AID, const Annotable *, void *) {
@@ -36,19 +35,6 @@ static struct MCFIInitializer {
 } 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
 MachineCodeForInstruction::dropAllReferences()
 {
@@ -57,11 +43,6 @@ MachineCodeForInstruction::dropAllReferences()
 }
 
 
-MachineCodeForInstruction::MachineCodeForInstruction()
-  : Annotation(MCFI_AID)
-{}
-
-
 MachineCodeForInstruction::~MachineCodeForInstruction()
 {
   // Let go of all uses in temp. instructions
diff --git a/lib/Target/SparcV9/MachineCodeForInstruction.h b/lib/Target/SparcV9/MachineCodeForInstruction.h
index 050a626c2ba..aa6ddd55ca1 100644
--- a/lib/Target/SparcV9/MachineCodeForInstruction.h
+++ b/lib/Target/SparcV9/MachineCodeForInstruction.h
@@ -24,15 +24,22 @@ class MachineInstr;
 class Instruction;
 class Value;
 
+extern AnnotationID MCFI_AID;
+
 class MachineCodeForInstruction : public Annotation {
   std::vector<Value*> tempVec;         // used by m/c instr but not VM instr
   std::vector<MachineInstr*> Contents;
 public:
-  MachineCodeForInstruction();
+  MachineCodeForInstruction() : Annotation(MCFI_AID) {}
   ~MachineCodeForInstruction();
   
-  static MachineCodeForInstruction &get(const Instruction *I);
-  static void destroy(const Instruction *I);
+  static MachineCodeForInstruction &get(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...
   typedef std::vector<MachineInstr*>::iterator iterator;