1 //===-- llvm/InlineAsm.h - Class to represent inline asm strings-*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by Chris Lattner and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This class represents the inline asm strings, which are Value*'s that are
11 // used as the callee operand of call instructions.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_INLINEASM_H
16 #define LLVM_INLINEASM_H
18 #include "llvm/Value.h"
22 class AssemblyAnnotationWriter;
26 template<typename SC> struct ilist_traits;
27 template<typename ValueSubClass, typename ItemParentClass, typename SymTabClass,
28 typename SubClass> class SymbolTableListTraits;
30 class InlineAsm : public Value {
31 friend class SymbolTableListTraits<InlineAsm, Module, Module,
32 ilist_traits<InlineAsm> >;
33 InlineAsm(const InlineAsm &); // do not implement
34 void operator=(const InlineAsm&); // do not implement
36 void setParent(Module *Parent);
37 InlineAsm *Prev, *Next;
38 void setNext(InlineAsm *N) { Next = N; }
39 void setPrev(InlineAsm *N) { Prev = N; }
40 InlineAsm *getNext() { return Next; }
41 const InlineAsm *getNext() const { return Next; }
42 InlineAsm *getPrev() { return Prev; }
43 const InlineAsm *getPrev() const { return Prev; }
46 std::string AsmString, Constraints;
47 bool AsmHasSideEffects;
49 InlineAsm(const FunctionType *Ty, const std::string &AsmString,
50 const std::string &Constraints, bool hasSideEffects,
51 const std::string &Name = "", Module *ParentModule = 0);
53 bool getHasSideEffects() const { return AsmHasSideEffects; }
54 void setSideEffects(bool X) { AsmHasSideEffects = X; }
56 /// getType - InlineAsm's are always pointers.
58 const PointerType *getType() const {
59 return reinterpret_cast<const PointerType*>(Value::getType());
62 /// getFunctionType - InlineAsm's are always pointers to functions.
64 const FunctionType *getFunctionType() const;
66 /// getParent - Get the module that this global value is contained inside
68 Module *getParent() { return Parent; }
69 const Module *getParent() const { return Parent; }
72 /// removeFromParent/eraseFromParent - Unlink and unlink/delete this object
73 /// from the module it is embedded into.
74 void removeFromParent();
75 void eraseFromParent();
77 virtual void print(std::ostream &O) const { print(O, 0); }
78 void print(std::ostream &OS, AssemblyAnnotationWriter *AAW) const;
80 // Methods for support type inquiry through isa, cast, and dyn_cast:
81 static inline bool classof(const InlineAsm *) { return true; }
82 static inline bool classof(const Value *V) {
83 return V->getValueType() == Value::InlineAsmVal;
87 } // End llvm namespace