Be consistent in using class/struct to keep Visual Studio happy.
[oota-llvm.git] / include / llvm / InlineAsm.h
1 //===-- llvm/InlineAsm.h - Class to represent inline asm strings-*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
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.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This class represents the inline asm strings, which are Value*'s that are
11 // used as the callee operand of call instructions.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef LLVM_INLINEASM_H
16 #define LLVM_INLINEASM_H
17
18 #include "llvm/Value.h"
19
20 namespace llvm {
21
22 struct AssemblyAnnotationWriter;
23 class PointerType;
24 class FunctionType;
25 class Module;
26 template<typename SC> struct ilist_traits;
27 template<typename ValueSubClass, typename ItemParentClass, typename SymTabClass,
28          typename SubClass> class SymbolTableListTraits;
29
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
35
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; }
44   
45   Module *Parent;
46   std::string AsmString, Constraints;
47   bool AsmHasSideEffects;
48 public:
49   InlineAsm(const FunctionType *Ty, const std::string &AsmString,
50             const std::string &Constraints, bool hasSideEffects,
51             const std::string &Name = "", Module *ParentModule = 0);
52   
53   bool getHasSideEffects() const { return AsmHasSideEffects; }
54   void setSideEffects(bool X) { AsmHasSideEffects = X; }
55   
56   /// getType - InlineAsm's are always pointers.
57   ///
58   const PointerType *getType() const {
59     return reinterpret_cast<const PointerType*>(Value::getType());
60   }
61   
62   /// getFunctionType - InlineAsm's are always pointers to functions.
63   ///
64   const FunctionType *getFunctionType() const;
65
66   /// getParent - Get the module that this global value is contained inside
67   /// of...
68   Module *getParent() { return Parent; }
69   const Module *getParent() const { return Parent; }
70
71   
72   /// removeFromParent/eraseFromParent - Unlink and unlink/delete this object
73   /// from the module it is embedded into.
74   void removeFromParent();
75   void eraseFromParent();
76   
77   virtual void print(std::ostream &O) const { print(O, 0); }
78   void print(std::ostream &OS, AssemblyAnnotationWriter *AAW) const;
79
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;
84   }
85 };
86
87 } // End llvm namespace
88
89 #endif