[llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp InlineAsm.cpp Module.cpp

Chris Lattner lattner at cs.uiuc.edu
Wed Jan 25 10:57:39 PST 2006



Changes in directory llvm/lib/VMCore:

AsmWriter.cpp updated: 1.189 -> 1.190
InlineAsm.cpp updated: 1.1 -> 1.2
Module.cpp updated: 1.63 -> 1.64
---
Log message:

Change inline asms to be uniqued like constants, not embedded in a Module.



---
Diffs of the changes:  (+6 -43)

 AsmWriter.cpp |    4 +---
 InlineAsm.cpp |   28 +++++-----------------------
 Module.cpp    |   17 -----------------
 3 files changed, 6 insertions(+), 43 deletions(-)


Index: llvm/lib/VMCore/AsmWriter.cpp
diff -u llvm/lib/VMCore/AsmWriter.cpp:1.189 llvm/lib/VMCore/AsmWriter.cpp:1.190
--- llvm/lib/VMCore/AsmWriter.cpp:1.189	Mon Jan 23 22:13:11 2006
+++ llvm/lib/VMCore/AsmWriter.cpp	Wed Jan 25 12:57:27 2006
@@ -21,6 +21,7 @@
 #include "llvm/CallingConv.h"
 #include "llvm/Constants.h"
 #include "llvm/DerivedTypes.h"
+#include "llvm/InlineAsm.h"
 #include "llvm/Instruction.h"
 #include "llvm/Instructions.h"
 #include "llvm/Module.h"
@@ -1270,9 +1271,6 @@
 }
 
 void InlineAsm::print(std::ostream &o, AssemblyAnnotationWriter *AAW) const {
-  SlotMachine SlotTable(getParent());
-  AssemblyWriter W(o, SlotTable, getParent(), AAW);
-  
   assert(0 && "Inline asm printing unimplemented!");
   //W.write(this);
 }


Index: llvm/lib/VMCore/InlineAsm.cpp
diff -u llvm/lib/VMCore/InlineAsm.cpp:1.1 llvm/lib/VMCore/InlineAsm.cpp:1.2
--- llvm/lib/VMCore/InlineAsm.cpp:1.1	Mon Jan 23 22:13:11 2006
+++ llvm/lib/VMCore/InlineAsm.cpp	Wed Jan 25 12:57:27 2006
@@ -18,33 +18,15 @@
 using namespace llvm;
 
 InlineAsm::InlineAsm(const FunctionType *Ty, const std::string &asmString,
-                     const std::string &constraints, bool hasSideEffects,
-                     const std::string &name, Module *ParentModule)
-  : Value(PointerType::get(Ty), Value::InlineAsmVal, name), 
-    Parent(0), AsmString(asmString), Constraints(constraints), 
-    AsmHasSideEffects(hasSideEffects) {
+                     const std::string &constraints, bool hasSideEffects)
+  : Value(PointerType::get(Ty), Value::InlineAsmVal), AsmString(asmString), 
+    Constraints(constraints), HasSideEffects(hasSideEffects) {
   LeakDetector::addGarbageObject(this);
 
-  if (ParentModule)
-    ParentModule->getInlineAsmList().push_back(this);
+  // FIXME: do various checks on the constraint string and type.
+      
 }
 
 const FunctionType *InlineAsm::getFunctionType() const {
   return cast<FunctionType>(getType()->getElementType());
 }
-
-void InlineAsm::setParent(Module *parent) {
-  if (getParent())
-    LeakDetector::addGarbageObject(this);
-  Parent = parent;
-  if (getParent())
-    LeakDetector::removeGarbageObject(this);
-}
-
-void InlineAsm::removeFromParent() {
-  getParent()->getInlineAsmList().remove(this);
-}
-
-void InlineAsm::eraseFromParent() {
-  getParent()->getInlineAsmList().erase(this);
-}


Index: llvm/lib/VMCore/Module.cpp
diff -u llvm/lib/VMCore/Module.cpp:1.63 llvm/lib/VMCore/Module.cpp:1.64
--- llvm/lib/VMCore/Module.cpp:1.63	Mon Jan 23 22:13:11 2006
+++ llvm/lib/VMCore/Module.cpp	Wed Jan 25 12:57:27 2006
@@ -44,30 +44,17 @@
   return Ret;
 }
 
-InlineAsm *ilist_traits<InlineAsm>::createSentinel() {
-  InlineAsm *Ret = new InlineAsm(FunctionType::get(Type::VoidTy, 
-                                    std::vector<const Type*>(), false), "", "",
-                                 false);
-  // This should not be garbage monitored.
-  LeakDetector::removeGarbageObject(Ret);
-  return Ret;
-}
-
 iplist<Function> &ilist_traits<Function>::getList(Module *M) {
   return M->getFunctionList();
 }
 iplist<GlobalVariable> &ilist_traits<GlobalVariable>::getList(Module *M) {
   return M->getGlobalList();
 }
-iplist<InlineAsm> &ilist_traits<InlineAsm>::getList(Module *M) {
-  return M->getInlineAsmList();
-}
 
 // Explicit instantiations of SymbolTableListTraits since some of the methods
 // are not in the public header file.
 template class SymbolTableListTraits<GlobalVariable, Module, Module>;
 template class SymbolTableListTraits<Function, Module, Module>;
-template class SymbolTableListTraits<InlineAsm, Module, Module>;
 
 //===----------------------------------------------------------------------===//
 // Primitive Module methods.
@@ -79,8 +66,6 @@
   FunctionList.setParent(this);
   GlobalList.setItemParent(this);
   GlobalList.setParent(this);
-  InlineAsmList.setItemParent(this);
-  InlineAsmList.setParent(this);
   SymTab = new SymbolTable();
 }
 
@@ -90,8 +75,6 @@
   GlobalList.setParent(0);
   FunctionList.clear();
   FunctionList.setParent(0);
-  InlineAsmList.clear();
-  InlineAsmList.setParent(0);
   LibraryList.clear();
   delete SymTab;
 }






More information about the llvm-commits mailing list