LLVM: lib/ExecutionEngine/Orc/JITTargetMachineBuilder.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

10

14

15namespace llvm {

16namespace orc {

17

20 Options.EmulatedTLS = true;

21 Options.UseInitArray = true;

22}

23

26

27

28

29

32

34

35 return TMBuilder;

36}

37

40

41 std::string ErrMsg;

43 if (!TheTarget)

45

46 if (!TheTarget->hasJIT())

49

50 auto *TM = TheTarget->createTargetMachine(

51 TT, CPU, Features.getString(), Options, RM, CM, OptLevel, true);

52 if (!TM)

55

56 return std::unique_ptr(TM);

57}

58

60 const std::vectorstd::string &FeatureVec) {

61 for (const auto &F : FeatureVec)

62 Features.AddFeature(F);

63 return *this;

64}

65

66#ifndef NDEBUG

68 OS << Indent << "{\n"

69 << Indent << " Triple = \"" << JTMB.TT.str() << "\"\n"

70 << Indent << " CPU = \"" << JTMB.CPU << "\"\n"

71 << Indent << " Features = \"" << JTMB.Features.getString() << "\"\n"

72 << Indent << " Options = \n"

73 << Indent << " Relocation Model = ";

74

75 if (JTMB.RM) {

76 switch (*JTMB.RM) {

78 OS << "Static";

79 break;

81 OS << "PIC_";

82 break;

84 OS << "DynamicNoPIC";

85 break;

87 OS << "ROPI";

88 break;

90 OS << "RWPI";

91 break;

93 OS << "ROPI_RWPI";

94 break;

95 }

96 } else

97 OS << "unspecified (will use target default)";

98

99 OS << "\n"

100 << Indent << " Code Model = ";

101

102 if (JTMB.CM) {

103 switch (*JTMB.CM) {

105 OS << "Tiny";

106 break;

108 OS << "Small";

109 break;

111 OS << "Kernel";

112 break;

114 OS << "Medium";

115 break;

117 OS << "Large";

118 break;

119 }

120 } else

121 OS << "unspecified (will use target default)";

122

123 OS << "\n"

124 << Indent << " Optimization Level = ";

125 switch (JTMB.OptLevel) {

127 OS << "None";

128 break;

130 OS << "Less";

131 break;

133 OS << "Default";

134 break;

136 OS << "Aggressive";

137 break;

138 }

139

140 OS << "\n" << Indent << "}\n";

141}

142#endif

143

144}

145}

Tagged union holding either a T or a Error.

LLVM_ABI void AddFeature(StringRef String, bool Enable=true)

Adds Features.

Triple - Helper class for working with autoconf configuration names.

void print(raw_ostream &OS) const

Definition JITTargetMachineBuilder.cpp:67

LLVM_ABI JITTargetMachineBuilder & addFeatures(const std::vector< std::string > &FeatureVec)

Add subtarget features.

Definition JITTargetMachineBuilder.cpp:59

SubtargetFeatures & getFeatures()

Access subtarget features.

static LLVM_ABI Expected< JITTargetMachineBuilder > detectHost()

Create a JITTargetMachineBuilder for the host system.

Definition JITTargetMachineBuilder.cpp:24

LLVM_ABI JITTargetMachineBuilder(Triple TT)

Create a JITTargetMachineBuilder based on the given triple.

Definition JITTargetMachineBuilder.cpp:18

LLVM_ABI Expected< std::unique_ptr< TargetMachine > > createTargetMachine()

Create a TargetMachine.

Definition JITTargetMachineBuilder.cpp:39

JITTargetMachineBuilder & setCPU(std::string CPU)

Set the CPU string.

This class implements an extremely fast bulk output stream that can only output to a stream.

LLVM_ABI StringMap< bool, MallocAllocator > getHostCPUFeatures()

getHostCPUFeatures - Get the LLVM names for the host CPU features.

LLVM_ABI StringRef getHostCPUName()

getHostCPUName - Get the LLVM name for the host CPU.

LLVM_ABI std::string getProcessTriple()

getProcessTriple() - Return an appropriate target triple for generating code to be loaded into the cu...

This is an optimization pass for GlobalISel generic memory operations.

LLVM_ABI std::error_code inconvertibleErrorCode()

The value returned by this function can be returned from convertToErrorCode for Error values where no...

Error make_error(ArgTs &&... Args)

Make a Error instance representing failure using the given error info type.

OutputIt move(R &&Range, OutputIt Out)

Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.

Implement std::hash so that hash_code can be used in STL containers.

static const Target * lookupTarget(StringRef TripleStr, std::string &Error)

lookupTarget - Lookup a target based on a target triple.