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.
25 bool HasDivModLibcall;
26 bool AsmVerbosityDefault(false);
30 DataSections("fdata-sections",
31 cl::desc("Emit data into separate sections"),
34 FunctionSections("ffunction-sections",
35 cl::desc("Emit functions into separate sections"),
38 //---------------------------------------------------------------------------
39 // TargetMachine Class
42 TargetMachine::TargetMachine(const Target &T,
43 StringRef TT, StringRef CPU, StringRef FS,
44 const TargetOptions &Options)
45 : TheTarget(T), TargetTriple(TT), TargetCPU(CPU), TargetFS(FS),
46 CodeGenInfo(0), AsmInfo(0),
49 MCSaveTempLabels(false),
52 MCUseDwarfDirectory(false),
56 TargetMachine::~TargetMachine() {
61 /// getRelocationModel - Returns the code generation relocation model. The
62 /// choices are static, PIC, and dynamic-no-pic, and target default.
63 Reloc::Model TargetMachine::getRelocationModel() const {
65 return Reloc::Default;
66 return CodeGenInfo->getRelocationModel();
69 /// getCodeModel - Returns the code model. The choices are small, kernel,
70 /// medium, large, and target default.
71 CodeModel::Model TargetMachine::getCodeModel() const {
73 return CodeModel::Default;
74 return CodeGenInfo->getCodeModel();
77 /// getOptLevel - Returns the optimization level: None, Less,
78 /// Default, or Aggressive.
79 CodeGenOpt::Level TargetMachine::getOptLevel() const {
81 return CodeGenOpt::Default;
82 return CodeGenInfo->getOptLevel();
85 bool TargetMachine::getAsmVerbosityDefault() {
86 return AsmVerbosityDefault;
89 void TargetMachine::setAsmVerbosityDefault(bool V) {
90 AsmVerbosityDefault = V;
93 bool TargetMachine::getFunctionSections() {
94 return FunctionSections;
97 bool TargetMachine::getDataSections() {
101 void TargetMachine::setFunctionSections(bool V) {
102 FunctionSections = V;
105 void TargetMachine::setDataSections(bool V) {