diff options
| author | Chris Lattner <sabre@nondot.org> | 2006-01-25 18:57:27 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2006-01-25 18:57:27 +0000 |
| commit | 8bbcda2fdace0a261f82b3bac2e5c82db6e29343 (patch) | |
| tree | 062b29c86f6d6516525569f0e267560fba85588c /llvm/lib | |
| parent | d07c86465d06e4a7119729cc3a69e2089b58f20b (diff) | |
| download | bcm5719-llvm-8bbcda2fdace0a261f82b3bac2e5c82db6e29343.tar.gz bcm5719-llvm-8bbcda2fdace0a261f82b3bac2e5c82db6e29343.zip | |
Change inline asms to be uniqued like constants, not embedded in a Module.
llvm-svn: 25610
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/VMCore/AsmWriter.cpp | 4 | ||||
| -rw-r--r-- | llvm/lib/VMCore/InlineAsm.cpp | 28 | ||||
| -rw-r--r-- | llvm/lib/VMCore/Module.cpp | 17 |
3 files changed, 6 insertions, 43 deletions
diff --git a/llvm/lib/VMCore/AsmWriter.cpp b/llvm/lib/VMCore/AsmWriter.cpp index c6a3845a07f..a5ac8f03311 100644 --- a/llvm/lib/VMCore/AsmWriter.cpp +++ b/llvm/lib/VMCore/AsmWriter.cpp @@ -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 Function::print(std::ostream &o, AssemblyAnnotationWriter *AAW) const { } 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); } diff --git a/llvm/lib/VMCore/InlineAsm.cpp b/llvm/lib/VMCore/InlineAsm.cpp index 1eed8941bea..00842bb3244 100644 --- a/llvm/lib/VMCore/InlineAsm.cpp +++ b/llvm/lib/VMCore/InlineAsm.cpp @@ -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); -} diff --git a/llvm/lib/VMCore/Module.cpp b/llvm/lib/VMCore/Module.cpp index e9b28f9faf5..b6761a616cd 100644 --- a/llvm/lib/VMCore/Module.cpp +++ b/llvm/lib/VMCore/Module.cpp @@ -44,30 +44,17 @@ GlobalVariable *ilist_traits<GlobalVariable>::createSentinel() { 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 @@ Module::Module(const std::string &MID) FunctionList.setParent(this); GlobalList.setItemParent(this); GlobalList.setParent(this); - InlineAsmList.setItemParent(this); - InlineAsmList.setParent(this); SymTab = new SymbolTable(); } @@ -90,8 +75,6 @@ Module::~Module() { GlobalList.setParent(0); FunctionList.clear(); FunctionList.setParent(0); - InlineAsmList.clear(); - InlineAsmList.setParent(0); LibraryList.clear(); delete SymTab; } |

