llvm.org GIT mirror llvm / 5a364c5
[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. Differential Revision: http://llvm-reviews.chandlerc.com/D2068 Reviewed by Andy git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194865 91177308-0d34-0410-b5e6-96231b3b80d8 Juergen Ributzka 5 years ago
115 changed file(s) with 507 addition(s) and 159 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 () {}
15811583
15821584
15831585 /// Throws foreign C++ exception.
7878 /// ExprAST - Base class for all expression nodes.
7979 class ExprAST {
8080 public:
81 virtual ~ExprAST() {}
82 };
81 virtual ~ExprAST();
82 };
83
84 ExprAST::~ExprAST() {}
8385
8486 /// NumberExprAST - Expression class for numeric literals like "1.0".
8587 class NumberExprAST : public ExprAST {
8688 public:
8789 NumberExprAST(double val) {}
88 };
90 virtual ~NumberExprAST();
91 };
92
93 NumberExprAST::~NumberExprAST() {}
8994
9095 /// VariableExprAST - Expression class for referencing a variable, like "a".
9196 class VariableExprAST : public ExprAST {
9297 std::string Name;
9398 public:
9499 VariableExprAST(const std::string &name) : Name(name) {}
95 };
100 virtual ~VariableExprAST();
101 };
102
103 VariableExprAST::~VariableExprAST() {}
96104
97105 /// BinaryExprAST - Expression class for a binary operator.
98106 class BinaryExprAST : public ExprAST {
99107 public:
100108 BinaryExprAST(char op, ExprAST *lhs, ExprAST *rhs) {}
101 };
109 virtual ~BinaryExprAST();
110 };
111
112 BinaryExprAST::~BinaryExprAST() {}
102113
103114 /// CallExprAST - Expression class for function calls.
104115 class CallExprAST : public ExprAST {
107118 public:
108119 CallExprAST(const std::string &callee, std::vector &args)
109120 : Callee(callee), Args(args) {}
110 };
121 virtual ~CallExprAST();
122 };
123
124 CallExprAST::~CallExprAST() {}
111125
112126 /// PrototypeAST - This class represents the "prototype" for a function,
113127 /// 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() {}
8991
9092 /// NumberExprAST - Expression class for numeric literals like "1.0".
9193 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() {}
9698
9799 /// NumberExprAST - Expression class for numeric literals like "1.0".
98100 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() {}
105107
106108 /// NumberExprAST - Expression class for numeric literals like "1.0".
107109 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() {}
110112
111113 /// NumberExprAST - Expression class for numeric literals like "1.0".
112114 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() {}
114116
115117 /// NumberExprAST - Expression class for numeric literals like "1.0".
116118 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
3232 public:
3333 ObjectBuffer() {}
3434 ObjectBuffer(MemoryBuffer* Buf) : Buffer(Buf) {}
35 virtual ~ObjectBuffer() {}
3635
3736 /// getMemBuffer - Like MemoryBuffer::getMemBuffer() this function
3837 /// returns a pointer to an object that is owned by the caller. However,
5756 class ObjectBufferStream : public ObjectBuffer {
5857 public:
5958 ObjectBufferStream() : OS(SV) {}
60 virtual ~ObjectBufferStream() {}
6159
6260 raw_ostream &getOStream() { return OS; }
6361 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();
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;
1717
1818 class MCWinCOFFObjectTargetWriter {
1919 const unsigned Machine;
20
21 virtual void anchor();
2022
2123 protected:
2224 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();
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) {}
722722 virtual bool canElideEmptySequence();
723723
724724 class HNode {
725 virtual void anchor();
725726 public:
726727 HNode(Node *n) : _node(n) { }
727728 virtual ~HNode() { }
731732 };
732733
733734 class EmptyHNode : public HNode {
735 virtual void anchor();
734736 public:
735737 EmptyHNode(Node *n) : HNode(n) { }
736 virtual ~EmptyHNode() {}
737738 static inline bool classof(const HNode *n) {
738739 return NullNode::classof(n->_node);
739740 }
741742 };
742743
743744 class ScalarHNode : public HNode {
745 virtual void anchor();
744746 public:
745747 ScalarHNode(Node *n, StringRef s) : HNode(n), _value(s) { }
746 virtual ~ScalarHNode() { }
747748
748749 StringRef value() const { return _value; }
749750
756757 };
757758
758759 class MapHNode : public HNode {
760 virtual void anchor();
759761 public:
760762 MapHNode(Node *n) : HNode(n) { }
761763 virtual ~MapHNode();
774776 };
775777
776778 class SequenceHNode : public HNode {
779 virtual void anchor();
777780 public:
778781 SequenceHNode(Node *n) : HNode(n) { }
779782 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() {}
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 vtable 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 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 vtable to this file
43 void ObjectCache::anchor() {}
4044
4145 ExecutionEngine *(*ExecutionEngine::JITCtor)(
4246 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 JITRegistrar.h and ObjectImage*.h vtables to this file
32 void JITRegistrar::anchor() {}
33 void ObjectImage::anchor() {}
34 void ObjectImageCommon::anchor() {}
2935
3036 namespace llvm {
3137
4545 AttributeImpl(AttrEntryKind KindID) : KindID(KindID) {}
4646
4747 public:
48 virtual ~AttributeImpl();
49
5048 bool isEnumAttribute() const { return KindID == EnumAttrEntry; }
5149 bool isAlignAttribute() const { return KindID == AlignAttrEntry; }
5250 bool isStringAttribute() const { return KindID == StringAttrEntry; }
285285 // AttributeImpl Definition
286286 //===----------------------------------------------------------------------===//
287287
288 AttributeImpl::~AttributeImpl() {}
289
290288 bool AttributeImpl::hasAttribute(Attribute::AttrKind A) const {
291289 if (isStringAttribute()) return false;
292290 return getKindAsEnum() == A;
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();
8080 virtual void allUsesReplacedWith(Value *NV);
8181 };
8282 } // end namespace llvm.
83
84 MDNodeOperand::~MDNodeOperand() {}
8385
8486
8587 void MDNodeOperand::deleted() {
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 vtable to this file
738 void CallbackVH::anchor() {}
1212 #include
1313
1414 using namespace llvm;
15
16 // pin 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 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);
897897 Machine(Machine_) {
898898 }
899899
900 // pin vtable to this file
901 void MCWinCOFFObjectTargetWriter::anchor() {}
902
900903 //------------------------------------------------------------------------------
901904 // WinCOFFObjectWriter factory function
902905
5959 TEMPLATE_INSTANTIATION(class opt);
6060 } } // end namespace llvm::cl
6161
62 void GenericOptionValue::anchor() {}
6263 void OptionValue::anchor() {}
6364 void OptionValue::anchor() {}
6465 void Option::anchor() {}
7273 void parser::anchor() {}
7374 void parser::anchor() {}
7475 void parser::anchor() {}
76 void StringSaver::anchor() {}
7577
7678 //===----------------------------------------------------------------------===//
7779
1616 #include "llvm/ADT/Twine.h"
1717 #include "llvm/Config/config.h"
1818 #include "llvm/Support/Debug.h"
19 #include "llvm/Support/ErrorOr.h"
1920 #include "llvm/Support/Signals.h"
2021 #include "llvm/Support/Threading.h"
2122 #include "llvm/Support/raw_ostream.h"
118119 void LLVMResetFatalErrorHandler() {
119120 remove_fatal_error_handler();
120121 }
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
98107 /// Token - A single YAML token.
99108 struct Token : ilist_node {
100109 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() {}
6067
6168 bool Input::outputting() const {
6269 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 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 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
23 private:
24 virtual void anchor();
25 };
2326
2427 } // namespace llvm
2528
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 vtable to this file
58 void HexagonInstrInfo::anchor() {}
5759
5860 HexagonInstrInfo::HexagonInstrInfo(HexagonSubtarget &ST)
5961 : HexagonGenInstrInfo(Hexagon::ADJCALLSTACKDOWN, Hexagon::ADJCALLSTACKUP),
2828 const HexagonRegisterInfo RI;
2929 const HexagonSubtarget &Subtarget;
3030 typedef unsigned Opcode_t;
31
32 virtual void anchor();
3133
3234 public:
3335 explicit HexagonInstrInfo(HexagonSubtarget &ST);
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 {
3233
3334 std::map PacketInfo;
3435
36 virtual void anchor();
3537
3638 public:
3739 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();
4445
4546 /// getInstrItins - Return the instruction itineraies based on subtarget
4647 /// selection.
1313 #include "HexagonMCAsmInfo.h"
1414
1515 using namespace llvm;
16
17 // pin 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 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
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
4447 static std::string ParseMipsTriple(StringRef TT, StringRef CPU) {
4548 std::string MipsArchFeature;
4649 size_t DashPosition = 0;
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 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;
1313
1414 namespace llvm {
1515 class MipsTargetStreamer : public MCTargetStreamer {
16 virtual void anchor();
1617 public:
1718 virtual void emitMipsHackELFFlags(unsigned Flags) = 0;
1819 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
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 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 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)
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();
3739
3840 public:
3941 /// This constructor initializes the data members to match that
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 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 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 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 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 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 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 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 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
2121 unsigned VarArgsFrameIndex;
2222 unsigned RegSaveFrameIndex;
2323 bool ManipulatesSP;
24
25 virtual void anchor();
2426
2527 public:
2628 explicit SystemZMachineFunctionInfo(MachineFunction &MF)
1616 #include "SystemZGenSubtargetInfo.inc"
1717
1818 using namespace llvm;
19
20 // pin 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 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 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;
284284 LLVMContext &Context;
285285 };
286286
287 Modifier::~Modifier() {}
288
287289 struct LoadModifier: public Modifier {
288290 LoadModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
291 virtual ~LoadModifier();
289292 virtual void Act() {
290293 // Try to use predefined pointers. If non exist, use undef pointer value;
291294 Value *Ptr = getRandomPointerValue();
294297 }
295298 };
296299
300 LoadModifier::~LoadModifier() {}
301
297302 struct StoreModifier: public Modifier {
298303 StoreModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
304 virtual ~StoreModifier();
299305 virtual void Act() {
300306 // Try to use predefined pointers. If non exist, use undef pointer value;
301307 Value *Ptr = getRandomPointerValue();
312318 }
313319 };
314320
321 StoreModifier::~StoreModifier() {}
322
315323 struct BinModifier: public Modifier {
316324 BinModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
325 virtual ~BinModifier();
317326
318327 virtual void Act() {
319328 Value *Val0 = getRandomVal();
355364 }
356365 };
357366
367 BinModifier::~BinModifier() {}
368
358369 /// Generate constant values.
359370 struct ConstModifier: public Modifier {
360371 ConstModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
372 virtual ~ConstModifier();
373
361374 virtual void Act() {
362375 Type *Ty = pickType();
363376
402415 }
403416 };
404417
418 ConstModifier::~ConstModifier() {}
419
405420 struct AllocaModifier: public Modifier {
406421 AllocaModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R){}
422 virtual ~AllocaModifier();
407423
408424 virtual void Act() {
409425 Type *Tp = pickType();
410426 PT->push_back(new AllocaInst(Tp, "A", BB->getFirstNonPHI()));
411427 }
412428 };
429
430 AllocaModifier::~AllocaModifier() {}
413431
414432 struct ExtractElementModifier: public Modifier {
415433 ExtractElementModifier(BasicBlock *BB, PieceTable *PT, Random *R):
416434 Modifier(BB, PT, R) {}
435 virtual ~ExtractElementModifier();
417436
418437 virtual void Act() {
419438 Value *Val0 = getRandomVectorValue();
425444 }
426445 };
427446
447 ExtractElementModifier::~ExtractElementModifier() {}
448
428449 struct ShuffModifier: public Modifier {
429450 ShuffModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
451 virtual ~ShuffModifier();
452
430453 virtual void Act() {
431454
432455 Value *Val0 = getRandomVectorValue();
452475 }
453476 };
454477
478 ShuffModifier::~ShuffModifier() {}
479
455480 struct InsertElementModifier: public Modifier {
456481 InsertElementModifier(BasicBlock *BB, PieceTable *PT, Random *R):
457482 Modifier(BB, PT, R) {}
483 virtual ~InsertElementModifier();
458484
459485 virtual void Act() {
460486 Value *Val0 = getRandomVectorValue();
469495
470496 };
471497
498 InsertElementModifier::~InsertElementModifier() {}
499
472500 struct CastModifier: public Modifier {
473501 CastModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
502 virtual ~CastModifier();
503
474504 virtual void Act() {
475505
476506 Value *V = getRandomVal();
554584
555585 };
556586
587 CastModifier::~CastModifier() {}
588
557589 struct SelectModifier: public Modifier {
558590 SelectModifier(BasicBlock *BB, PieceTable *PT, Random *R):
559591 Modifier(BB, PT, R) {}
592 virtual ~SelectModifier();
560593
561594 virtual void Act() {
562595 // Try a bunch of different select configuration until a valid one is found.
578611 }
579612 };
580613
614 SelectModifier::~SelectModifier() {}
581615
582616 struct CmpModifier: public Modifier {
583617 CmpModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
618 virtual ~CmpModifier();
619
584620 virtual void Act() {
585621
586622 Value *Val0 = getRandomVal();
605641 return PT->push_back(V);
606642 }
607643 };
644
645 CmpModifier::~CmpModifier() {}
608646
609647 void FillFunction(Function *F, Random &R) {
610648 // 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() {}
1719
1820 // Run this test with valgrind to detect memory leaks.
1921 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 void MCJITCAPITest::SetUp() {
154 didCallAllocateCodeSection = false;
155 Module = 0;
156 Function = 0;
157 Engine = 0;
158 Error = 0;
159 }
160
159161 TEST_F(MCJITCAPITest, simple_function) {
160162 SKIP_UNSUPPORTED_PLATFORM;
161163
1717
1818 using namespace llvm;
1919
20 class MCJITMultipleModuleTest : public testing::Test, public MCJITTestBase {};
20 class MCJITMultipleModuleTest : public testing::Test,
21 public MCJITTestBase {
22 public:
23 virtual ~MCJITMultipleModuleTest();
24 };
25
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 void MCJITTest::SetUp() {
27 M.reset(createEmptyModule("
"));
28 }
2729
2830 namespace {
2931
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 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 }
4548
4649 // (instregex "OpcPat",...) Find all instructions matching an opcode pattern.
4750 //
5558 const CodeGenTarget &Target;
5659 InstRegexOp(const CodeGenTarget &t): Target(t) {}
5760
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 }
61 virtual void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts,
62 ArrayRef Loc);
8563 };
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 }
8692
8793 /// CodeGenModels ctor interprets machine model records and populates maps.
8894 CodeGenSchedModels::CodeGenSchedModels(RecordKeeper &RK,
407407 OS << "namespace llvm {\n";
408408 OS << "struct " << ClassName << " : public TargetInstrInfo {\n"
409409 << " explicit " << ClassName << "(int SO = -1, int DO = -1);\n"
410 << " virtual ~" << ClassName << "();\n"
410411 << "};\n";
411412 OS << "} // End llvm namespace \n";
412413
413414 OS << "#endif // GET_INSTRINFO_HEADER\n\n";
414415
415 OS << "\n#ifdef GET_INSTRINFO_CTOR\n";
416 OS << "#undef GET_INSTRINFO_CTOR\n";
416 OS << "\n#ifdef GET_INSTRINFO_CTOR_DTOR\n";
417 OS << "#undef GET_INSTRINFO_CTOR_DTOR\n";
417418
418419 OS << "namespace llvm {\n";
419420 OS << "extern const MCInstrDesc " << TargetName << "Insts[];\n";
423424 << " : TargetInstrInfo(SO, DO) {\n"
424425 << " InitMCInstrInfo(" << TargetName << "Insts, "
425426 << TargetName << "InstrNameIndices, " << TargetName << "InstrNameData, "
426 << NumberedInstructions.size() << ");\n}\n";
427 << NumberedInstructions.size() << ");\n}\n"
428 << ClassName << "::~" << ClassName << "() {}\n";
427429 OS << "} // End llvm namespace \n";
428430
429 OS << "#endif // GET_INSTRINFO_CTOR\n\n";
431 OS << "#endif // GET_INSTRINFO_CTOR_DTOR\n\n";
430432
431433 emitOperandNameMappings(OS, Target, NumberedInstructions);
432434 }
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 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 Type::~Type() {}
3941
4042 }
4143
4446 public:
4547 explicit ExtendedIntegerType(unsigned bits)
4648 : Type(TK_ExtendedIntegerType), BitWidth(bits) {}
49 virtual ~ExtendedIntegerType();
4750 static bool classof(const Type *T) {
4851 return T->getKind() == TK_ExtendedIntegerType;
4952 }
50 unsigned getSizeInBits() const {
53 virtual unsigned getSizeInBits() const {
5154 return getBitWidth();
5255 }
5356 unsigned getBitWidth() const {
5558 }
5659 };
5760
61 ExtendedIntegerType::~ExtendedIntegerType() {}
62
63
5864 class ExtendedVectorType : public Type {
5965 EVT ElementType;
6066 unsigned NumElements;
6167 public:
6268 ExtendedVectorType(EVT elty, unsigned num)
6369 : Type(TK_ExtendedVectorType), ElementType(elty), NumElements(num) {}
70 virtual ~ExtendedVectorType();
6471 static bool classof(const Type *T) {
6572 return T->getKind() == TK_ExtendedVectorType;
6673 }
67 unsigned getSizeInBits() const {
74 virtual unsigned getSizeInBits() const {
6875 return getNumElements() * getElementType().getSizeInBits();
6976 }
7077 EVT getElementType() const {
7481 return NumElements;
7582 }
7683 };
84
85 ExtendedVectorType::~ExtendedVectorType() {}
86
7787
7888 static std::map
7989 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 DeathTest::~DeathTest() {}
301303
302304 // Creates and returns a death test by dispatching to the current
303305 // death test factory.
732734 }
733735 # else // We are not on Windows.
734736
737 DeathTestFactory::~DeathTestFactory() {}
738
735739 // ForkingDeathTest provides implementations for most of the abstract
736740 // methods of the DeathTest interface. Only the AssumeRole method is
737741 // left undefined.
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 ThreadWithParamBase::~ThreadWithParamBase() {}
749 ThreadLocalValueHolderBase::~ThreadLocalValueHolderBase() {}
750 TestFactoryBase::~TestFactoryBase() {}
751
748752 } // namespace internal
749753 } // namespace testing
754
755 #if !GTEST_NO_LLVM_RAW_OSTREAM
756 namespace llvm {
757 void convertible_fwd_ostream::anchor() {}
758 }
759 #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
48654874 } // namespace testing