1 //===-- TargetMachine.cpp - General Target Information ---------------------==//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file describes the general parts of a Target machine.
12 //===----------------------------------------------------------------------===//
14 #include "llvm/MC/MCAsmInfo.h"
15 #include "llvm/Target/TargetMachine.h"
16 #include "llvm/Target/TargetOptions.h"
17 #include "llvm/Support/CommandLine.h"
20 //---------------------------------------------------------------------------
21 // Command-line options that tend to be useful on more than one back-end.
26 bool EnableMachineSched;
27 bool HasDivModLibcall;
28 bool AsmVerbosityDefault(false);
32 DataSections("fdata-sections",
33 cl::desc("Emit data into separate sections"),
36 FunctionSections("ffunction-sections",
37 cl::desc("Emit functions into separate sections"),
40 //---------------------------------------------------------------------------
41 // TargetMachine Class
44 TargetMachine::TargetMachine(const Target &T,
45 StringRef TT, StringRef CPU, StringRef FS,
46 const TargetOptions &Options)
47 : TheTarget(T), TargetTriple(TT), TargetCPU(CPU), TargetFS(FS),
48 CodeGenInfo(0), AsmInfo(0),
51 MCSaveTempLabels(false),
54 MCUseDwarfDirectory(false),
58 TargetMachine::~TargetMachine() {
63 /// getRelocationModel - Returns the code generation relocation model. The
64 /// choices are static, PIC, and dynamic-no-pic, and target default.
65 Reloc::Model TargetMachine::getRelocationModel() const {
67 return Reloc::Default;
68 return CodeGenInfo->getRelocationModel();
71 /// getCodeModel - Returns the code model. The choices are small, kernel,
72 /// medium, large, and target default.
73 CodeModel::Model TargetMachine::getCodeModel() const {
75 return CodeModel::Default;
76 return CodeGenInfo->getCodeModel();
79 /// getOptLevel - Returns the optimization level: None, Less,
80 /// Default, or Aggressive.
81 CodeGenOpt::Level TargetMachine::getOptLevel() const {
83 return CodeGenOpt::Default;
84 return CodeGenInfo->getOptLevel();
87 bool TargetMachine::getAsmVerbosityDefault() {
88 return AsmVerbosityDefault;
91 void TargetMachine::setAsmVerbosityDefault(bool V) {
92 AsmVerbosityDefault = V;
95 bool TargetMachine::getFunctionSections() {
96 return FunctionSections;
99 bool TargetMachine::getDataSections() {
103 void TargetMachine::setFunctionSections(bool V) {
104 FunctionSections = V;
107 void TargetMachine::setDataSections(bool V) {