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;
28 int PatternISelTriState;
32 cl::opt<bool, true> PrintCode("print-machineinstrs",
33 cl::desc("Print generated machine code"),
34 cl::location(PrintMachineCode), cl::init(false));
37 DisableFPElim("disable-fp-elim",
38 cl::desc("Disable frame pointer elimination optimization"),
39 cl::location(NoFramePointerElim),
42 DisableExcessPrecision("disable-excess-fp-precision",
43 cl::desc("Disable optimizations that may increase FP precision"),
44 cl::location(NoExcessFPPrecision),
46 cl::opt<int, true> PatternISel("enable-pattern-isel",
47 cl::desc("sets the pattern ISel off(0), on(1), default(2)"),
48 cl::location(PatternISelTriState),
51 EnableUnsafeFPMath("enable-unsafe-fp-math",
52 cl::desc("Enable optimizations that may decrease FP precision"),
53 cl::location(UnsafeFPMath),
57 //---------------------------------------------------------------------------
58 // TargetMachine Class
60 TargetMachine::TargetMachine(const std::string &name, IntrinsicLowering *il,
62 unsigned char PtrSize, unsigned char PtrAl,
63 unsigned char DoubleAl, unsigned char FloatAl,
64 unsigned char LongAl, unsigned char IntAl,
65 unsigned char ShortAl, unsigned char ByteAl,
67 : Name(name), DataLayout(name, LittleEndian,
68 PtrSize, PtrAl, DoubleAl, FloatAl, LongAl,
69 IntAl, ShortAl, ByteAl, BoolAl) {
70 IL = il ? il : new DefaultIntrinsicLowering();
73 TargetMachine::TargetMachine(const std::string &name, IntrinsicLowering *il,
75 : Name(name), DataLayout(TD) {
76 IL = il ? il : new DefaultIntrinsicLowering();
79 TargetMachine::TargetMachine(const std::string &name, IntrinsicLowering *il,
81 : Name(name), DataLayout(name, &M) {
82 IL = il ? il : new DefaultIntrinsicLowering();
85 TargetMachine::~TargetMachine() {