blob: 8e114fc0b271f5f3bc14862c2148ee18a037634d [file] [log] [blame]
Chris Lattnerb26bcc52001-09-14 05:34:53 +00001//===-- TargetMachine.cpp - General Target Information ---------------------==//
John Criswellb576c942003-10-20 19:43:21 +00002//
3// The LLVM Compiler Infrastructure
4//
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.
7//
8//===----------------------------------------------------------------------===//
Chris Lattnerb26bcc52001-09-14 05:34:53 +00009//
10// This file describes the general parts of a Target machine.
11//
12//===----------------------------------------------------------------------===//
Vikram S. Advedaae6992001-07-21 12:42:08 +000013
Misha Brukmane67d5fb2004-06-21 21:20:23 +000014#include "llvm/Target/TargetMachine.h"
Chris Lattner93fa7052002-10-28 23:55:33 +000015#include "llvm/Type.h"
Chris Lattner30483732004-06-20 07:49:54 +000016#include "llvm/CodeGen/IntrinsicLowering.h"
Brian Gaeke323819e2004-03-04 19:16:23 +000017#include "Support/CommandLine.h"
Chris Lattnerf70e0c22003-12-28 21:23:38 +000018using namespace llvm;
Brian Gaeked0fde302003-11-11 22:41:34 +000019
Vikram S. Advee1f72802002-09-16 15:39:26 +000020//---------------------------------------------------------------------------
Brian Gaeke323819e2004-03-04 19:16:23 +000021// Command-line options that tend to be useful on more than one back-end.
22//
23
Misha Brukman53594de2004-06-21 21:21:49 +000024bool llvm::PrintMachineCode;
25bool llvm::NoFramePointerElim;
Misha Brukman0fb5a662004-06-21 21:08:45 +000026
Brian Gaeke323819e2004-03-04 19:16:23 +000027namespace {
28 cl::opt<bool, true> PrintCode("print-machineinstrs",
29 cl::desc("Print generated machine code"),
30 cl::location(PrintMachineCode), cl::init(false));
Misha Brukman0fb5a662004-06-21 21:08:45 +000031
32 cl::opt<bool, true>
33 DisableFPElim("disable-fp-elim",
34 cl::desc("Disable frame pointer elimination optimization"),
Misha Brukman66d6ee42004-06-21 21:17:44 +000035 cl::location(NoFramePointerElim),
36 cl::init(false));
Brian Gaeke323819e2004-03-04 19:16:23 +000037};
38
39//---------------------------------------------------------------------------
Chris Lattnerf70e0c22003-12-28 21:23:38 +000040// TargetMachine Class
41//
42TargetMachine::TargetMachine(const std::string &name, IntrinsicLowering *il,
43 bool LittleEndian,
44 unsigned char PtrSize, unsigned char PtrAl,
45 unsigned char DoubleAl, unsigned char FloatAl,
46 unsigned char LongAl, unsigned char IntAl,
47 unsigned char ShortAl, unsigned char ByteAl)
48 : Name(name), DataLayout(name, LittleEndian,
49 PtrSize, PtrAl, DoubleAl, FloatAl, LongAl,
50 IntAl, ShortAl, ByteAl) {
51 IL = il ? il : new DefaultIntrinsicLowering();
52}
Chris Lattner2bed9ec2004-03-03 02:12:47 +000053TargetMachine::TargetMachine(const std::string &name, IntrinsicLowering *il,
54 const Module &M)
55 : Name(name), DataLayout(name, &M) {
56 IL = il ? il : new DefaultIntrinsicLowering();
57}
Vikram S. Advedaae6992001-07-21 12:42:08 +000058
Chris Lattnerf70e0c22003-12-28 21:23:38 +000059TargetMachine::~TargetMachine() {
60 delete IL;
61}
62