summaryrefslogtreecommitdiff
path: root/lib/VMCore/InlineAsm.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-01-24 04:13:11 +0000
committerChris Lattner <sabre@nondot.org>2006-01-24 04:13:11 +0000
commitcc041ba03aed685400197fb938b7a583713d25af (patch)
tree002b884baab37ed1918904254b86eb9f3d39a50f /lib/VMCore/InlineAsm.cpp
parent52060a0e7190d7713042f18b1b949d1ae953638f (diff)
downloadllvm-cc041ba03aed685400197fb938b7a583713d25af.tar.gz
llvm-cc041ba03aed685400197fb938b7a583713d25af.tar.bz2
llvm-cc041ba03aed685400197fb938b7a583713d25af.tar.xz
Initial checkin of the InlineAsm class
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25570 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/InlineAsm.cpp')
-rw-r--r--lib/VMCore/InlineAsm.cpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/lib/VMCore/InlineAsm.cpp b/lib/VMCore/InlineAsm.cpp
new file mode 100644
index 0000000000..1eed8941be
--- /dev/null
+++ b/lib/VMCore/InlineAsm.cpp
@@ -0,0 +1,50 @@
+//===-- InlineAsm.cpp - Implement the InlineAsm class ---------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file was developed by Chris Lattner and is distributed under the
+// University of Illinois Open Source License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file implements the InlineAsm class.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/InlineAsm.h"
+#include "llvm/DerivedTypes.h"
+#include "llvm/Module.h"
+#include "llvm/Support/LeakDetector.h"
+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) {
+ LeakDetector::addGarbageObject(this);
+
+ if (ParentModule)
+ ParentModule->getInlineAsmList().push_back(this);
+}
+
+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);
+}