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