1 //===-- TargetMachine.cpp - General Target Information ---------------------==//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file describes the general parts of a Target machine.
12 //===----------------------------------------------------------------------===//
14 #include "llvm/Target/TargetMachine.h"
15 #include "llvm/Type.h"
16 #include "llvm/CodeGen/IntrinsicLowering.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 PrintMachineCode;
26 bool NoFramePointerElim;
27 bool NoExcessFPPrecision;
30 cl::opt<bool, true> PrintCode("print-machineinstrs",
31 cl::desc("Print generated machine code"),
32 cl::location(PrintMachineCode), cl::init(false));
35 DisableFPElim("disable-fp-elim",
36 cl::desc("Disable frame pointer elimination optimization"),
37 cl::location(NoFramePointerElim),
40 DisableExcessPrecision("disable-excess-fp-precision",
41 cl::desc("Disable optimizations that may increase FP precision"),
42 cl::location(NoExcessFPPrecision),
46 //---------------------------------------------------------------------------
47 // TargetMachine Class
49 TargetMachine::TargetMachine(const std::string &name, IntrinsicLowering *il,
51 unsigned char PtrSize, unsigned char PtrAl,
52 unsigned char DoubleAl, unsigned char FloatAl,
53 unsigned char LongAl, unsigned char IntAl,
54 unsigned char ShortAl, unsigned char ByteAl,
56 : Name(name), DataLayout(name, LittleEndian,
57 PtrSize, PtrAl, DoubleAl, FloatAl, LongAl,
58 IntAl, ShortAl, ByteAl, BoolAl) {
59 IL = il ? il : new DefaultIntrinsicLowering();
62 TargetMachine::TargetMachine(const std::string &name, IntrinsicLowering *il,
64 : Name(name), DataLayout(TD) {
65 IL = il ? il : new DefaultIntrinsicLowering();
68 TargetMachine::TargetMachine(const std::string &name, IntrinsicLowering *il,
70 : Name(name), DataLayout(name, &M) {
71 IL = il ? il : new DefaultIntrinsicLowering();
74 TargetMachine::~TargetMachine() {