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