llvm.org GIT mirror llvm / b21ab43
Revert r194865 and r194874. This change is incorrect. If you delete virtual destructor of both a base class and a subclass, then the following code: Base *foo = new Child(); delete foo; will not cause the destructor for members of Child class. As a result, I observe plently of memory leaks. Notable examples I investigated are: ObjectBuffer and ObjectBufferStream, AttributeImpl and StringSAttributeImpl. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194997 91177308-0d34-0410-b5e6-96231b3b80d8 Alexey Samsonov 6 years ago
115 changed file(s) with 159 addition(s) and 507 deletion(s). Raw diff Collapse all Expand all
15761576 std::runtime_error::operator=(toCopy)));
15771577 }
15781578
1579 ~OurCppRunException (void) throw ();
1579 ~OurCppRunException (void) throw () {}
15801580 };
1581
1582 OurCppRunException::~OurCppRunException() throw () {}
15831581
15841582
15851583 /// Throws foreign C++ exception.
7878 /// ExprAST - Base class for all expression nodes.
7979 class ExprAST {
8080 public:
81 virtual ~ExprAST();
82 };
83
84 ExprAST::~ExprAST() {}
81 virtual ~ExprAST() {}
82 };
8583
8684 /// NumberExprAST - Expression class for numeric literals like "1.0".
8785 class NumberExprAST : public ExprAST {
8886 public:
8987 NumberExprAST(double val) {}
90 virtual ~NumberExprAST();
91 };
92
93 NumberExprAST::~NumberExprAST() {}
88 };
9489
9590 /// VariableExprAST - Expression class for referencing a variable, like "a".
9691 class VariableExprAST : public ExprAST {
9792 std::string Name;
9893 public:
9994 VariableExprAST(const std::string &name) : Name(name) {}
100 virtual ~VariableExprAST();
101 };
102
103 VariableExprAST::~VariableExprAST() {}
95 };
10496
10597 /// BinaryExprAST - Expression class for a binary operator.
10698 class BinaryExprAST : public ExprAST {
10799 public:
108100 BinaryExprAST(char op, ExprAST *lhs, ExprAST *rhs) {}
109 virtual ~BinaryExprAST();
110 };
111
112 BinaryExprAST::~BinaryExprAST() {}
101 };
113102
114103 /// CallExprAST - Expression class for function calls.
115104 class CallExprAST : public ExprAST {
118107 public:
119108 CallExprAST(const std::string &callee, std::vector &args)
120109 : Callee(callee), Args(args) {}
121 virtual ~CallExprAST();
122 };
123
124 CallExprAST::~CallExprAST() {}
110 };
125111
126112 /// PrototypeAST - This class represents the "prototype" for a function,
127113 /// which captures its name, and its argument names (thus implicitly the number
8383 /// ExprAST - Base class for all expression nodes.
8484 class ExprAST {
8585 public:
86 virtual ~ExprAST();
86 virtual ~ExprAST() {}
8787 virtual Value *Codegen() = 0;
8888 };
89
90 ExprAST::~ExprAST() {}
9189
9290 /// NumberExprAST - Expression class for numeric literals like "1.0".
9391 class NumberExprAST : public ExprAST {
9090 /// ExprAST - Base class for all expression nodes.
9191 class ExprAST {
9292 public:
93 virtual ~ExprAST();
93 virtual ~ExprAST() {}
9494 virtual Value *Codegen() = 0;
9595 };
96
97 ExprAST::~ExprAST() {}
9896
9997 /// NumberExprAST - Expression class for numeric literals like "1.0".
10098 class NumberExprAST : public ExprAST {
9999 /// ExprAST - Base class for all expression nodes.
100100 class ExprAST {
101101 public:
102 virtual ~ExprAST();
102 virtual ~ExprAST() {}
103103 virtual Value *Codegen() = 0;
104104 };
105
106 ExprAST::~ExprAST() {}
107105
108106 /// NumberExprAST - Expression class for numeric literals like "1.0".
109107 class NumberExprAST : public ExprAST {
104104 /// ExprAST - Base class for all expression nodes.
105105 class ExprAST {
106106 public:
107 virtual ~ExprAST();
107 virtual ~ExprAST() {}
108108 virtual Value *Codegen() = 0;
109109 };
110
111 ExprAST::~ExprAST() {}
112110
113111 /// NumberExprAST - Expression class for numeric literals like "1.0".
114112 class NumberExprAST : public ExprAST {
108108 /// ExprAST - Base class for all expression nodes.
109109 class ExprAST {
110110 public:
111 virtual ~ExprAST();
111 virtual ~ExprAST() {}
112112 virtual Value *Codegen() = 0;
113113 };
114
115 ExprAST::~ExprAST() {}
116114
117115 /// NumberExprAST - Expression class for numeric literals like "1.0".
118116 class NumberExprAST : public ExprAST {
2929 class MachineRegisterInfo {
3030 public:
3131 class Delegate {
32 virtual void anchor();
3332 public:
34 virtual void MRI_NoteNewVirtualRegister(unsigned Reg) = 0;
33 virtual void MRI_NoteNewVirtualRegister(unsigned Reg) {}
3534
3635 virtual ~Delegate() {}
3736 };
163163 /// Initialization sequence:
164164 /// initPolicy -> shouldTrackPressure -> initialize(DAG) -> registerRoots
165165 class MachineSchedStrategy {
166 virtual void anchor();
167166 public:
168167 virtual ~MachineSchedStrategy() {}
169168
262261
263262 /// Mutate the DAG as a postpass after normal DAG building.
264263 class ScheduleDAGMutation {
265 virtual void anchor();
266264 public:
267265 virtual ~ScheduleDAGMutation() {}
268266
3232 public:
3333 ObjectBuffer() {}
3434 ObjectBuffer(MemoryBuffer* Buf) : Buffer(Buf) {}
35 virtual ~ObjectBuffer() {}
3536
3637 /// getMemBuffer - Like MemoryBuffer::getMemBuffer() this function
3738 /// returns a pointer to an object that is owned by the caller. However,
5657 class ObjectBufferStream : public ObjectBuffer {
5758 public:
5859 ObjectBufferStream() : OS(SV) {}
60 virtual ~ObjectBufferStream() {}
5961
6062 raw_ostream &getOStream() { return OS; }
6163 void flush()
1919 /// ExecutionEngine for the purpose of avoiding compilation for Modules that
2020 /// have already been compiled and an object file is available.
2121 class ObjectCache {
22 virtual void anchor();
2322 public:
2423 ObjectCache() { }
2524
2424 class ObjectImage {
2525 ObjectImage() LLVM_DELETED_FUNCTION;
2626 ObjectImage(const ObjectImage &other) LLVM_DELETED_FUNCTION;
27 virtual void anchor();
2827
2928 protected:
3029 OwningPtr Buffer;
3131 /// \brief Represents a contiguous range of either instructions (a TextAtom)
3232 /// or data (a DataAtom). Address ranges are expressed as _closed_ intervals.
3333 class MCAtom {
34 virtual void anchor();
3534 public:
3635 virtual ~MCAtom() {}
3736
7575 // FIXME: declared here because it is used from
7676 // lib/CodeGen/AsmPrinter/ARMException.cpp.
7777 class ARMTargetStreamer : public MCTargetStreamer {
78 virtual void anchor();
7978 public:
8079 virtual void emitFnStart() = 0;
8180 virtual void emitFnEnd() = 0;
1717
1818 class MCWinCOFFObjectTargetWriter {
1919 const unsigned Machine;
20
21 virtual void anchor();
2220
2321 protected:
2422 MCWinCOFFObjectTargetWriter(unsigned Machine_);
349349 struct GenericOptionValue {
350350 virtual ~GenericOptionValue() {}
351351 virtual bool compare(const GenericOptionValue &V) const = 0;
352
353 private:
354 virtual void anchor();
355352 };
356353
357354 template struct OptionValue;
17541751 /// \brief Saves strings in the inheritor's stable storage and returns a stable
17551752 /// raw character pointer.
17561753 class StringSaver {
1757 virtual void anchor();
17581754 public:
17591755 virtual const char *SaveString(const char *Str) = 0;
17601756 virtual ~StringSaver() {}; // Pacify -Wnon-virtual-dtor.
338338 /// rearrange itself when the pointer changes). Unlike ValueHandleBase, this
339339 /// class has a vtable and a virtual destructor.
340340 class CallbackVH : public ValueHandleBase {
341 virtual void anchor();
342341 protected:
343342 CallbackVH(const CallbackVH &RHS)
344343 : ValueHandleBase(Callback, RHS) {}
365364 ///
366365 /// All implementations must remove the reference from this object to the
367366 /// Value that's being destroyed.
368 virtual void deleted() { setValPtr(NULL); }
367 virtual void deleted();
369368
370369 /// Called when this->getValPtr()->replaceAllUsesWith(new_value) is called,
371370 /// _before_ any of the uses have actually been replaced. If WeakVH were
372371 /// implemented as a CallbackVH, it would use this method to call
373372 /// setValPtr(new_value). AssertingVH would do nothing in this method.
374 virtual void allUsesReplacedWith(Value *) {}
373 virtual void allUsesReplacedWith(Value *);
375374 };
376375
377376 } // End llvm namespace
104104
105105 /// @brief Abstract base class for all Nodes.
106106 class Node {
107 virtual void anchor();
108107 public:
109108 enum NodeKind {
110109 NK_Null,
175174 /// Example:
176175 /// !!null null
177176 class NullNode : public Node {
178 virtual void anchor();
179177 public:
180178 NullNode(OwningPtr &D)
181179 : Node(NK_Null, D, StringRef(), StringRef()) {}
191189 /// Example:
192190 /// Adena
193191 class ScalarNode : public Node {
194 virtual void anchor();
195192 public:
196193 ScalarNode(OwningPtr &D, StringRef Anchor, StringRef Tag,
197194 StringRef Val)
233230 /// Example:
234231 /// Section: .text
235232 class KeyValueNode : public Node {
236 virtual void anchor();
237233 public:
238234 KeyValueNode(OwningPtr &D)
239235 : Node(NK_KeyValue, D, StringRef(), StringRef())
345341 /// Name: _main
346342 /// Scope: Global
347343 class MappingNode : public Node {
348 virtual void anchor();
349344 public:
350345 enum MappingType {
351346 MT_Block,
395390 /// - Hello
396391 /// - World
397392 class SequenceNode : public Node {
398 virtual void anchor();
399393 public:
400394 enum SequenceType {
401395 ST_Block,
451445 /// Example:
452446 /// *AnchorName
453447 class AliasNode : public Node {
454 virtual void anchor();
455448 public:
456449 AliasNode(OwningPtr &D, StringRef Val)
457450 : Node(NK_Alias, D, StringRef(), StringRef()), Name(Val) {}
722722 virtual bool canElideEmptySequence();
723723
724724 class HNode {
725 virtual void anchor();
726725 public:
727726 HNode(Node *n) : _node(n) { }
728727 virtual ~HNode() { }
732731 };
733732
734733 class EmptyHNode : public HNode {
735 virtual void anchor();
736734 public:
737735 EmptyHNode(Node *n) : HNode(n) { }
736 virtual ~EmptyHNode() {}
738737 static inline bool classof(const HNode *n) {
739738 return NullNode::classof(n->_node);
740739 }
742741 };
743742
744743 class ScalarHNode : public HNode {
745 virtual void anchor();
746744 public:
747745 ScalarHNode(Node *n, StringRef s) : HNode(n), _value(s) { }
746 virtual ~ScalarHNode() { }
748747
749748 StringRef value() const { return _value; }
750749
757756 };
758757
759758 class MapHNode : public HNode {
760 virtual void anchor();
761759 public:
762760 MapHNode(Node *n) : HNode(n) { }
763761 virtual ~MapHNode();
776774 };
777775
778776 class SequenceHNode : public HNode {
779 virtual void anchor();
780777 public:
781778 SequenceHNode(Node *n) : HNode(n) { }
782779 virtual ~SequenceHNode();
1717 #include "llvm/Support/raw_os_ostream.h"
1818
1919 using namespace llvm;
20
21 // pin vtable to this file
22 void MachineRegisterInfo::Delegate::anchor() {}
2320
2421 MachineRegisterInfo::MachineRegisterInfo(const TargetMachine &TM)
2522 : TM(TM), TheDelegate(0), IsSSA(true), TracksLiveness(true) {
7070
7171 // DAG subtrees must have at least this many nodes.
7272 static const unsigned MinSubtreeSize = 8;
73
74 // pin vtable to this file
75 void MachineSchedStrategy::anchor() {}
76 void ScheduleDAGMutation::anchor() {}
7773
7874 //===----------------------------------------------------------------------===//
7975 // Machine Instruction Scheduling Pass and Registry
4848 //===----------------------------------------------------------------------===//
4949 // RegAllocBase Implementation
5050 //===----------------------------------------------------------------------===//
51
52 // pin vtable to this file
53 void RegAllocBase::anchor() {}
5451
5552 void RegAllocBase::init(VirtRegMap &vrm,
5653 LiveIntervals &lis,
5656 /// live range splitting. They must also override enqueue/dequeue to provide an
5757 /// assignment order.
5858 class RegAllocBase {
59 virtual void anchor();
6059 protected:
6160 const TargetRegisterInfo *TRI;
6261 MachineRegisterInfo *MRI;
1414 #define DEBUG_TYPE "jit"
1515 #include "llvm/ExecutionEngine/ExecutionEngine.h"
1616 #include "llvm/ExecutionEngine/JITMemoryManager.h"
17 #include "llvm/ExecutionEngine/ObjectCache.h"
1817 #include "llvm/ADT/SmallString.h"
1918 #include "llvm/ADT/Statistic.h"
2019 #include "llvm/ExecutionEngine/GenericValue.h"
3837
3938 STATISTIC(NumInitBytes, "Number of bytes of global vars initialized");
4039 STATISTIC(NumGlobals , "Number of global vars initialized");
41
42 // pin vtable to this file
43 void ObjectCache::anchor() {}
4440
4541 ExecutionEngine *(*ExecutionEngine::JITCtor)(
4642 Module *M,
1515
1616 /// Global access point for the JIT debugging interface.
1717 class JITRegistrar {
18 virtual void anchor();
1918 public:
2019 /// Instantiates the JIT service.
2120 JITRegistrar() {}
2222 class ObjectImageCommon : public ObjectImage {
2323 ObjectImageCommon(); // = delete
2424 ObjectImageCommon(const ObjectImageCommon &other); // = delete
25 virtual void anchor();
2625
2726 protected:
2827 object::ObjectFile *ObjFile;
1212
1313 #define DEBUG_TYPE "dyld"
1414 #include "llvm/ExecutionEngine/RuntimeDyld.h"
15 #include "JITRegistrar.h"
1615 #include "ObjectImageCommon.h"
1716 #include "RuntimeDyldELF.h"
1817 #include "RuntimeDyldImpl.h"
2726
2827 // Empty out-of-line virtual destructor as the key function.
2928 RuntimeDyldImpl::~RuntimeDyldImpl() {}
30
31 // pin JITRegistrar.h and ObjectImage*.h vtables to this file
32 void JITRegistrar::anchor() {}
33 void ObjectImage::anchor() {}
34 void ObjectImageCommon::anchor() {}
3529
3630 namespace llvm {
3731
4545 AttributeImpl(AttrEntryKind KindID) : KindID(KindID) {}
4646
4747 public:
48 virtual ~AttributeImpl();
49
4850 bool isEnumAttribute() const { return KindID == EnumAttrEntry; }
4951 bool isAlignAttribute() const { return KindID == AlignAttrEntry; }
5052 bool isStringAttribute() const { return KindID == StringAttrEntry; }
285285 // AttributeImpl Definition
286286 //===----------------------------------------------------------------------===//
287287
288 AttributeImpl::~AttributeImpl() {}
289
288290 bool AttributeImpl::hasAttribute(Attribute::AttrKind A) const {
289291 if (isStringAttribute()) return false;
290292 return getKindAsEnum() == A;
6464
6565 public:
6666 MDNodeOperand(Value *V) : CallbackVH(V) {}
67 virtual ~MDNodeOperand();
67 ~MDNodeOperand() {}
6868
6969 void set(Value *V) {
7070 unsigned IsFirst = this->getValPtrInt();
8080 virtual void allUsesReplacedWith(Value *NV);
8181 };
8282 } // end namespace llvm.
83
84 MDNodeOperand::~MDNodeOperand() {}
8583
8684
8785 void MDNodeOperand::deleted() {
734734 #endif
735735 }
736736
737 // pin vtable to this file
738 void CallbackVH::anchor() {}
737 // Default implementation for CallbackVH.
738 void CallbackVH::allUsesReplacedWith(Value *) {}
739
740 void CallbackVH::deleted() {
741 setValPtr(NULL);
742 }
1212 #include
1313
1414 using namespace llvm;
15
16 // pin vtable to this file
17 void MCAtom::anchor() {}
1815
1916 void MCAtom::remap(uint64_t NewBegin, uint64_t NewEnd) {
2017 Parent->remap(this, NewBegin, NewEnd);
2121 #include
2222 using namespace llvm;
2323
24 // pin vtables to this file
2524 MCTargetStreamer::~MCTargetStreamer() {}
26 void ARMTargetStreamer::anchor() {}
2725
2826 MCStreamer::MCStreamer(MCContext &Ctx, MCTargetStreamer *TargetStreamer)
2927 : Context(Ctx), TargetStreamer(TargetStreamer), EmitEHFrame(true),
137137 symbol_map SymbolMap;
138138
139139 WinCOFFObjectWriter(MCWinCOFFObjectTargetWriter *MOTW, raw_ostream &OS);
140 virtual ~WinCOFFObjectWriter();
140 ~WinCOFFObjectWriter();
141141
142142 COFFSymbol *createSymbol(StringRef Name);
143143 COFFSymbol *GetOrCreateCOFFSymbol(const MCSymbol * Symbol);
897897 Machine(Machine_) {
898898 }
899899
900 // pin vtable to this file
901 void MCWinCOFFObjectTargetWriter::anchor() {}
902
903900 //------------------------------------------------------------------------------
904901 // WinCOFFObjectWriter factory function
905902
5959 TEMPLATE_INSTANTIATION(class opt);
6060 } } // end namespace llvm::cl
6161
62 void GenericOptionValue::anchor() {}
6362 void OptionValue::anchor() {}
6463 void OptionValue::anchor() {}
6564 void Option::anchor() {}
7372 void parser::anchor() {}
7473 void parser::anchor() {}
7574 void parser::anchor() {}
76 void StringSaver::anchor() {}
7775
7876 //===----------------------------------------------------------------------===//
7977
1616 #include "llvm/ADT/Twine.h"
1717 #include "llvm/Config/config.h"
1818 #include "llvm/Support/Debug.h"
19 #include "llvm/Support/ErrorOr.h"
2019 #include "llvm/Support/Signals.h"
2120 #include "llvm/Support/Threading.h"
2221 #include "llvm/Support/raw_ostream.h"
119118 void LLVMResetFatalErrorHandler() {
120119 remove_fatal_error_handler();
121120 }
122
9595
9696 namespace llvm {
9797 namespace yaml {
98 /// pin the vtables to this file
99 void Node::anchor() {}
100 void NullNode::anchor() {}
101 void ScalarNode::anchor() {}
102 void KeyValueNode::anchor() {}
103 void MappingNode::anchor() {}
104 void SequenceNode::anchor() {}
105 void AliasNode::anchor() {}
106
10798 /// Token - A single YAML token.
10899 struct Token : ilist_node {
109100 enum TokenKind {
5757 void Input::setDiagHandler(SourceMgr::DiagHandlerTy Handler, void *Ctxt) {
5858 SrcMgr.setDiagHandler(Handler, Ctxt);
5959 }
60
61 /// pin the vtables to this file
62 void Input::HNode::anchor() {}
63 void Input::EmptyHNode::anchor() {}
64 void Input::ScalarHNode::anchor() {}
65 void Input::MapHNode::anchor() {}
66 void Input::SequenceHNode::anchor() {}
6760
6861 bool Input::outputting() const {
6962 return false;
2828
2929 #include
3030
31 #define GET_INSTRINFO_CTOR_DTOR
31 #define GET_INSTRINFO_CTOR
3232 #include "AArch64GenInstrInfo.inc"
3333
3434 using namespace llvm;
2323 #include "AArch64GenSubtargetInfo.inc"
2424
2525 using namespace llvm;
26
27 // pin vtable to this file
28 void AArch64Subtarget::anchor() {}
2926
3027 AArch64Subtarget::AArch64Subtarget(StringRef TT, StringRef CPU, StringRef FS)
3128 : AArch64GenSubtargetInfo(TT, CPU, FS), HasFPARMv8(false), HasNEON(false),
2626 class GlobalValue;
2727
2828 class AArch64Subtarget : public AArch64GenSubtargetInfo {
29 virtual void anchor();
3029 protected:
3130 bool HasFPARMv8;
3231 bool HasNEON;
3636 // Exceptions handling
3737 ExceptionsType = ExceptionHandling::DwarfCFI;
3838 }
39
40 void AArch64ELFMCAsmInfo::anchor() {}
1717
1818 namespace llvm {
1919
20 struct AArch64ELFMCAsmInfo : public MCAsmInfoELF {
21 explicit AArch64ELFMCAsmInfo();
22
23 private:
24 virtual void anchor();
25 };
20 struct AArch64ELFMCAsmInfo : public MCAsmInfoELF {
21 explicit AArch64ELFMCAsmInfo();
22 };
2623
2724 } // namespace llvm
2825
3636 #include "llvm/Support/Debug.h"
3737 #include "llvm/Support/ErrorHandling.h"
3838
39 #define GET_INSTRINFO_CTOR_DTOR
39 #define GET_INSTRINFO_CTOR
4040 #include "ARMGenInstrInfo.inc"
4141
4242 using namespace llvm;
1616 HexagonFrameLowering.cpp
1717 HexagonHardwareLoops.cpp
1818 HexagonFixupHwLoops.cpp
19 HexagonMachineFunctionInfo.cpp
2019 HexagonMachineScheduler.cpp
2120 HexagonMCInstLower.cpp
2221 HexagonInstrInfo.cpp
2525 #include "llvm/Support/Debug.h"
2626 #include "llvm/Support/MathExtras.h"
2727 #include "llvm/Support/raw_ostream.h"
28 #define GET_INSTRINFO_CTOR_DTOR
28 #define GET_INSTRINFO_CTOR
2929 #define GET_INSTRMAP_INFO
3030 #include "HexagonGenInstrInfo.inc"
3131 #include "HexagonGenDFAPacketizer.inc"
5454 const int Hexagon_MEMB_AUTOINC_MAX = 7;
5555 const int Hexagon_MEMB_AUTOINC_MIN = -8;
5656
57 // pin vtable to this file
58 void HexagonInstrInfo::anchor() {}
5957
6058 HexagonInstrInfo::HexagonInstrInfo(HexagonSubtarget &ST)
6159 : HexagonGenInstrInfo(Hexagon::ADJCALLSTACKDOWN, Hexagon::ADJCALLSTACKUP),
2828 const HexagonRegisterInfo RI;
2929 const HexagonSubtarget &Subtarget;
3030 typedef unsigned Opcode_t;
31
32 virtual void anchor();
3331
3432 public:
3533 explicit HexagonInstrInfo(HexagonSubtarget &ST);
+0
-16
lib/Target/Hexagon/HexagonMachineFunctionInfo.cpp less more
None //= HexagonMachineFunctionInfo.cpp - Hexagon machine function info *- C++ -*-=//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include "HexagonMachineFunctionInfo.h"
10
11 using namespace llvm;
12
13 // pin vtable to this file
14 void HexagonMachineFunctionInfo::anchor() {}
15
None //=- HexagonMachineFunctionInfo.h - Hexagon machine function info -*- C++ -*-=//
0 //=- HexagonMachineFuctionInfo.h - Hexagon machine function info --*- C++ -*-=//
11 //
22 // The LLVM Compiler Infrastructure
33 //
99 #ifndef HexagonMACHINEFUNCTIONINFO_H
1010 #define HexagonMACHINEFUNCTIONINFO_H
1111
12 #include
1312 #include "llvm/CodeGen/MachineFunction.h"
1413
1514 namespace llvm {
3332
3433 std::map PacketInfo;
3534
36 virtual void anchor();
3735
3836 public:
3937 HexagonMachineFunctionInfo() : SRetReturnReg(0), HasClobberLR(0),
8585 ModeIEEERndNear = false;
8686 }
8787
88 HexagonSubtarget::~HexagonSubtarget() {}
4141
4242 public:
4343 HexagonSubtarget(StringRef TT, StringRef CPU, StringRef FS);
44 virtual ~HexagonSubtarget();
4544
4645 /// getInstrItins - Return the instruction itineraies based on subtarget
4746 /// selection.
1313 #include "HexagonMCAsmInfo.h"
1414
1515 using namespace llvm;
16
17 // pin vtable to this file
18 void HexagonMCAsmInfo::anchor() {}
1916
2017 HexagonMCAsmInfo::HexagonMCAsmInfo(StringRef TT) {
2118 Data16bitsDirective = "\t.half\t";
1818
1919 namespace llvm {
2020 class HexagonMCAsmInfo : public MCAsmInfoELF {
21 virtual void anchor();
2221 public:
2322 explicit HexagonMCAsmInfo(StringRef TT);
2423 };
2121 #include "llvm/Support/ErrorHandling.h"
2222 #include "llvm/Support/TargetRegistry.h"
2323
24 #define GET_INSTRINFO_CTOR_DTOR
24 #define GET_INSTRINFO_CTOR
2525 #include "MSP430GenInstrInfo.inc"
2626
2727 using namespace llvm;
28
29 // pin vtable to this file
30 void MSP430InstrInfo::anchor() {}
3128
3229 MSP430InstrInfo::MSP430InstrInfo(MSP430TargetMachine &tm)
3330 : MSP430GenInstrInfo(MSP430::ADJCALLSTACKDOWN, MSP430::ADJCALLSTACKUP),
4141
4242 class MSP430InstrInfo : public MSP430GenInstrInfo {
4343 const MSP430RegisterInfo RI;
44 virtual void anchor();
4544 public:
4645 explicit MSP430InstrInfo(MSP430TargetMachine &TM);
4746
4141 static cl::opt PrintHackDirectives("print-hack-directives",
4242 cl::init(false), cl::Hidden);
4343
44 // pin vtable to this file
45 void MipsTargetStreamer::anchor() {}
46
4744 static std::string ParseMipsTriple(StringRef TT, StringRef CPU) {
4845 std::string MipsArchFeature;
4946 size_t DashPosition = 0;
2121 #include "llvm/Support/ErrorHandling.h"
2222 #include "llvm/Support/TargetRegistry.h"
2323
24 #define GET_INSTRINFO_CTOR_DTOR
24 #define GET_INSTRINFO_CTOR
2525 #include "MipsGenInstrInfo.inc"
2626
2727 using namespace llvm;
28
29 // pin vtable to this file
30 void MipsInstrInfo::anchor() {}
3128
3229 MipsInstrInfo::MipsInstrInfo(MipsTargetMachine &tm, unsigned UncondBr)
3330 : MipsGenInstrInfo(Mips::ADJCALLSTACKDOWN, Mips::ADJCALLSTACKUP),
2626 namespace llvm {
2727
2828 class MipsInstrInfo : public MipsGenInstrInfo {
29 virtual void anchor();
3029 protected:
3130 MipsTargetMachine &TM;
3231 unsigned UncondBrOpc;
1313
1414 namespace llvm {
1515 class MipsTargetStreamer : public MCTargetStreamer {
16 virtual void anchor();
1716 public:
1817 virtual void emitMipsHackELFFlags(unsigned Flags) = 0;
1918 virtual void emitMipsHackSTOCG(MCSymbol *Sym, unsigned Val) = 0;
22872287 return;
22882288 }
22892289 }
2290
2291 // pin NVPTXSection.h and NVPTXTargetObjectFile.h vtables to this file
2292 void NVPTXSection::anchor() {}
2293
2294 NVPTXTargetObjectFile::~NVPTXTargetObjectFile() {
2295 delete TextSection;
2296 delete DataSection;
2297 delete BSSSection;
2298 delete ReadOnlySection;
2299
2300 delete StaticCtorSection;
2301 delete StaticDtorSection;
2302 delete LSDASection;
2303 delete EHFrameSection;
2304 delete DwarfAbbrevSection;
2305 delete DwarfInfoSection;
2306 delete DwarfLineSection;
2307 delete DwarfFrameSection;
2308 delete DwarfPubTypesSection;
2309 delete DwarfDebugInlineSection;
2310 delete DwarfStrSection;
2311 delete DwarfLocSection;
2312 delete DwarfARangesSection;
2313 delete DwarfRangesSection;
2314 delete DwarfMacroInfoSection;
2315 }
1313 #include "NVPTX.h"
1414 #include "NVPTXInstrInfo.h"
1515 #include "NVPTXTargetMachine.h"
16 #define GET_INSTRINFO_CTOR_DTOR
16 #define GET_INSTRINFO_CTOR
1717 #include "NVPTXGenInstrInfo.inc"
1818 #include "llvm/IR/Function.h"
1919 #include "llvm/ADT/STLExtras.h"
2222 #include "llvm/CodeGen/MachineRegisterInfo.h"
2323
2424 using namespace llvm;
25
26 // pin vtable to this file
27 void NVPTXInstrInfo::anchor() {}
2825
2926 // FIXME: Add the subtarget support on this constructor.
3027 NVPTXInstrInfo::NVPTXInstrInfo(NVPTXTargetMachine &tm)
2525 class NVPTXInstrInfo : public NVPTXGenInstrInfo {
2626 NVPTXTargetMachine &TM;
2727 const NVPTXRegisterInfo RegInfo;
28 virtual void anchor();
2928 public:
3029 explicit NVPTXInstrInfo(NVPTXTargetMachine &TM);
3130
2323 /// the ASMPrint interface.
2424 ///
2525 class NVPTXSection : public MCSection {
26 virtual void anchor();
26
2727 public:
2828 NVPTXSection(SectionVariant V, SectionKind K) : MCSection(V, K) {}
29 virtual ~NVPTXSection() {}
29 ~NVPTXSection() {}
3030
3131 /// Override this as NVPTX has its own way of printing switching
3232 /// to a section.
1818
1919 using namespace llvm;
2020
21
22 // pin vtable to this file
23 void NVPTXSubtarget::anchor() {}
2421
2522 NVPTXSubtarget::NVPTXSubtarget(const std::string &TT, const std::string &CPU,
2623 const std::string &FS, bool is64Bit)
3434
3535 // SM version x.y is represented as 10*x+y, e.g. 3.1 == 31
3636 unsigned int SmVersion;
37
38 virtual void anchor();
3937
4038 public:
4139 /// This constructor initializes the data members to match that
4343 DwarfMacroInfoSection = 0;
4444 }
4545
46 virtual ~NVPTXTargetObjectFile();
46 ~NVPTXTargetObjectFile() {
47 delete TextSection;
48 delete DataSection;
49 delete BSSSection;
50 delete ReadOnlySection;
51
52 delete StaticCtorSection;
53 delete StaticDtorSection;
54 delete LSDASection;
55 delete EHFrameSection;
56 delete DwarfAbbrevSection;
57 delete DwarfInfoSection;
58 delete DwarfLineSection;
59 delete DwarfFrameSection;
60 delete DwarfPubTypesSection;
61 delete DwarfDebugInlineSection;
62 delete DwarfStrSection;
63 delete DwarfLocSection;
64 delete DwarfARangesSection;
65 delete DwarfRangesSection;
66 delete DwarfMacroInfoSection;
67 }
4768
4869 virtual void Initialize(MCContext &ctx, const TargetMachine &TM) {
4970 TargetLoweringObjectFile::Initialize(ctx, TM);
3535 #include "PPCGenRegisterInfo.inc"
3636
3737 using namespace llvm;
38
39 // pin vtable to this file
40 PPCTargetStreamer::~PPCTargetStreamer() {}
4138
4239 static MCInstrInfo *createPPCMCInstrInfo() {
4340 MCInstrInfo *X = new MCInstrInfo();
3232 #include "llvm/Support/raw_ostream.h"
3333
3434 #define GET_INSTRMAP_INFO
35 #define GET_INSTRINFO_CTOR_DTOR
35 #define GET_INSTRINFO_CTOR
3636 #include "PPCGenInstrInfo.inc"
3737
3838 using namespace llvm;
4343
4444 static cl::opt DisableCmpOpt("disable-ppc-cmp-opt",
4545 cl::desc("Disable compare instruction optimization"), cl::Hidden);
46
47 //pin vtable to this file
48 void PPCInstrInfo::anchor() {}
4946
5047 PPCInstrInfo::PPCInstrInfo(PPCTargetMachine &tm)
5148 : PPCGenInstrInfo(PPC::ADJCALLSTACKDOWN, PPC::ADJCALLSTACKUP),
7777 const TargetRegisterClass *RC,
7878 SmallVectorImpl &NewMIs,
7979 bool &NonRI, bool &SpillsVRS) const;
80 virtual void anchor();
8180 public:
8281 explicit PPCInstrInfo(PPCTargetMachine &TM);
8382
1414 namespace llvm {
1515 class PPCTargetStreamer : public MCTargetStreamer {
1616 public:
17 virtual ~PPCTargetStreamer();
1817 virtual void emitTCEntry(const MCSymbol &S) = 0;
1918 };
2019 }
1919 #include "llvm/CodeGen/MachineInstrBuilder.h"
2020 #include "llvm/CodeGen/MachineRegisterInfo.h"
2121
22 #define GET_INSTRINFO_CTOR_DTOR
22 #define GET_INSTRINFO_CTOR
2323 #define GET_INSTRINFO_NAMED_OPS
2424 #define GET_INSTRMAP_INFO
2525 #include "AMDGPUGenInstrInfo.inc"
2626
2727 using namespace llvm;
28
29
30 // pin vtable to this file
31 void AMDGPUInstrInfo::anchor() {}
3228
3329 AMDGPUInstrInfo::AMDGPUInstrInfo(TargetMachine &tm)
3430 : AMDGPUGenInstrInfo(-1,-1), RI(tm), TM(tm) { }
4242 const AMDGPURegisterInfo RI;
4343 bool getNextBranchInstr(MachineBasicBlock::iterator &iter,
4444 MachineBasicBlock &MBB) const;
45 virtual void anchor();
4645 protected:
4746 TargetMachine &TM;
4847 public:
44 using namespace llvm;
55
66 static const char *const ShaderTypeAttribute = "ShaderType";
7
8 // pin vtable to this file
9 void AMDGPUMachineFunction::anchor() {}
107
118 AMDGPUMachineFunction::AMDGPUMachineFunction(const MachineFunction &MF) :
129 MachineFunctionInfo() {
1818 namespace llvm {
1919
2020 class AMDGPUMachineFunction : public MachineFunctionInfo {
21 virtual void anchor();
2221 public:
2322 AMDGPUMachineFunction(const MachineFunction &MF);
2423 unsigned ShaderType;
+0
-21
lib/Target/R600/MCTargetDesc/AMDGPUMCCodeEmitter.cpp less more
None //===-- AMDGPUCodeEmitter.cpp - AMDGPU Code Emitter interface -------------===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 /// \file
10 /// \brief CodeEmitter interface for R600 and SI codegen.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #include "AMDGPUMCCodeEmitter.h"
15
16 using namespace llvm;
17
18 // pin vtable to this file
19 void AMDGPUMCCodeEmitter::anchor() {}
20
2323 class MCOperand;
2424
2525 class AMDGPUMCCodeEmitter : public MCCodeEmitter {
26 virtual void anchor();
2726 public:
2827
2928 uint64_t getBinaryCodeForInstr(const MCInst &MI,
11 add_llvm_library(LLVMR600Desc
22 AMDGPUAsmBackend.cpp
33 AMDGPUELFObjectWriter.cpp
4 AMDGPUMCCodeEmitter.cpp
54 AMDGPUMCTargetDesc.cpp
65 AMDGPUMCAsmInfo.cpp
76 R600MCCodeEmitter.cpp
2222 #include "llvm/CodeGen/MachineInstrBuilder.h"
2323 #include "llvm/CodeGen/MachineRegisterInfo.h"
2424
25 #define GET_INSTRINFO_CTOR_DTOR
25 #define GET_INSTRINFO_CTOR
2626 #include "AMDGPUGenDFAPacketizer.inc"
2727
2828 using namespace llvm;
1111
1212 using namespace llvm;
1313
14
15 // pin vtable to this file
16 void R600MachineFunctionInfo::anchor() {}
17
1814 R600MachineFunctionInfo::R600MachineFunctionInfo(const MachineFunction &MF)
1915 : AMDGPUMachineFunction(MF) { }
16
17
2020 namespace llvm {
2121
2222 class R600MachineFunctionInfo : public AMDGPUMachineFunction {
23 virtual void anchor();
2423 public:
2524 R600MachineFunctionInfo(const MachineFunction &MF);
2625 SmallVector LiveOuts;
1212
1313 using namespace llvm;
1414
15
16 // pin vtable to this file
17 void SIMachineFunctionInfo::anchor() {}
18
1915 SIMachineFunctionInfo::SIMachineFunctionInfo(const MachineFunction &MF)
2016 : AMDGPUMachineFunction(MF),
2117 PSInputAddr(0) { }
2121 /// This class keeps track of the SPI_SP_INPUT_ADDR config register, which
2222 /// tells the hardware which interpolation parameters to load.
2323 class SIMachineFunctionInfo : public AMDGPUMachineFunction {
24 virtual void anchor();
2524 public:
2625 SIMachineFunctionInfo(const MachineFunction &MF);
2726 unsigned PSInputAddr;
2323 #include "llvm/Support/ErrorHandling.h"
2424 #include "llvm/Support/TargetRegistry.h"
2525
26 #define GET_INSTRINFO_CTOR_DTOR
26 #define GET_INSTRINFO_CTOR
2727 #include "SparcGenInstrInfo.inc"
2828
2929 using namespace llvm;
30
31
32 // pin vtable to this file
33 void SparcInstrInfo::anchor() {}
3430
3531 SparcInstrInfo::SparcInstrInfo(SparcSubtarget &ST)
3632 : SparcGenInstrInfo(SP::ADJCALLSTACKDOWN, SP::ADJCALLSTACKUP),
3636 class SparcInstrInfo : public SparcGenInstrInfo {
3737 const SparcRegisterInfo RI;
3838 const SparcSubtarget& Subtarget;
39 virtual void anchor();
4039 public:
4140 explicit SparcInstrInfo(SparcSubtarget &ST);
4241
2020 SystemZISelLowering.cpp
2121 SystemZInstrInfo.cpp
2222 SystemZLongBranch.cpp
23 SystemZMachineFunctionInfo.cpp
2423 SystemZMCInstLower.cpp
2524 SystemZRegisterInfo.cpp
2625 SystemZSelectionDAGInfo.cpp
1616 #include "llvm/CodeGen/LiveVariables.h"
1717 #include "llvm/CodeGen/MachineRegisterInfo.h"
1818
19 #define GET_INSTRINFO_CTOR_DTOR
19 #define GET_INSTRINFO_CTOR
2020 #define GET_INSTRMAP_INFO
2121 #include "SystemZGenInstrInfo.inc"
2222
3535 assert(SystemZ::GR32BitRegClass.contains(Reg) && "Invalid GRX32");
3636 return false;
3737 }
38
39 // pin vtable to this file
40 void SystemZInstrInfo::anchor() {}
4138
4239 SystemZInstrInfo::SystemZInstrInfo(SystemZTargetMachine &tm)
4340 : SystemZGenInstrInfo(SystemZ::ADJCALLSTACKDOWN, SystemZ::ADJCALLSTACKUP),
126126 void emitGRX32Move(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
127127 DebugLoc DL, unsigned DestReg, unsigned SrcReg,
128128 unsigned LowLowOpcode, unsigned Size, bool KillSrc) const;
129 virtual void anchor();
130129
131130 public:
132131 explicit SystemZInstrInfo(SystemZTargetMachine &TM);
+0
-17
lib/Target/SystemZ/SystemZMachineFunctionInfo.cpp less more
None //== SystemZMachineFuctionInfo.cpp - SystemZ machine function info-*- C++ -*-=//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include "SystemZMachineFunctionInfo.h"
10
11 using namespace llvm;
12
13
14 // pin vtable to this file
15 void SystemZMachineFunctionInfo::anchor() {}
16
2121 unsigned VarArgsFrameIndex;
2222 unsigned RegSaveFrameIndex;
2323 bool ManipulatesSP;
24
25 virtual void anchor();
2624
2725 public:
2826 explicit SystemZMachineFunctionInfo(MachineFunction &MF)
1616 #include "SystemZGenSubtargetInfo.inc"
1717
1818 using namespace llvm;
19
20 // pin vtabel to this file
21 void SystemZSubtarget::anchor() {}
2219
2320 SystemZSubtarget::SystemZSubtarget(const std::string &TT,
2421 const std::string &CPU,
2525 class StringRef;
2626
2727 class SystemZSubtarget : public SystemZGenSubtargetInfo {
28 virtual void anchor();
2928 protected:
3029 bool HasDistinctOps;
3130 bool HasLoadStoreOnCond;
2626
2727 public:
2828 X86WinCOFFObjectWriter(bool Is64Bit_);
29 virtual ~X86WinCOFFObjectWriter();
29 ~X86WinCOFFObjectWriter();
3030
3131 virtual unsigned getRelocType(const MCValue &Target,
3232 const MCFixup &Fixup,
3535 #include "llvm/Target/TargetOptions.h"
3636 #include
3737
38 #define GET_INSTRINFO_CTOR_DTOR
38 #define GET_INSTRINFO_CTOR
3939 #include "X86GenInstrInfo.inc"
4040
4141 using namespace llvm;
9090 uint16_t MemOp;
9191 uint16_t Flags;
9292 };
93
94 // pin vtable to this file
95 void X86InstrInfo::anchor() {}
9693
9794 X86InstrInfo::X86InstrInfo(X86TargetMachine &tm)
9895 : X86GenInstrInfo((tm.getSubtarget().is64Bit()
150150 static void AddTableEntry(RegOp2MemOpTableType &R2MTable,
151151 MemOp2RegOpTableType &M2RTable,
152152 unsigned RegOp, unsigned MemOp, unsigned Flags);
153
154 virtual void anchor();
155153
156154 public:
157155 explicit X86InstrInfo(X86TargetMachine &tm);
2121 #include "llvm/Support/ErrorHandling.h"
2222 #include "llvm/Support/TargetRegistry.h"
2323
24 #define GET_INSTRINFO_CTOR_DTOR
24 #define GET_INSTRINFO_CTOR
2525 #include "XCoreGenInstrInfo.inc"
2626
2727 namespace llvm {
3737 }
3838
3939 using namespace llvm;
40
41
42 // pin vtable to this file
43 void XCoreInstrInfo::anchor() {}
4440
4541 XCoreInstrInfo::XCoreInstrInfo()
4642 : XCoreGenInstrInfo(XCore::ADJCALLSTACKDOWN, XCore::ADJCALLSTACKUP),
2323
2424 class XCoreInstrInfo : public XCoreGenInstrInfo {
2525 const XCoreRegisterInfo RI;
26 virtual void anchor();
2726 public:
2827 XCoreInstrInfo();
2928
127127 BB(Block),PT(PT),Ran(R),Context(BB->getContext()) {}
128128
129129 /// virtual D'tor to silence warnings.
130 virtual ~Modifier();
130 virtual ~Modifier() {}
131131
132132 /// Add a new instruction.
133133 virtual void Act() = 0;
284284 LLVMContext &Context;
285285 };
286286
287 Modifier::~Modifier() {}
288
289287 struct LoadModifier: public Modifier {
290288 LoadModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
291 virtual ~LoadModifier();
292289 virtual void Act() {
293290 // Try to use predefined pointers. If non exist, use undef pointer value;
294291 Value *Ptr = getRandomPointerValue();
297294 }
298295 };
299296
300 LoadModifier::~LoadModifier() {}
301
302297 struct StoreModifier: public Modifier {
303298 StoreModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
304 virtual ~StoreModifier();
305299 virtual void Act() {
306300 // Try to use predefined pointers. If non exist, use undef pointer value;
307301 Value *Ptr = getRandomPointerValue();
318312 }
319313 };
320314
321 StoreModifier::~StoreModifier() {}
322
323315 struct BinModifier: public Modifier {
324316 BinModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
325 virtual ~BinModifier();
326317
327318 virtual void Act() {
328319 Value *Val0 = getRandomVal();
364355 }
365356 };
366357
367 BinModifier::~BinModifier() {}
368
369358 /// Generate constant values.
370359 struct ConstModifier: public Modifier {
371360 ConstModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
372 virtual ~ConstModifier();
373
374361 virtual void Act() {
375362 Type *Ty = pickType();
376363
415402 }
416403 };
417404
418 ConstModifier::~ConstModifier() {}
419
420405 struct AllocaModifier: public Modifier {
421406 AllocaModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R){}
422 virtual ~AllocaModifier();
423407
424408 virtual void Act() {
425409 Type *Tp = pickType();
426410 PT->push_back(new AllocaInst(Tp, "A", BB->getFirstNonPHI()));
427411 }
428412 };
429
430 AllocaModifier::~AllocaModifier() {}
431413
432414 struct ExtractElementModifier: public Modifier {
433415 ExtractElementModifier(BasicBlock *BB, PieceTable *PT, Random *R):
434416 Modifier(BB, PT, R) {}
435 virtual ~ExtractElementModifier();
436417
437418 virtual void Act() {
438419 Value *Val0 = getRandomVectorValue();
444425 }
445426 };
446427
447 ExtractElementModifier::~ExtractElementModifier() {}
448
449428 struct ShuffModifier: public Modifier {
450429 ShuffModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
451 virtual ~ShuffModifier();
452
453430 virtual void Act() {
454431
455432 Value *Val0 = getRandomVectorValue();
475452 }
476453 };
477454
478 ShuffModifier::~ShuffModifier() {}
479
480455 struct InsertElementModifier: public Modifier {
481456 InsertElementModifier(BasicBlock *BB, PieceTable *PT, Random *R):
482457 Modifier(BB, PT, R) {}
483 virtual ~InsertElementModifier();
484458
485459 virtual void Act() {
486460 Value *Val0 = getRandomVectorValue();
495469
496470 };
497471
498 InsertElementModifier::~InsertElementModifier() {}
499
500472 struct CastModifier: public Modifier {
501473 CastModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
502 virtual ~CastModifier();
503
504474 virtual void Act() {
505475
506476 Value *V = getRandomVal();
584554
585555 };
586556
587 CastModifier::~CastModifier() {}
588
589557 struct SelectModifier: public Modifier {
590558 SelectModifier(BasicBlock *BB, PieceTable *PT, Random *R):
591559 Modifier(BB, PT, R) {}
592 virtual ~SelectModifier();
593560
594561 virtual void Act() {
595562 // Try a bunch of different select configuration until a valid one is found.
611578 }
612579 };
613580
614 SelectModifier::~SelectModifier() {}
615581
616582 struct CmpModifier: public Modifier {
617583 CmpModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
618 virtual ~CmpModifier();
619
620584 virtual void Act() {
621585
622586 Value *Val0 = getRandomVal();
641605 return PT->push_back(V);
642606 }
643607 };
644
645 CmpModifier::~CmpModifier() {}
646608
647609 void FillFunction(Function *F, Random &R) {
648610 // Create a legal entry block.
1212 namespace llvm {
1313
1414 struct VirtualRefCounted : public RefCountedBaseVPTR {
15 virtual void f();
15 virtual void f() {}
1616 };
17
18 void VirtualRefCounted::f() {}
1917
2018 // Run this test with valgrind to detect memory leaks.
2119 TEST(IntrusiveRefCntPtr, RefCountedBaseVPTRCopyDoesNotLeak) {
8282 UnsupportedOSs.push_back(Triple::Cygwin);
8383 }
8484
85 virtual void SetUp();
86
85 virtual void SetUp() {
86 didCallAllocateCodeSection = false;
87 Module = 0;
88 Function = 0;
89 Engine = 0;
90 Error = 0;
91 }
92
8793 virtual void TearDown() {
8894 if (Engine)
8995 LLVMDisposeExecutionEngine(Engine);
150156 char *Error;
151157 };
152158
153 void MCJITCAPITest::SetUp() {
154 didCallAllocateCodeSection = false;
155 Module = 0;
156 Function = 0;
157 Engine = 0;
158 Error = 0;
159 }
160
161159 TEST_F(MCJITCAPITest, simple_function) {
162160 SKIP_UNSUPPORTED_PLATFORM;
163161
1717
1818 using namespace llvm;
1919
20 class MCJITMultipleModuleTest : public testing::Test,
21 public MCJITTestBase {
22 public:
23 virtual ~MCJITMultipleModuleTest();
24 };
25
26 MCJITMultipleModuleTest::~MCJITMultipleModuleTest() {}
20 class MCJITMultipleModuleTest : public testing::Test, public MCJITTestBase {};
2721
2822 namespace {
2923
2020 class MCJITTest : public testing::Test, public MCJITTestBase {
2121 protected:
2222
23 virtual void SetUp();
23 virtual void SetUp() {
24 M.reset(createEmptyModule("
"));
25 }
2426 };
25
26 void MCJITTest::SetUp() {
27 M.reset(createEmptyModule("
"));
28 }
2927
3028 namespace {
3129
3737
3838 // (instrs a, b, ...) Evaluate and union all arguments. Identical to AddOp.
3939 struct InstrsOp : public SetTheory::Operator {
40 virtual void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts,
41 ArrayRef Loc);
40 void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts,
41 ArrayRef Loc) {
42 ST.evaluate(Expr->arg_begin(), Expr->arg_end(), Elts, Loc);
43 }
4244 };
43
44 void InstrsOp::apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts,
45 ArrayRef Loc) {
46 ST.evaluate(Expr->arg_begin(), Expr->arg_end(), Elts, Loc);
47 }
4845
4946 // (instregex "OpcPat",...) Find all instructions matching an opcode pattern.
5047 //
5855 const CodeGenTarget &Target;
5956 InstRegexOp(const CodeGenTarget &t): Target(t) {}
6057
61 virtual void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts,
62 ArrayRef Loc);
58 void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts,
59 ArrayRef Loc) {
60 SmallVector RegexList;
61 for (DagInit::const_arg_iterator
62 AI = Expr->arg_begin(), AE = Expr->arg_end(); AI != AE; ++AI) {
63 StringInit *SI = dyn_cast(*AI);
64 if (!SI)
65 PrintFatalError(Loc, "instregex requires pattern string: "
66 + Expr->getAsString());
67 std::string pat = SI->getValue();
68 // Implement a python-style prefix match.
69 if (pat[0] != '^') {
70 pat.insert(0, "^(");
71 pat.insert(pat.end(), ')');
72 }
73 RegexList.push_back(new Regex(pat));
74 }
75 for (CodeGenTarget::inst_iterator I = Target.inst_begin(),
76 E = Target.inst_end(); I != E; ++I) {
77 for (SmallVectorImpl::iterator
78 RI = RegexList.begin(), RE = RegexList.end(); RI != RE; ++RI) {
79 if ((*RI)->match((*I)->TheDef->getName()))
80 Elts.insert((*I)->TheDef);
81 }
82 }
83 DeleteContainerPointers(RegexList);
84 }
6385 };
64
65 void InstRegexOp::apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts,
66 ArrayRef Loc) {
67 SmallVector RegexList;
68 for (DagInit::const_arg_iterator
69 AI = Expr->arg_begin(), AE = Expr->arg_end(); AI != AE; ++AI) {
70 StringInit *SI = dyn_cast(*AI);
71 if (!SI)
72 PrintFatalError(Loc, "instregex requires pattern string: "
73 + Expr->getAsString());
74 std::string pat = SI->getValue();
75 // Implement a python-style prefix match.
76 if (pat[0] != '^') {
77 pat.insert(0, "^(");
78 pat.insert(pat.end(), ')');
79 }
80 RegexList.push_back(new Regex(pat));
81 }
82 for (CodeGenTarget::inst_iterator I = Target.inst_begin(),
83 E = Target.inst_end(); I != E; ++I) {
84 for (SmallVectorImpl::iterator
85 RI = RegexList.begin(), RE = RegexList.end(); RI != RE; ++RI) {
86 if ((*RI)->match((*I)->TheDef->getName()))
87 Elts.insert((*I)->TheDef);
88 }
89 }
90 DeleteContainerPointers(RegexList);
91 }
9286
9387 /// CodeGenModels ctor interprets machine model records and populates maps.
9488 CodeGenSchedModels::CodeGenSchedModels(RecordKeeper &RK,
436436 OS << "namespace llvm {\n";
437437 OS << "struct " << ClassName << " : public TargetInstrInfo {\n"
438438 << " explicit " << ClassName << "(int SO = -1, int DO = -1);\n"
439 << " virtual ~" << ClassName << "();\n"
440439 << "};\n";
441440 OS << "} // End llvm namespace \n";
442441
443442 OS << "#endif // GET_INSTRINFO_HEADER\n\n";
444443
445 OS << "\n#ifdef GET_INSTRINFO_CTOR_DTOR\n";
446 OS << "#undef GET_INSTRINFO_CTOR_DTOR\n";
444 OS << "\n#ifdef GET_INSTRINFO_CTOR\n";
445 OS << "#undef GET_INSTRINFO_CTOR\n";
447446
448447 OS << "namespace llvm {\n";
449448 OS << "extern const MCInstrDesc " << TargetName << "Insts[];\n";
453452 << " : TargetInstrInfo(SO, DO) {\n"
454453 << " InitMCInstrInfo(" << TargetName << "Insts, "
455454 << TargetName << "InstrNameIndices, " << TargetName << "InstrNameData, "
456 << NumberedInstructions.size() << ");\n}\n"
457 << ClassName << "::~" << ClassName << "() {}\n";
455 << NumberedInstructions.size() << ");\n}\n";
458456 OS << "} // End llvm namespace \n";
459457
460 OS << "#endif // GET_INSTRINFO_CTOR_DTOR\n\n";
458 OS << "#endif // GET_INSTRINFO_CTOR\n\n";
461459
462460 emitOperandNameMappings(OS, Target, NumberedInstructions);
463461
2626
2727 // (add a, b, ...) Evaluate and union all arguments.
2828 struct AddOp : public SetTheory::Operator {
29 virtual void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts,
30 ArrayRef Loc) {
29 void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts, ArrayRef Loc) {
3130 ST.evaluate(Expr->arg_begin(), Expr->arg_end(), Elts, Loc);
3231 }
3332 };
3433
3534 // (sub Add, Sub, ...) Set difference.
3635 struct SubOp : public SetTheory::Operator {
37 virtual void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts,
38 ArrayRef Loc) {
36 void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts, ArrayRef Loc) {
3937 if (Expr->arg_size() < 2)
4038 PrintFatalError(Loc, "Set difference needs at least two arguments: " +
4139 Expr->getAsString());
5048
5149 // (and S1, S2) Set intersection.
5250 struct AndOp : public SetTheory::Operator {
53 virtual void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts,
54 ArrayRef Loc) {
51 void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts, ArrayRef Loc) {
5552 if (Expr->arg_size() != 2)
5653 PrintFatalError(Loc, "Set intersection requires two arguments: " +
5754 Expr->getAsString());
7067 RecSet &Set, int64_t N,
7168 RecSet &Elts, ArrayRef Loc) =0;
7269
73 virtual void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts,
74 ArrayRef Loc) {
70 void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts, ArrayRef Loc) {
7571 if (Expr->arg_size() != 2)
7672 PrintFatalError(Loc, "Operator requires (Op Set, Int) arguments: " +
7773 Expr->getAsString());
8783
8884 // (shl S, N) Shift left, remove the first N elements.
8985 struct ShlOp : public SetIntBinOp {
90 virtual void apply2(SetTheory &ST, DagInit *Expr,
91 RecSet &Set, int64_t N,
92 RecSet &Elts, ArrayRef Loc) {
86 void apply2(SetTheory &ST, DagInit *Expr,
87 RecSet &Set, int64_t N,
88 RecSet &Elts, ArrayRef Loc) {
9389 if (N < 0)
9490 PrintFatalError(Loc, "Positive shift required: " +
9591 Expr->getAsString());
10096
10197 // (trunc S, N) Truncate after the first N elements.
10298 struct TruncOp : public SetIntBinOp {
103 virtual void apply2(SetTheory &ST, DagInit *Expr,
104 RecSet &Set, int64_t N,
105 RecSet &Elts, ArrayRef Loc) {
99 void apply2(SetTheory &ST, DagInit *Expr,
100 RecSet &Set, int64_t N,
101 RecSet &Elts, ArrayRef Loc) {
106102 if (N < 0)
107103 PrintFatalError(Loc, "Positive length required: " +
108104 Expr->getAsString());
118114
119115 RotOp(bool Rev) : Reverse(Rev) {}
120116
121 virtual void apply2(SetTheory &ST, DagInit *Expr,
122 RecSet &Set, int64_t N,
123 RecSet &Elts, ArrayRef Loc) {
117 void apply2(SetTheory &ST, DagInit *Expr,
118 RecSet &Set, int64_t N,
119 RecSet &Elts, ArrayRef Loc) {
124120 if (Reverse)
125121 N = -N;
126122 // N > 0 -> rotate left, N < 0 -> rotate right.
137133
138134 // (decimate S, N) Pick every N'th element of S.
139135 struct DecimateOp : public SetIntBinOp {
140 virtual void apply2(SetTheory &ST, DagInit *Expr,
141 RecSet &Set, int64_t N,
142 RecSet &Elts, ArrayRef Loc) {
136 void apply2(SetTheory &ST, DagInit *Expr,
137 RecSet &Set, int64_t N,
138 RecSet &Elts, ArrayRef Loc) {
143139 if (N <= 0)
144140 PrintFatalError(Loc, "Positive stride required: " +
145141 Expr->getAsString());
150146
151147 // (interleave S1, S2, ...) Interleave elements of the arguments.
152148 struct InterleaveOp : public SetTheory::Operator {
153 virtual void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts,
154 ArrayRef Loc) {
149 void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts, ArrayRef Loc) {
155150 // Evaluate the arguments individually.
156151 SmallVector Args(Expr->getNumArgs());
157152 unsigned MaxSize = 0;
169164
170165 // (sequence "Format", From, To) Generate a sequence of records by name.
171166 struct SequenceOp : public SetTheory::Operator {
172 virtual void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts,
173 ArrayRef Loc) {
167 void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts, ArrayRef Loc) {
174168 int Step = 1;
175169 if (Expr->arg_size() > 4)
176170 PrintFatalError(Loc, "Bad args to (sequence \"Format\", From, To): " +
237231
238232 FieldExpander(StringRef fn) : FieldName(fn) {}
239233
240 virtual void expand(SetTheory &ST, Record *Def, RecSet &Elts) {
234 void expand(SetTheory &ST, Record *Def, RecSet &Elts) {
241235 ST.evaluate(Def->getValueInit(FieldName), Elts, Def->getLoc());
242236 }
243237 };
244238 } // end anonymous namespace
245239
246 // pin vtables to this file
247 void SetTheory::Operator::anchor() {}
248 void SetTheory::Expander::anchor() {}
249
240 void SetTheory::Operator::anchor() { }
241
242 void SetTheory::Expander::anchor() { }
250243
251244 SetTheory::SetTheory() {
252245 addOperator("add", new AddOp);
3434 }
3535 Type(TypeKind K) : Kind(K) {}
3636 virtual unsigned getSizeInBits() const = 0;
37 virtual ~Type();
37 virtual ~Type() {}
3838 };
39
40 Type::~Type() {}
4139
4240 }
4341
4644 public:
4745 explicit ExtendedIntegerType(unsigned bits)
4846 : Type(TK_ExtendedIntegerType), BitWidth(bits) {}
49 virtual ~ExtendedIntegerType();
5047 static bool classof(const Type *T) {
5148 return T->getKind() == TK_ExtendedIntegerType;
5249 }
53 virtual unsigned getSizeInBits() const {
50 unsigned getSizeInBits() const {
5451 return getBitWidth();
5552 }
5653 unsigned getBitWidth() const {
5855 }
5956 };
6057
61 ExtendedIntegerType::~ExtendedIntegerType() {}
62
63
6458 class ExtendedVectorType : public Type {
6559 EVT ElementType;
6660 unsigned NumElements;
6761 public:
6862 ExtendedVectorType(EVT elty, unsigned num)
6963 : Type(TK_ExtendedVectorType), ElementType(elty), NumElements(num) {}
70 virtual ~ExtendedVectorType();
7164 static bool classof(const Type *T) {
7265 return T->getKind() == TK_ExtendedVectorType;
7366 }
74 virtual unsigned getSizeInBits() const {
67 unsigned getSizeInBits() const {
7568 return getNumElements() * getElementType().getSizeInBits();
7669 }
7770 EVT getElementType() const {
8174 return NumElements;
8275 }
8376 };
84
85 ExtendedVectorType::~ExtendedVectorType() {}
86
8777
8878 static std::map
8979 ExtendedIntegerTypeMap;
141141 // This interface knows how to report a test part result.
142142 class TestPartResultReporterInterface {
143143 public:
144 virtual ~TestPartResultReporterInterface();
144 virtual ~TestPartResultReporterInterface() {}
145145
146146 virtual void ReportTestPartResult(const TestPartResult& result) = 0;
147147 };
909909 class Environment {
910910 public:
911911 // The d'tor is virtual as we need to subclass Environment.
912 virtual ~Environment();
912 virtual ~Environment() {}
913913
914914 // Override this to define how to set up the environment.
915915 virtual void SetUp() {}
927927 // the order the corresponding events are fired.
928928 class TestEventListener {
929929 public:
930 virtual ~TestEventListener();
930 virtual ~TestEventListener() {}
931931
932932 // Fired before any test activity starts.
933933 virtual void OnTestProgramStart(const UnitTest& unit_test) = 0;
979979 // comments about each method please see the definition of TestEventListener
980980 // above.
981981 class EmptyTestEventListener : public TestEventListener {
982 virtual void anchor();
983982 public:
984983 virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) {}
985984 virtual void OnTestIterationStart(const UnitTest& /*unit_test*/,
7878 static bool Create(const char* statement, const RE* regex,
7979 const char* file, int line, DeathTest** test);
8080 DeathTest();
81 virtual ~DeathTest();
81 virtual ~DeathTest() { }
8282
8383 // A helper class that aborts a death test when it's deleted.
8484 class ReturnSentinel {
138138 // Factory interface for death tests. May be mocked out for testing.
139139 class DeathTestFactory {
140140 public:
141 virtual ~DeathTestFactory();
141 virtual ~DeathTestFactory() { }
142142 virtual bool Create(const char* statement, const RE* regex,
143143 const char* file, int line, DeathTest** test) = 0;
144144 };
104104 #if !GTEST_NO_LLVM_RAW_OSTREAM
105105 namespace llvm {
106106 class convertible_fwd_ostream : public std::ostream {
107 virtual void anchor();
108107 raw_os_ostream ros_;
109108
110109 public:
536535 // of a Test object.
537536 class TestFactoryBase {
538537 public:
539 virtual ~TestFactoryBase();
538 virtual ~TestFactoryBase() {}
540539
541540 // Creates a test instance to run. The instance is both created and destroyed
542541 // within TestInfoImpl::Run()
413413 // and calls RegisterTests() on each of them when asked.
414414 class ParameterizedTestCaseInfoBase {
415415 public:
416 virtual ~ParameterizedTestCaseInfoBase();
416 virtual ~ParameterizedTestCaseInfoBase() {}
417417
418418 // Base part of test case name for display purposes.
419419 virtual const string& GetTestCaseName() const = 0;
11151115 // problem.
11161116 class ThreadWithParamBase {
11171117 public:
1118 virtual ~ThreadWithParamBase();
1118 virtual ~ThreadWithParamBase() {}
11191119 virtual void Run() = 0;
11201120 };
11211121
12891289 // ThreadLocalValueHolderBase.
12901290 class ThreadLocalValueHolderBase {
12911291 public:
1292 virtual ~ThreadLocalValueHolderBase();
1292 virtual ~ThreadLocalValueHolderBase() {}
12931293 };
12941294
12951295 // Called by pthread to delete thread-local data stored by
298298 "TEST_F construct");
299299 }
300300 }
301
302 DeathTest::~DeathTest() {}
303301
304302 // Creates and returns a death test by dispatching to the current
305303 // death test factory.
407407 class OsStackTraceGetterInterface {
408408 public:
409409 OsStackTraceGetterInterface() {}
410 virtual ~OsStackTraceGetterInterface();
410 virtual ~OsStackTraceGetterInterface() {}
411411
412412 // Returns the current OS stack trace as a String. Parameters:
413413 //
745745 return value == NULL ? default_value : value;
746746 }
747747
748 #if GTEST_HAS_PTHREAD
749 ThreadWithParamBase::~ThreadWithParamBase() {}
750 ThreadLocalValueHolderBase::~ThreadLocalValueHolderBase() {}
751 #endif
752 TestFactoryBase::~TestFactoryBase() {}
753
754748 } // namespace internal
755749 } // namespace testing
756
757 #if !GTEST_NO_LLVM_RAW_OSTREAM
758 namespace llvm {
759 void convertible_fwd_ostream::anchor() {}
760 }
761 #endif
48624862 internal::InitGoogleTestImpl(argc, argv);
48634863 }
48644864
4865 Environment::~Environment() {}
4866 TestPartResultReporterInterface::~TestPartResultReporterInterface() {}
4867 TestEventListener::~TestEventListener() {}
4868 void EmptyTestEventListener::anchor() {}
4869 namespace internal {
4870 OsStackTraceGetterInterface::~OsStackTraceGetterInterface() {}
4871 ParameterizedTestCaseInfoBase::~ParameterizedTestCaseInfoBase() {}
4872 }
4873
48744865 } // namespace testing