Skip to content

Commit f42bdf7

Browse files
author
David Tweed
committed
For some LLVM-as-library uses it is convenient to create a
subclass of TargetMachine which "forwards" all operations to an existing internal TargetMachine member variable. In the usage context the specific-machine class derived from TargetMachine is not visible, only a reference to the generic base class TargetMachine. Although getSubtargetImpl() is public in specific-machine classes derived from TargetMachine, the TargetMachine class unfortunately has getSubtargetImpl() protected (and accessing non-const members makes abusing getSubtarget() unsuitable). Making it public in the base class allows this forwarding pattern. llvm-svn: 171976
1 parent 06358bd commit f42bdf7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

llvm/include/llvm/Target/TargetMachine.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,6 @@ class TargetMachine {
5959
TargetMachine(const Target &T, StringRef TargetTriple,
6060
StringRef CPU, StringRef FS, const TargetOptions &Options);
6161

62-
/// getSubtargetImpl - virtual method implemented by subclasses that returns
63-
/// a reference to that target's TargetSubtargetInfo-derived member variable.
64-
virtual const TargetSubtargetInfo *getSubtargetImpl() const { return 0; }
65-
6662
/// TheTarget - The Target that this machine was created for.
6763
const Target &TheTarget;
6864

@@ -95,6 +91,10 @@ class TargetMachine {
9591
const StringRef getTargetCPU() const { return TargetCPU; }
9692
const StringRef getTargetFeatureString() const { return TargetFS; }
9793

94+
/// getSubtargetImpl - virtual method implemented by subclasses that returns
95+
/// a reference to that target's TargetSubtargetInfo-derived member variable.
96+
virtual const TargetSubtargetInfo *getSubtargetImpl() const { return 0; }
97+
9898
TargetOptions Options;
9999

100100
// Interfaces to the major aspects of target machine information:

0 commit comments

Comments
 (0)