summaryrefslogtreecommitdiff
path: root/include/llvm/InlineAsm.h
diff options
context:
space:
mode:
authorJeffrey Yasskin <jyasskin@google.com>2010-03-21 20:37:19 +0000
committerJeffrey Yasskin <jyasskin@google.com>2010-03-21 20:37:19 +0000
commitbf48a9b6db111fc14a8faef1adefbce5d807aaef (patch)
tree1dd8371e8fa93db5d125acee5b8cef59b1118c70 /include/llvm/InlineAsm.h
parentf65b0e9b455da8ab2936c9a6d4ead5c92716e13a (diff)
downloadllvm-bf48a9b6db111fc14a8faef1adefbce5d807aaef.tar.gz
llvm-bf48a9b6db111fc14a8faef1adefbce5d807aaef.tar.bz2
llvm-bf48a9b6db111fc14a8faef1adefbce5d807aaef.tar.xz
Memoize InlineAsms into the LLVMContext and delete them on shutdown.
Fixes PR803. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99143 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/InlineAsm.h')
-rw-r--r--include/llvm/InlineAsm.h19
1 files changed, 16 insertions, 3 deletions
diff --git a/include/llvm/InlineAsm.h b/include/llvm/InlineAsm.h
index 4490ce5a54..2ac0fcab79 100644
--- a/include/llvm/InlineAsm.h
+++ b/include/llvm/InlineAsm.h
@@ -24,8 +24,17 @@ namespace llvm {
class PointerType;
class FunctionType;
class Module;
+struct InlineAsmKeyType;
+template<class ValType, class TypeClass, class ConstantClass, bool HasLargeKey>
+class ConstantUniqueMap;
+template<class ConstantClass, class TypeClass, class ValType>
+struct ConstantCreator;
class InlineAsm : public Value {
+ friend struct ConstantCreator<InlineAsm, PointerType, InlineAsmKeyType>;
+ friend class ConstantUniqueMap<InlineAsmKeyType, PointerType, InlineAsm,
+ false>;
+
InlineAsm(const InlineAsm &); // do not implement
void operator=(const InlineAsm&); // do not implement
@@ -33,10 +42,14 @@ class InlineAsm : public Value {
bool HasSideEffects;
bool IsAlignStack;
- InlineAsm(const FunctionType *Ty, StringRef AsmString,
- StringRef Constraints, bool hasSideEffects,
- bool isAlignStack = false);
+ InlineAsm(const PointerType *Ty, const std::string &AsmString,
+ const std::string &Constraints, bool hasSideEffects,
+ bool isAlignStack);
virtual ~InlineAsm();
+
+ /// When the ConstantUniqueMap merges two types and makes two InlineAsms
+ /// identical, it destroys one of them with this method.
+ void destroyConstant();
public:
/// InlineAsm::get - Return the specified uniqued inline asm string.