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 HasDivModLibcall;
27 bool AsmVerbosityDefault(false);
31 DataSections("fdata-sections",
32 cl::desc("Emit data into separate sections"),
35 FunctionSections("ffunction-sections",
36 cl::desc("Emit functions into separate sections"),
39 //---------------------------------------------------------------------------
40 // TargetMachine Class
43 TargetMachine::TargetMachine(const Target &T,
44 StringRef TT, StringRef CPU, StringRef FS,
45 const TargetOptions &Options)
46 : TheTarget(T), TargetTriple(TT), TargetCPU(CPU), TargetFS(FS),
47 CodeGenInfo(0), AsmInfo(0),
50 MCSaveTempLabels(false),
53 MCUseDwarfDirectory(false),
57 TargetMachine::~TargetMachine() {
62 /// getRelocationModel - Returns the code generation relocation model. The
63 /// choices are static, PIC, and dynamic-no-pic, and target default.
64 Reloc::Model TargetMachine::getRelocationModel() const {
66 return Reloc::Default;
67 return CodeGenInfo->getRelocationModel();
70 /// getCodeModel - Returns the code model. The choices are small, kernel,
71 /// medium, large, and target default.
72 CodeModel::Model TargetMachine::getCodeModel() const {
74 return CodeModel::Default;
75 return CodeGenInfo->getCodeModel();
78 /// getOptLevel - Returns the optimization level: None, Less,
79 /// Default, or Aggressive.
80 CodeGenOpt::Level TargetMachine::getOptLevel() const {
82 return CodeGenOpt::Default;
83 return CodeGenInfo->getOptLevel();
86 bool TargetMachine::getAsmVerbosityDefault() {
87 return AsmVerbosityDefault;
90 void TargetMachine::setAsmVerbosityDefault(bool V) {
91 AsmVerbosityDefault = V;
94 bool TargetMachine::getFunctionSections() {
95 return FunctionSections;
98 bool TargetMachine::getDataSections() {
102 void TargetMachine::setFunctionSections(bool V) {
103 FunctionSections = V;
106 void TargetMachine::setDataSections(bool V) {