llvm.org GIT mirror llvm / 3543625
[weak vtables] Remove a bunch of weak vtables This patch removes most of the trivial cases of weak vtables by pinning them to a single object file. The memory leaks in this version have been fixed. Thanks Alexey for pointing them out. Differential Revision: http://llvm-reviews.chandlerc.com/D2068 Reviewed by Andy git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195064 91177308-0d34-0410-b5e6-96231b3b80d8 Juergen Ributzka 5 years ago
113 changed file(s) with 508 addition(s) and 154 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 };
15811581
1582 // Provide out-of-line definition to prevent weak vtable.
1583 OurCppRunException::~OurCppRunException() throw () {}
15821584
15831585 /// Throws foreign C++ exception.
15841586 /// @param ignoreIt unused parameter that allows function to match implied
7878 /// ExprAST - Base class for all expression nodes.
7979 class ExprAST {
8080 public:
81 virtual ~ExprAST() {}
81 virtual ~ExprAST();
8282 };
8383
8484 /// NumberExprAST - Expression class for numeric literals like "1.0".
8585 class NumberExprAST : public ExprAST {
8686 public:
8787 NumberExprAST(double val) {}
88 virtual ~NumberExprAST();
8889 };
8990
9091 /// VariableExprAST - Expression class for referencing a variable, like "a".
9293 std::string Name;
9394 public:
9495 VariableExprAST(const std::string &name) : Name(name) {}
96 virtual ~VariableExprAST();
9597 };
9698
9799 /// BinaryExprAST - Expression class for a binary operator.
98100 class BinaryExprAST : public ExprAST {
99101 public:
100102 BinaryExprAST(char op, ExprAST *lhs, ExprAST *rhs) {}
103 virtual ~BinaryExprAST();
101104 };
102105
103106 /// CallExprAST - Expression class for function calls.
107110 public:
108111 CallExprAST(const std::string &callee, std::vector &args)
109112 : Callee(callee), Args(args) {}
110 };
113 virtual ~CallExprAST();
114 };
115
116 // Provide out-of-line definitions to prevent weak vtables.
117 ExprAST::~ExprAST() {}
118 NumberExprAST::~NumberExprAST() {}
119 VariableExprAST::~VariableExprAST() {}
120 BinaryExprAST::~BinaryExprAST() {}
121 CallExprAST::~CallExprAST() {}
111122
112123 /// PrototypeAST - This class represents the "prototype" for a function,
113124 /// 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 // Provide out-of-line definition to prevent weak vtable.
91 ExprAST::~ExprAST() {}
8992
9093 /// NumberExprAST - Expression class for numeric literals like "1.0".
9194 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 // Provide out-of-line definition to prevent weak vtable.
98 ExprAST::~ExprAST() {}
9699
97100 /// NumberExprAST - Expression class for numeric literals like "1.0".
98101 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 // Provide out-of-line definition to prevent weak vtable.
107 ExprAST::~ExprAST() {}
105108
106109 /// NumberExprAST - Expression class for numeric literals like "1.0".
107110 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 // Provide out-of-line definition to prevent weak vtable.
112 ExprAST::~ExprAST() {}
110113
111114 /// NumberExprAST - Expression class for numeric literals like "1.0".
112115 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 // Provide out-of-line definition to prevent weak vtable.
116 ExprAST::~ExprAST() {}
114117
115118 /// NumberExprAST - Expression class for numeric literals like "1.0".
116119 class NumberExprAST : public ExprAST {
2929 class MachineRegisterInfo {
3030 public:
3131 class Delegate {
32 virtual void anchor();
3233 public:
33 virtual void MRI_NoteNewVirtualRegister(unsigned Reg) {}
34 virtual void MRI_NoteNewVirtualRegister(unsigned Reg) = 0;
3435
3536 virtual ~Delegate() {}
3637 };
163163 /// Initialization sequence:
164164 /// initPolicy -> shouldTrackPressure -> initialize(DAG) -> registerRoots
165165 class MachineSchedStrategy {
166 virtual void anchor();
166167 public:
167168 virtual ~MachineSchedStrategy() {}
168169
261262
262263 /// Mutate the DAG as a postpass after normal DAG building.
263264 class ScheduleDAGMutation {
265 virtual void anchor();
264266 public:
265267 virtual ~ScheduleDAGMutation() {}
266268
2929 /// ObjectFile) as needed, but the MemoryBuffer instance returned does not own the
3030 /// actual memory it points to.
3131 class ObjectBuffer {
32 virtual void anchor();
3233 public:
3334 ObjectBuffer() {}
3435 ObjectBuffer(MemoryBuffer* Buf) : Buffer(Buf) {}
5556 /// while providing a common ObjectBuffer interface for access to the
5657 /// memory once the object has been generated.
5758 class ObjectBufferStream : public ObjectBuffer {
59 virtual void anchor();
5860 public:
5961 ObjectBufferStream() : OS(SV) {}
6062 virtual ~ObjectBufferStream() {}
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();
2223 public:
2324 ObjectCache() { }
2425
2424 class ObjectImage {
2525 ObjectImage() LLVM_DELETED_FUNCTION;
2626 ObjectImage(const ObjectImage &other) LLVM_DELETED_FUNCTION;
27 virtual void anchor();
2728
2829 protected:
2930 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();
3435 public:
3536 virtual ~MCAtom() {}
3637
7575 // FIXME: declared here because it is used from
7676 // lib/CodeGen/AsmPrinter/ARMException.cpp.
7777 class ARMTargetStreamer : public MCTargetStreamer {
78 virtual void anchor();
7879 public:
7980 virtual void emitFnStart() = 0;
8081 virtual void emitFnEnd() = 0;
1616 class raw_ostream;
1717
1818 class MCWinCOFFObjectTargetWriter {
19 virtual void anchor();
1920 const unsigned Machine;
2021
2122 protected:
349349 struct GenericOptionValue {
350350 virtual ~GenericOptionValue() {}
351351 virtual bool compare(const GenericOptionValue &V) const = 0;
352
353 private:
354 virtual void anchor();
352355 };
353356
354357 template struct OptionValue;
17511754 /// \brief Saves strings in the inheritor's stable storage and returns a stable
17521755 /// raw character pointer.
17531756 class StringSaver {
1757 virtual void anchor();
17541758 public:
17551759 virtual const char *SaveString(const char *Str) = 0;
17561760 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();
341342 protected:
342343 CallbackVH(const CallbackVH &RHS)
343344 : ValueHandleBase(Callback, RHS) {}
364365 ///
365366 /// All implementations must remove the reference from this object to the
366367 /// Value that's being destroyed.
367 virtual void deleted();
368 virtual void deleted() { setValPtr(NULL); }
368369
369370 /// Called when this->getValPtr()->replaceAllUsesWith(new_value) is called,
370371 /// _before_ any of the uses have actually been replaced. If WeakVH were
371372 /// implemented as a CallbackVH, it would use this method to call
372373 /// setValPtr(new_value). AssertingVH would do nothing in this method.
373 virtual void allUsesReplacedWith(Value *);
374 virtual void allUsesReplacedWith(Value *) {}
374375 };
375376
376377 } // End llvm namespace
104104
105105 /// @brief Abstract base class for all Nodes.
106106 class Node {
107 virtual void anchor();
107108 public:
108109 enum NodeKind {
109110 NK_Null,
174175 /// Example:
175176 /// !!null null
176177 class NullNode : public Node {
178 virtual void anchor();
177179 public:
178180 NullNode(OwningPtr &D)
179181 : Node(NK_Null, D, StringRef(), StringRef()) {}
189191 /// Example:
190192 /// Adena
191193 class ScalarNode : public Node {
194 virtual void anchor();
192195 public:
193196 ScalarNode(OwningPtr &D, StringRef Anchor, StringRef Tag,
194197 StringRef Val)
230233 /// Example:
231234 /// Section: .text
232235 class KeyValueNode : public Node {
236 virtual void anchor();
233237 public:
234238 KeyValueNode(OwningPtr &D)
235239 : Node(NK_KeyValue, D, StringRef(), StringRef())
341345 /// Name: _main
342346 /// Scope: Global
343347 class MappingNode : public Node {
348 virtual void anchor();
344349 public:
345350 enum MappingType {
346351 MT_Block,
390395 /// - Hello
391396 /// - World
392397 class SequenceNode : public Node {
398 virtual void anchor();
393399 public:
394400 enum SequenceType {
395401 ST_Block,
445451 /// Example:
446452 /// *AnchorName
447453 class AliasNode : public Node {
454 virtual void anchor();
448455 public:
449456 AliasNode(OwningPtr &D, StringRef Val)
450457 : Node(NK_Alias, D, StringRef(), StringRef()), Name(Val) {}
724724 virtual bool canElideEmptySequence();
725725
726726 class HNode {
727 virtual void anchor();
727728 public:
728729 HNode(Node *n) : _node(n) { }
729730 virtual ~HNode() { }
733734 };
734735
735736 class EmptyHNode : public HNode {
737 virtual void anchor();
736738 public:
737739 EmptyHNode(Node *n) : HNode(n) { }
738 virtual ~EmptyHNode() {}
739740 static inline bool classof(const HNode *n) {
740741 return NullNode::classof(n->_node);
741742 }
743744 };
744745
745746 class ScalarHNode : public HNode {
747 virtual void anchor();
746748 public:
747749 ScalarHNode(Node *n, StringRef s) : HNode(n), _value(s) { }
748 virtual ~ScalarHNode() { }
749750
750751 StringRef value() const { return _value; }
751752
1717 #include "llvm/Support/raw_os_ostream.h"
1818
1919 using namespace llvm;
20
21 // Pin the vtable to this file.
22 void MachineRegisterInfo::Delegate::anchor() {}
2023
2124 MachineRegisterInfo::MachineRegisterInfo(const TargetMachine &TM)
2225 : 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 the vtables to this file.
75 void MachineSchedStrategy::anchor() {}
76 void ScheduleDAGMutation::anchor() {}
7377
7478 //===----------------------------------------------------------------------===//
7579 // Machine Instruction Scheduling Pass and Registry
4848 //===----------------------------------------------------------------------===//
4949 // RegAllocBase Implementation
5050 //===----------------------------------------------------------------------===//
51
52 // Pin the vtable to this file.
53 void RegAllocBase::anchor() {}
5154
5255 void RegAllocBase::init(VirtRegMap &vrm,
5356 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();
5960 protected:
6061 const TargetRegisterInfo *TRI;
6162 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"
1718 #include "llvm/ADT/SmallString.h"
1819 #include "llvm/ADT/Statistic.h"
1920 #include "llvm/ExecutionEngine/GenericValue.h"
3738
3839 STATISTIC(NumInitBytes, "Number of bytes of global vars initialized");
3940 STATISTIC(NumGlobals , "Number of global vars initialized");
41
42 // Pin the vtable to this file.
43 void ObjectCache::anchor() {}
44 void ObjectBuffer::anchor() {}
45 void ObjectBufferStream::anchor() {}
4046
4147 ExecutionEngine *(*ExecutionEngine::JITCtor)(
4248 Module *M,
1515
1616 /// Global access point for the JIT debugging interface.
1717 class JITRegistrar {
18 virtual void anchor();
1819 public:
1920 /// Instantiates the JIT service.
2021 JITRegistrar() {}
2222 class ObjectImageCommon : public ObjectImage {
2323 ObjectImageCommon(); // = delete
2424 ObjectImageCommon(const ObjectImageCommon &other); // = delete
25 virtual void anchor();
2526
2627 protected:
2728 object::ObjectFile *ObjFile;
1212
1313 #define DEBUG_TYPE "dyld"
1414 #include "llvm/ExecutionEngine/RuntimeDyld.h"
15 #include "JITRegistrar.h"
1516 #include "ObjectImageCommon.h"
1617 #include "RuntimeDyldELF.h"
1718 #include "RuntimeDyldImpl.h"
2627
2728 // Empty out-of-line virtual destructor as the key function.
2829 RuntimeDyldImpl::~RuntimeDyldImpl() {}
30
31 // Pin the JITRegistrar's and ObjectImage*'s vtables to this file.
32 void JITRegistrar::anchor() {}
33 void ObjectImage::anchor() {}
34 void ObjectImageCommon::anchor() {}
2935
3036 namespace llvm {
3137
9393 /// attribute enties, which are for target-dependent attributes.
9494
9595 class EnumAttributeImpl : public AttributeImpl {
96 virtual void anchor();
9697 Attribute::AttrKind Kind;
9798
9899 protected:
107108 };
108109
109110 class AlignAttributeImpl : public EnumAttributeImpl {
111 virtual void anchor();
110112 unsigned Align;
111113
112114 public:
121123 };
122124
123125 class StringAttributeImpl : public AttributeImpl {
126 virtual void anchor();
124127 std::string Kind;
125128 std::string Val;
126129
285285 // AttributeImpl Definition
286286 //===----------------------------------------------------------------------===//
287287
288 // Pin the vtabels to this file.
288289 AttributeImpl::~AttributeImpl() {}
290 void EnumAttributeImpl::anchor() {}
291 void AlignAttributeImpl::anchor() {}
292 void StringAttributeImpl::anchor() {}
289293
290294 bool AttributeImpl::hasAttribute(Attribute::AttrKind A) const {
291295 if (isStringAttribute()) return false;
6464
6565 public:
6666 MDNodeOperand(Value *V) : CallbackVH(V) {}
67 ~MDNodeOperand() {}
67 virtual ~MDNodeOperand();
6868
6969 void set(Value *V) {
7070 unsigned IsFirst = this->getValPtrInt();
8181 };
8282 } // end namespace llvm.
8383
84 // Provide out-of-line definition to prevent weak vtable.
85 MDNodeOperand::~MDNodeOperand() {}
8486
8587 void MDNodeOperand::deleted() {
8688 getParent()->replaceOperand(this, 0);
734734 #endif
735735 }
736736
737 // Default implementation for CallbackVH.
738 void CallbackVH::allUsesReplacedWith(Value *) {}
739
740 void CallbackVH::deleted() {
741 setValPtr(NULL);
742 }
737 // Pin the vtable to this file.
738 void CallbackVH::anchor() {}
1212 #include
1313
1414 using namespace llvm;
15
16 // Pin the vtable to this file.
17 void MCAtom::anchor() {}
1518
1619 void MCAtom::remap(uint64_t NewBegin, uint64_t NewEnd) {
1720 Parent->remap(this, NewBegin, NewEnd);
2121 #include
2222 using namespace llvm;
2323
24 // Pin the vtables to this file.
2425 MCTargetStreamer::~MCTargetStreamer() {}
26 void ARMTargetStreamer::anchor() {}
2527
2628 MCStreamer::MCStreamer(MCContext &Ctx, MCTargetStreamer *TargetStreamer)
2729 : Context(Ctx), TargetStreamer(TargetStreamer), EmitEHFrame(true),
137137 symbol_map SymbolMap;
138138
139139 WinCOFFObjectWriter(MCWinCOFFObjectTargetWriter *MOTW, raw_ostream &OS);
140 ~WinCOFFObjectWriter();
140 virtual ~WinCOFFObjectWriter();
141141
142142 COFFSymbol *createSymbol(StringRef Name);
143143 COFFSymbol *GetOrCreateCOFFSymbol(const MCSymbol * Symbol);
914914 Machine(Machine_) {
915915 }
916916
917 // Pin the vtable to this file.
918 void MCWinCOFFObjectTargetWriter::anchor() {}
919
917920 //------------------------------------------------------------------------------
918921 // WinCOFFObjectWriter factory function
919922
5959 TEMPLATE_INSTANTIATION(class opt);
6060 } } // end namespace llvm::cl
6161
62 // Pin the vtables to this file.
63 void GenericOptionValue::anchor() {}
6264 void OptionValue::anchor() {}
6365 void OptionValue::anchor() {}
6466 void Option::anchor() {}
7274 void parser::anchor() {}
7375 void parser::anchor() {}
7476 void parser::anchor() {}
77 void StringSaver::anchor() {}
7578
7679 //===----------------------------------------------------------------------===//
7780
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
98107 /// Token - A single YAML token.
99108 struct Token : ilist_node {
100109 enum TokenKind {
5858 error_code Input::error() {
5959 return EC;
6060 }
61
62 // Pin the vtables to this file.
63 void Input::HNode::anchor() {}
64 void Input::EmptyHNode::anchor() {}
65 void Input::ScalarHNode::anchor() {}
6166
6267 bool Input::outputting() const {
6368 return false;
2828
2929 #include
3030
31 #define GET_INSTRINFO_CTOR
31 #define GET_INSTRINFO_CTOR_DTOR
3232 #include "AArch64GenInstrInfo.inc"
3333
3434 using namespace llvm;
2323 #include "AArch64GenSubtargetInfo.inc"
2424
2525 using namespace llvm;
26
27 // Pin the vtable to this file.
28 void AArch64Subtarget::anchor() {}
2629
2730 AArch64Subtarget::AArch64Subtarget(StringRef TT, StringRef CPU, StringRef FS)
2831 : AArch64GenSubtargetInfo(TT, CPU, FS), HasFPARMv8(false), HasNEON(false),
2626 class GlobalValue;
2727
2828 class AArch64Subtarget : public AArch64GenSubtargetInfo {
29 virtual void anchor();
2930 protected:
3031 bool HasFPARMv8;
3132 bool HasNEON;
3636 // Exceptions handling
3737 ExceptionsType = ExceptionHandling::DwarfCFI;
3838 }
39
40 // Pin the vtable to this file.
41 void AArch64ELFMCAsmInfo::anchor() {}
1717
1818 namespace llvm {
1919
20 struct AArch64ELFMCAsmInfo : public MCAsmInfoELF {
21 explicit AArch64ELFMCAsmInfo();
22 };
20 struct AArch64ELFMCAsmInfo : public MCAsmInfoELF {
21 explicit AArch64ELFMCAsmInfo();
22 private:
23 virtual void anchor();
24 };
2325
2426 } // namespace llvm
2527
3636 #include "llvm/Support/Debug.h"
3737 #include "llvm/Support/ErrorHandling.h"
3838
39 #define GET_INSTRINFO_CTOR
39 #define GET_INSTRINFO_CTOR_DTOR
4040 #include "ARMGenInstrInfo.inc"
4141
4242 using namespace llvm;
1616 HexagonFrameLowering.cpp
1717 HexagonHardwareLoops.cpp
1818 HexagonFixupHwLoops.cpp
19 HexagonMachineFunctionInfo.cpp
1920 HexagonMachineScheduler.cpp
2021 HexagonMCInstLower.cpp
2122 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
28 #define GET_INSTRINFO_CTOR_DTOR
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 the vtable to this file.
58 void HexagonInstrInfo::anchor() {}
5759
5860 HexagonInstrInfo::HexagonInstrInfo(HexagonSubtarget &ST)
5961 : HexagonGenInstrInfo(Hexagon::ADJCALLSTACKDOWN, Hexagon::ADJCALLSTACKUP),
2525 namespace llvm {
2626
2727 class HexagonInstrInfo : public HexagonGenInstrInfo {
28 virtual void anchor();
2829 const HexagonRegisterInfo RI;
2930 const HexagonSubtarget &Subtarget;
3031 typedef unsigned Opcode_t;
0 //= 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 //=- HexagonMachineFuctionInfo.h - Hexagon machine function info --*- C++ -*-=//
0 //=- HexagonMachineFunctionInfo.h - Hexagon machine function info -*- C++ -*-=//
11 //
22 // The LLVM Compiler Infrastructure
33 //
99 #ifndef HexagonMACHINEFUNCTIONINFO_H
1010 #define HexagonMACHINEFUNCTIONINFO_H
1111
12 #include
1213 #include "llvm/CodeGen/MachineFunction.h"
1314
1415 namespace llvm {
2930 int VarArgsFrameIndex;
3031 bool HasClobberLR;
3132 bool HasEHReturn;
32
3333 std::map PacketInfo;
34
34 virtual void anchor();
3535
3636 public:
3737 HexagonMachineFunctionInfo() : SRetReturnReg(0), HasClobberLR(0),
8585 ModeIEEERndNear = false;
8686 }
8787
88 // Pin the vtable to this file.
89 void HexagonSubtarget::anchor() {}
2626 namespace llvm {
2727
2828 class HexagonSubtarget : public HexagonGenSubtargetInfo {
29
29 virtual void anchor();
3030 bool UseMemOps;
3131 bool ModeIEEERndNear;
3232
1313 #include "HexagonMCAsmInfo.h"
1414
1515 using namespace llvm;
16
17 // Pin the vtable to this file.
18 void HexagonMCAsmInfo::anchor() {}
1619
1720 HexagonMCAsmInfo::HexagonMCAsmInfo(StringRef TT) {
1821 Data16bitsDirective = "\t.half\t";
1818
1919 namespace llvm {
2020 class HexagonMCAsmInfo : public MCAsmInfoELF {
21 virtual void anchor();
2122 public:
2223 explicit HexagonMCAsmInfo(StringRef TT);
2324 };
2121 #include "llvm/Support/ErrorHandling.h"
2222 #include "llvm/Support/TargetRegistry.h"
2323
24 #define GET_INSTRINFO_CTOR
24 #define GET_INSTRINFO_CTOR_DTOR
2525 #include "MSP430GenInstrInfo.inc"
2626
2727 using namespace llvm;
28
29 // Pin the vtable to this file.
30 void MSP430InstrInfo::anchor() {}
2831
2932 MSP430InstrInfo::MSP430InstrInfo(MSP430TargetMachine &tm)
3033 : MSP430GenInstrInfo(MSP430::ADJCALLSTACKDOWN, MSP430::ADJCALLSTACKUP),
4141
4242 class MSP430InstrInfo : public MSP430GenInstrInfo {
4343 const MSP430RegisterInfo RI;
44 virtual void anchor();
4445 public:
4546 explicit MSP430InstrInfo(MSP430TargetMachine &TM);
4647
2121 #include "llvm/Support/ErrorHandling.h"
2222 #include "llvm/Support/TargetRegistry.h"
2323
24 #define GET_INSTRINFO_CTOR
24 #define GET_INSTRINFO_CTOR_DTOR
2525 #include "MipsGenInstrInfo.inc"
2626
2727 using namespace llvm;
28
29 // Pin the vtable to this file.
30 void MipsInstrInfo::anchor() {}
2831
2932 MipsInstrInfo::MipsInstrInfo(MipsTargetMachine &tm, unsigned UncondBr)
3033 : MipsGenInstrInfo(Mips::ADJCALLSTACKDOWN, Mips::ADJCALLSTACKUP),
2626 namespace llvm {
2727
2828 class MipsInstrInfo : public MipsGenInstrInfo {
29 virtual void anchor();
2930 protected:
3031 MipsTargetMachine &TM;
3132 unsigned UncondBrOpc;
1515 namespace llvm {
1616 class MipsTargetStreamer : public MCTargetStreamer {
1717 virtual void anchor();
18
1918 public:
2019 virtual void emitMipsHackELFFlags(unsigned Flags) = 0;
2120 virtual void emitMipsHackSTOCG(MCSymbol *Sym, unsigned Val) = 0;
22872287 return;
22882288 }
22892289 }
2290
2291 // Pin NVPTXSection's and NVPTXTargetObjectFile's 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
16 #define GET_INSTRINFO_CTOR_DTOR
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 the vtable to this file.
27 void NVPTXInstrInfo::anchor() {}
2528
2629 // FIXME: Add the subtarget support on this constructor.
2730 NVPTXInstrInfo::NVPTXInstrInfo(NVPTXTargetMachine &tm)
2525 class NVPTXInstrInfo : public NVPTXGenInstrInfo {
2626 NVPTXTargetMachine &TM;
2727 const NVPTXRegisterInfo RegInfo;
28 virtual void anchor();
2829 public:
2930 explicit NVPTXInstrInfo(NVPTXTargetMachine &TM);
3031
2323 /// the ASMPrint interface.
2424 ///
2525 class NVPTXSection : public MCSection {
26
26 virtual void anchor();
2727 public:
2828 NVPTXSection(SectionVariant V, SectionKind K) : MCSection(V, K) {}
29 ~NVPTXSection() {}
29 virtual ~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 the vtable to this file.
23 void NVPTXSubtarget::anchor() {}
2124
2225 NVPTXSubtarget::NVPTXSubtarget(const std::string &TT, const std::string &CPU,
2326 const std::string &FS, bool is64Bit)
2424 namespace llvm {
2525
2626 class NVPTXSubtarget : public NVPTXGenSubtargetInfo {
27
27 virtual void anchor();
2828 std::string TargetName;
2929 NVPTX::DrvInterface drvInterface;
3030 bool Is64Bit;
4343 DwarfMacroInfoSection = 0;
4444 }
4545
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 }
46 virtual ~NVPTXTargetObjectFile();
6847
6948 virtual void Initialize(MCContext &ctx, const TargetMachine &TM) {
7049 TargetLoweringObjectFile::Initialize(ctx, TM);
3535 #include "PPCGenRegisterInfo.inc"
3636
3737 using namespace llvm;
38
39 // Pin the vtable to this file.
40 PPCTargetStreamer::~PPCTargetStreamer() {}
3841
3942 static MCInstrInfo *createPPCMCInstrInfo() {
4043 MCInstrInfo *X = new MCInstrInfo();
3232 #include "llvm/Support/raw_ostream.h"
3333
3434 #define GET_INSTRMAP_INFO
35 #define GET_INSTRINFO_CTOR
35 #define GET_INSTRINFO_CTOR_DTOR
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 the vtable to this file.
48 void PPCInstrInfo::anchor() {}
4649
4750 PPCInstrInfo::PPCInstrInfo(PPCTargetMachine &tm)
4851 : PPCGenInstrInfo(PPC::ADJCALLSTACKDOWN, PPC::ADJCALLSTACKUP),
7777 const TargetRegisterClass *RC,
7878 SmallVectorImpl &NewMIs,
7979 bool &NonRI, bool &SpillsVRS) const;
80 virtual void anchor();
8081 public:
8182 explicit PPCInstrInfo(PPCTargetMachine &TM);
8283
1414 namespace llvm {
1515 class PPCTargetStreamer : public MCTargetStreamer {
1616 public:
17 virtual ~PPCTargetStreamer();
1718 virtual void emitTCEntry(const MCSymbol &S) = 0;
1819 };
1920 }
1919 #include "llvm/CodeGen/MachineInstrBuilder.h"
2020 #include "llvm/CodeGen/MachineRegisterInfo.h"
2121
22 #define GET_INSTRINFO_CTOR
22 #define GET_INSTRINFO_CTOR_DTOR
2323 #define GET_INSTRINFO_NAMED_OPS
2424 #define GET_INSTRMAP_INFO
2525 #include "AMDGPUGenInstrInfo.inc"
2626
2727 using namespace llvm;
28
29
30 // Pin the vtable to this file.
31 void AMDGPUInstrInfo::anchor() {}
2832
2933 AMDGPUInstrInfo::AMDGPUInstrInfo(TargetMachine &tm)
3034 : 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();
4546 protected:
4647 TargetMachine &TM;
4748 public:
44 using namespace llvm;
55
66 static const char *const ShaderTypeAttribute = "ShaderType";
7
8 // Pin the vtable to this file.
9 void AMDGPUMachineFunction::anchor() {}
710
811 AMDGPUMachineFunction::AMDGPUMachineFunction(const MachineFunction &MF) :
912 MachineFunctionInfo() {
1818 namespace llvm {
1919
2020 class AMDGPUMachineFunction : public MachineFunctionInfo {
21 virtual void anchor();
2122 public:
2223 AMDGPUMachineFunction(const MachineFunction &MF);
2324 unsigned ShaderType;
0 //===-- 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();
2627 public:
2728
2829 uint64_t getBinaryCodeForInstr(const MCInst &MI,
11 add_llvm_library(LLVMR600Desc
22 AMDGPUAsmBackend.cpp
33 AMDGPUELFObjectWriter.cpp
4 AMDGPUMCCodeEmitter.cpp
45 AMDGPUMCTargetDesc.cpp
56 AMDGPUMCAsmInfo.cpp
67 R600MCCodeEmitter.cpp
2222 #include "llvm/CodeGen/MachineInstrBuilder.h"
2323 #include "llvm/CodeGen/MachineRegisterInfo.h"
2424
25 #define GET_INSTRINFO_CTOR
25 #define GET_INSTRINFO_CTOR_DTOR
2626 #include "AMDGPUGenDFAPacketizer.inc"
2727
2828 using namespace llvm;
1111
1212 using namespace llvm;
1313
14
15 // Pin the vtable to this file.
16 void R600MachineFunctionInfo::anchor() {}
17
1418 R600MachineFunctionInfo::R600MachineFunctionInfo(const MachineFunction &MF)
1519 : AMDGPUMachineFunction(MF) { }
16
17
2020 namespace llvm {
2121
2222 class R600MachineFunctionInfo : public AMDGPUMachineFunction {
23 virtual void anchor();
2324 public:
2425 R600MachineFunctionInfo(const MachineFunction &MF);
2526 SmallVector LiveOuts;
1212
1313 using namespace llvm;
1414
15
16 // Pin the vtable to this file.
17 void SIMachineFunctionInfo::anchor() {}
18
1519 SIMachineFunctionInfo::SIMachineFunctionInfo(const MachineFunction &MF)
1620 : AMDGPUMachineFunction(MF),
1721 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();
2425 public:
2526 SIMachineFunctionInfo(const MachineFunction &MF);
2627 unsigned PSInputAddr;
2323 #include "llvm/Support/ErrorHandling.h"
2424 #include "llvm/Support/TargetRegistry.h"
2525
26 #define GET_INSTRINFO_CTOR
26 #define GET_INSTRINFO_CTOR_DTOR
2727 #include "SparcGenInstrInfo.inc"
2828
2929 using namespace llvm;
30
31
32 // Pin the vtable to this file.
33 void SparcInstrInfo::anchor() {}
3034
3135 SparcInstrInfo::SparcInstrInfo(SparcSubtarget &ST)
3236 : SparcGenInstrInfo(SP::ADJCALLSTACKDOWN, SP::ADJCALLSTACKUP),
3636 class SparcInstrInfo : public SparcGenInstrInfo {
3737 const SparcRegisterInfo RI;
3838 const SparcSubtarget& Subtarget;
39 virtual void anchor();
3940 public:
4041 explicit SparcInstrInfo(SparcSubtarget &ST);
4142
2020 SystemZISelLowering.cpp
2121 SystemZInstrInfo.cpp
2222 SystemZLongBranch.cpp
23 SystemZMachineFunctionInfo.cpp
2324 SystemZMCInstLower.cpp
2425 SystemZRegisterInfo.cpp
2526 SystemZSelectionDAGInfo.cpp
1616 #include "llvm/CodeGen/LiveVariables.h"
1717 #include "llvm/CodeGen/MachineRegisterInfo.h"
1818
19 #define GET_INSTRINFO_CTOR
19 #define GET_INSTRINFO_CTOR_DTOR
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 the vtable to this file.
40 void SystemZInstrInfo::anchor() {}
3841
3942 SystemZInstrInfo::SystemZInstrInfo(SystemZTargetMachine &tm)
4043 : 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();
129130
130131 public:
131132 explicit SystemZInstrInfo(SystemZTargetMachine &TM);
0 //== 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
1414 namespace llvm {
1515
1616 class SystemZMachineFunctionInfo : public MachineFunctionInfo {
17 virtual void anchor();
1718 unsigned LowSavedGPR;
1819 unsigned HighSavedGPR;
1920 unsigned VarArgsFirstGPR;
1616 #include "SystemZGenSubtargetInfo.inc"
1717
1818 using namespace llvm;
19
20 // Pin the vtabel to this file.
21 void SystemZSubtarget::anchor() {}
1922
2023 SystemZSubtarget::SystemZSubtarget(const std::string &TT,
2124 const std::string &CPU,
2525 class StringRef;
2626
2727 class SystemZSubtarget : public SystemZGenSubtargetInfo {
28 virtual void anchor();
2829 protected:
2930 bool HasDistinctOps;
3031 bool HasLoadStoreOnCond;
2626
2727 public:
2828 X86WinCOFFObjectWriter(bool Is64Bit_);
29 ~X86WinCOFFObjectWriter();
29 virtual ~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
38 #define GET_INSTRINFO_CTOR_DTOR
3939 #include "X86GenInstrInfo.inc"
4040
4141 using namespace llvm;
9090 uint16_t MemOp;
9191 uint16_t Flags;
9292 };
93
94 // Pin the vtable to this file.
95 void X86InstrInfo::anchor() {}
9396
9497 X86InstrInfo::X86InstrInfo(X86TargetMachine &tm)
9598 : 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();
153155
154156 public:
155157 explicit X86InstrInfo(X86TargetMachine &tm);
2121 #include "llvm/Support/ErrorHandling.h"
2222 #include "llvm/Support/TargetRegistry.h"
2323
24 #define GET_INSTRINFO_CTOR
24 #define GET_INSTRINFO_CTOR_DTOR
2525 #include "XCoreGenInstrInfo.inc"
2626
2727 namespace llvm {
3737 }
3838
3939 using namespace llvm;
40
41
42 // Pin the vtable to this file.
43 void XCoreInstrInfo::anchor() {}
4044
4145 XCoreInstrInfo::XCoreInstrInfo()
4246 : XCoreGenInstrInfo(XCore::ADJCALLSTACKDOWN, XCore::ADJCALLSTACKUP),
2323
2424 class XCoreInstrInfo : public XCoreGenInstrInfo {
2525 const XCoreRegisterInfo RI;
26 virtual void anchor();
2627 public:
2728 XCoreInstrInfo();
2829
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;
286286
287287 struct LoadModifier: public Modifier {
288288 LoadModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
289 virtual ~LoadModifier();
289290 virtual void Act() {
290291 // Try to use predefined pointers. If non exist, use undef pointer value;
291292 Value *Ptr = getRandomPointerValue();
296297
297298 struct StoreModifier: public Modifier {
298299 StoreModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
300 virtual ~StoreModifier();
299301 virtual void Act() {
300302 // Try to use predefined pointers. If non exist, use undef pointer value;
301303 Value *Ptr = getRandomPointerValue();
314316
315317 struct BinModifier: public Modifier {
316318 BinModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
319 virtual ~BinModifier();
317320
318321 virtual void Act() {
319322 Value *Val0 = getRandomVal();
358361 /// Generate constant values.
359362 struct ConstModifier: public Modifier {
360363 ConstModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
364 virtual ~ConstModifier();
365
361366 virtual void Act() {
362367 Type *Ty = pickType();
363368
404409
405410 struct AllocaModifier: public Modifier {
406411 AllocaModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R){}
412 virtual ~AllocaModifier();
407413
408414 virtual void Act() {
409415 Type *Tp = pickType();
414420 struct ExtractElementModifier: public Modifier {
415421 ExtractElementModifier(BasicBlock *BB, PieceTable *PT, Random *R):
416422 Modifier(BB, PT, R) {}
423 virtual ~ExtractElementModifier();
417424
418425 virtual void Act() {
419426 Value *Val0 = getRandomVectorValue();
427434
428435 struct ShuffModifier: public Modifier {
429436 ShuffModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
437 virtual ~ShuffModifier();
438
430439 virtual void Act() {
431440
432441 Value *Val0 = getRandomVectorValue();
455464 struct InsertElementModifier: public Modifier {
456465 InsertElementModifier(BasicBlock *BB, PieceTable *PT, Random *R):
457466 Modifier(BB, PT, R) {}
467 virtual ~InsertElementModifier();
458468
459469 virtual void Act() {
460470 Value *Val0 = getRandomVectorValue();
471481
472482 struct CastModifier: public Modifier {
473483 CastModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
484 virtual ~CastModifier();
485
474486 virtual void Act() {
475487
476488 Value *V = getRandomVal();
557569 struct SelectModifier: public Modifier {
558570 SelectModifier(BasicBlock *BB, PieceTable *PT, Random *R):
559571 Modifier(BB, PT, R) {}
572 virtual ~SelectModifier();
560573
561574 virtual void Act() {
562575 // Try a bunch of different select configuration until a valid one is found.
581594
582595 struct CmpModifier: public Modifier {
583596 CmpModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
597 virtual ~CmpModifier();
598
584599 virtual void Act() {
585600
586601 Value *Val0 = getRandomVal();
605620 return PT->push_back(V);
606621 }
607622 };
623
624 // Use out-of-line definitions to prevent weak vtables.
625 Modifier::~Modifier() {}
626 LoadModifier::~LoadModifier() {}
627 StoreModifier::~StoreModifier() {}
628 BinModifier::~BinModifier() {}
629 ConstModifier::~ConstModifier() {}
630 AllocaModifier::~AllocaModifier() {}
631 ExtractElementModifier::~ExtractElementModifier() {}
632 ShuffModifier::~ShuffModifier() {}
633 InsertElementModifier::~InsertElementModifier() {}
634 CastModifier::~CastModifier() {}
635 SelectModifier::~SelectModifier() {}
636 CmpModifier::~CmpModifier() {}
608637
609638 void FillFunction(Function *F, Random &R) {
610639 // 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 // Provide out-of-line definition to prevent weak vtable.
19 void VirtualRefCounted::f() {}
1720
1821 // Run this test with valgrind to detect memory leaks.
1922 TEST(IntrusiveRefCntPtr, RefCountedBaseVPTRCopyDoesNotLeak) {
8282 UnsupportedOSs.push_back(Triple::Cygwin);
8383 }
8484
85 virtual void SetUp() {
86 didCallAllocateCodeSection = false;
87 Module = 0;
88 Function = 0;
89 Engine = 0;
90 Error = 0;
91 }
92
85 virtual void SetUp();
86
9387 virtual void TearDown() {
9488 if (Engine)
9589 LLVMDisposeExecutionEngine(Engine);
156150 char *Error;
157151 };
158152
153 // Provide out-of-line definition to prevent weak vtable.
154 void MCJITCAPITest::SetUp() {
155 didCallAllocateCodeSection = false;
156 Module = 0;
157 Function = 0;
158 Engine = 0;
159 Error = 0;
160 }
161
159162 TEST_F(MCJITCAPITest, simple_function) {
160163 SKIP_UNSUPPORTED_PLATFORM;
161164
1717
1818 using namespace llvm;
1919
20 class MCJITMultipleModuleTest : public testing::Test, public MCJITTestBase {};
20 class MCJITMultipleModuleTest : public testing::Test, public MCJITTestBase {
21 public:
22 virtual ~MCJITMultipleModuleTest();
23 };
24
25 // Provide out-of-line definition to prevent weak vtable.
26 MCJITMultipleModuleTest::~MCJITMultipleModuleTest() {}
2127
2228 namespace {
2329
2020 class MCJITTest : public testing::Test, public MCJITTestBase {
2121 protected:
2222
23 virtual void SetUp() {
24 M.reset(createEmptyModule("
"));
25 }
23 virtual void SetUp();
2624 };
25
26 // Provide out-of-line definition to prevent weak vtable.
27 void MCJITTest::SetUp() {
28 M.reset(createEmptyModule("
"));
29 }
2730
2831 namespace {
2932
3737
3838 // (instrs a, b, ...) Evaluate and union all arguments. Identical to AddOp.
3939 struct InstrsOp : public SetTheory::Operator {
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 }
40 virtual void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts,
41 ArrayRef Loc);
4442 };
43
44 // Provide out-of-line definition to prevent weak vtable.
45 void InstrsOp::apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts,
46 ArrayRef Loc) {
47 ST.evaluate(Expr->arg_begin(), Expr->arg_end(), Elts, Loc);
48 }
4549
4650 // (instregex "OpcPat",...) Find all instructions matching an opcode pattern.
4751 //
5559 const CodeGenTarget &Target;
5660 InstRegexOp(const CodeGenTarget &t): Target(t) {}
5761
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 }
62 virtual void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts,
63 ArrayRef Loc);
8564 };
65
66 // Provide out-of-line definition to prevent weak vtable.
67 void InstRegexOp::apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts,
68 ArrayRef Loc) {
69 SmallVector RegexList;
70 for (DagInit::const_arg_iterator
71 AI = Expr->arg_begin(), AE = Expr->arg_end(); AI != AE; ++AI) {
72 StringInit *SI = dyn_cast(*AI);
73 if (!SI)
74 PrintFatalError(Loc, "instregex requires pattern string: "
75 + Expr->getAsString());
76 std::string pat = SI->getValue();
77 // Implement a python-style prefix match.
78 if (pat[0] != '^') {
79 pat.insert(0, "^(");
80 pat.insert(pat.end(), ')');
81 }
82 RegexList.push_back(new Regex(pat));
83 }
84 for (CodeGenTarget::inst_iterator I = Target.inst_begin(),
85 E = Target.inst_end(); I != E; ++I) {
86 for (SmallVectorImpl::iterator
87 RI = RegexList.begin(), RE = RegexList.end(); RI != RE; ++RI) {
88 if ((*RI)->match((*I)->TheDef->getName()))
89 Elts.insert((*I)->TheDef);
90 }
91 }
92 DeleteContainerPointers(RegexList);
93 }
8694
8795 /// CodeGenModels ctor interprets machine model records and populates maps.
8896 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"
439440 << "};\n";
440441 OS << "} // End llvm namespace \n";
441442
442443 OS << "#endif // GET_INSTRINFO_HEADER\n\n";
443444
444 OS << "\n#ifdef GET_INSTRINFO_CTOR\n";
445 OS << "#undef GET_INSTRINFO_CTOR\n";
445 OS << "\n#ifdef GET_INSTRINFO_CTOR_DTOR\n";
446 OS << "#undef GET_INSTRINFO_CTOR_DTOR\n";
446447
447448 OS << "namespace llvm {\n";
448449 OS << "extern const MCInstrDesc " << TargetName << "Insts[];\n";
452453 << " : TargetInstrInfo(SO, DO) {\n"
453454 << " InitMCInstrInfo(" << TargetName << "Insts, "
454455 << TargetName << "InstrNameIndices, " << TargetName << "InstrNameData, "
455 << NumberedInstructions.size() << ");\n}\n";
456 << NumberedInstructions.size() << ");\n}\n"
457 << ClassName << "::~" << ClassName << "() {}\n";
456458 OS << "} // End llvm namespace \n";
457459
458 OS << "#endif // GET_INSTRINFO_CTOR\n\n";
460 OS << "#endif // GET_INSTRINFO_CTOR_DTOR\n\n";
459461
460462 emitOperandNameMappings(OS, Target, NumberedInstructions);
461463
2626
2727 // (add a, b, ...) Evaluate and union all arguments.
2828 struct AddOp : public SetTheory::Operator {
29 void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts, ArrayRef Loc) {
29 virtual void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts,
30 ArrayRef Loc) {
3031 ST.evaluate(Expr->arg_begin(), Expr->arg_end(), Elts, Loc);
3132 }
3233 };
3334
3435 // (sub Add, Sub, ...) Set difference.
3536 struct SubOp : public SetTheory::Operator {
36 void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts, ArrayRef Loc) {
37 virtual void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts,
38 ArrayRef Loc) {
3739 if (Expr->arg_size() < 2)
3840 PrintFatalError(Loc, "Set difference needs at least two arguments: " +
3941 Expr->getAsString());
4850
4951 // (and S1, S2) Set intersection.
5052 struct AndOp : public SetTheory::Operator {
51 void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts, ArrayRef Loc) {
53 virtual void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts,
54 ArrayRef Loc) {
5255 if (Expr->arg_size() != 2)
5356 PrintFatalError(Loc, "Set intersection requires two arguments: " +
5457 Expr->getAsString());
6770 RecSet &Set, int64_t N,
6871 RecSet &Elts, ArrayRef Loc) =0;
6972
70 void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts, ArrayRef Loc) {
73 virtual void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts,
74 ArrayRef Loc) {
7175 if (Expr->arg_size() != 2)
7276 PrintFatalError(Loc, "Operator requires (Op Set, Int) arguments: " +
7377 Expr->getAsString());
8387
8488 // (shl S, N) Shift left, remove the first N elements.
8589 struct ShlOp : public SetIntBinOp {
86 void apply2(SetTheory &ST, DagInit *Expr,
87 RecSet &Set, int64_t N,
88 RecSet &Elts, ArrayRef Loc) {
90 virtual void apply2(SetTheory &ST, DagInit *Expr,
91 RecSet &Set, int64_t N,
92 RecSet &Elts, ArrayRef Loc) {
8993 if (N < 0)
9094 PrintFatalError(Loc, "Positive shift required: " +
9195 Expr->getAsString());
96100
97101 // (trunc S, N) Truncate after the first N elements.
98102 struct TruncOp : public SetIntBinOp {
99 void apply2(SetTheory &ST, DagInit *Expr,
100 RecSet &Set, int64_t N,
101 RecSet &Elts, ArrayRef Loc) {
103 virtual void apply2(SetTheory &ST, DagInit *Expr,
104 RecSet &Set, int64_t N,
105 RecSet &Elts, ArrayRef Loc) {
102106 if (N < 0)
103107 PrintFatalError(Loc, "Positive length required: " +
104108 Expr->getAsString());
114118
115119 RotOp(bool Rev) : Reverse(Rev) {}
116120
117 void apply2(SetTheory &ST, DagInit *Expr,
118 RecSet &Set, int64_t N,
119 RecSet &Elts, ArrayRef Loc) {
121 virtual void apply2(SetTheory &ST, DagInit *Expr,
122 RecSet &Set, int64_t N,
123 RecSet &Elts, ArrayRef Loc) {
120124 if (Reverse)
121125 N = -N;
122126 // N > 0 -> rotate left, N < 0 -> rotate right.
133137
134138 // (decimate S, N) Pick every N'th element of S.
135139 struct DecimateOp : public SetIntBinOp {
136 void apply2(SetTheory &ST, DagInit *Expr,
137 RecSet &Set, int64_t N,
138 RecSet &Elts, ArrayRef Loc) {
140 virtual void apply2(SetTheory &ST, DagInit *Expr,
141 RecSet &Set, int64_t N,
142 RecSet &Elts, ArrayRef Loc) {
139143 if (N <= 0)
140144 PrintFatalError(Loc, "Positive stride required: " +
141145 Expr->getAsString());
146150
147151 // (interleave S1, S2, ...) Interleave elements of the arguments.
148152 struct InterleaveOp : public SetTheory::Operator {
149 void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts, ArrayRef Loc) {
153 virtual void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts,
154 ArrayRef Loc) {
150155 // Evaluate the arguments individually.
151156 SmallVector Args(Expr->getNumArgs());
152157 unsigned MaxSize = 0;
164169
165170 // (sequence "Format", From, To) Generate a sequence of records by name.
166171 struct SequenceOp : public SetTheory::Operator {
167 void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts, ArrayRef Loc) {
172 virtual void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts,
173 ArrayRef Loc) {
168174 int Step = 1;
169175 if (Expr->arg_size() > 4)
170176 PrintFatalError(Loc, "Bad args to (sequence \"Format\", From, To): " +
231237
232238 FieldExpander(StringRef fn) : FieldName(fn) {}
233239
234 void expand(SetTheory &ST, Record *Def, RecSet &Elts) {
240 virtual void expand(SetTheory &ST, Record *Def, RecSet &Elts) {
235241 ST.evaluate(Def->getValueInit(FieldName), Elts, Def->getLoc());
236242 }
237243 };
238244 } // end anonymous namespace
239245
240 void SetTheory::Operator::anchor() { }
241
242 void SetTheory::Expander::anchor() { }
246 // Pin the vtables to this file.
247 void SetTheory::Operator::anchor() {}
248 void SetTheory::Expander::anchor() {}
249
243250
244251 SetTheory::SetTheory() {
245252 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 // Provide out-of-line definition to prevent weak vtable.
41 Type::~Type() {}
3942
4043 }
4144
4447 public:
4548 explicit ExtendedIntegerType(unsigned bits)
4649 : Type(TK_ExtendedIntegerType), BitWidth(bits) {}
50 virtual ~ExtendedIntegerType();
4751 static bool classof(const Type *T) {
4852 return T->getKind() == TK_ExtendedIntegerType;
4953 }
50 unsigned getSizeInBits() const {
54 virtual unsigned getSizeInBits() const {
5155 return getBitWidth();
5256 }
5357 unsigned getBitWidth() const {
5559 }
5660 };
5761
62 // Provide out-of-line definition to prevent weak vtable.
63 ExtendedIntegerType::~ExtendedIntegerType() {}
64
5865 class ExtendedVectorType : public Type {
5966 EVT ElementType;
6067 unsigned NumElements;
6168 public:
6269 ExtendedVectorType(EVT elty, unsigned num)
6370 : Type(TK_ExtendedVectorType), ElementType(elty), NumElements(num) {}
71 virtual ~ExtendedVectorType();
6472 static bool classof(const Type *T) {
6573 return T->getKind() == TK_ExtendedVectorType;
6674 }
67 unsigned getSizeInBits() const {
75 virtual unsigned getSizeInBits() const {
6876 return getNumElements() * getElementType().getSizeInBits();
6977 }
7078 EVT getElementType() const {
7482 return NumElements;
7583 }
7684 };
85
86 // Provide out-of-line definition to prevent weak vtable.
87 ExtendedVectorType::~ExtendedVectorType() {}
7788
7889 static std::map
7990 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();
982983 public:
983984 virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) {}
984985 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();
107108 raw_os_ostream ros_;
108109
109110 public:
535536 // of a Test object.
536537 class TestFactoryBase {
537538 public:
538 virtual ~TestFactoryBase() {}
539 virtual ~TestFactoryBase();
539540
540541 // Creates a test instance to run. The instance is both created and destroyed
541542 // 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 // Pin the vtable to this file.
303 DeathTest::~DeathTest() {}
301304
302305 // Creates and returns a death test by dispatching to the current
303306 // death test factory.
10901093 return true;
10911094 }
10921095
1096 // Pin the vtable to this file.
1097 DeathTestFactory::~DeathTestFactory() {}
1098
10931099 // Splits a given string on a given delimiter, populating a given
10941100 // vector with the fields. GTEST_HAS_DEATH_TEST implies that we have
10951101 // ::std::string, so we can use it here.
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 // Pin the vtables to this file.
749 #if GTEST_HAS_PTHREAD
750 ThreadWithParamBase::~ThreadWithParamBase() {}
751 ThreadLocalValueHolderBase::~ThreadLocalValueHolderBase() {}
752 #endif
753 TestFactoryBase::~TestFactoryBase() {}
754
748755 } // namespace internal
749756 } // namespace testing
757
758 // Pin the vtable to this file.
759 #if !GTEST_NO_LLVM_RAW_OSTREAM
760 namespace llvm {
761 void convertible_fwd_ostream::anchor() {}
762 }
763 #endif
48624862 internal::InitGoogleTestImpl(argc, argv);
48634863 }
48644864
4865 // Pin the vtables to this file.
4866 Environment::~Environment() {}
4867 TestPartResultReporterInterface::~TestPartResultReporterInterface() {}
4868 TestEventListener::~TestEventListener() {}
4869 void EmptyTestEventListener::anchor() {}
4870 namespace internal {
4871 OsStackTraceGetterInterface::~OsStackTraceGetterInterface() {}
4872 ParameterizedTestCaseInfoBase::~ParameterizedTestCaseInfoBase() {}
4873 }
4874
48654875 } // namespace testing