Andrew Lenharth | 886470e | 2005-01-24 18:45:41 +0000 | [diff] [blame] | 1 | //===-- AlphaTargetMachine.cpp - Define TargetMachine for Alpha -----------===// |
Misha Brukman | 4633f1c | 2005-04-21 23:13:11 +0000 | [diff] [blame] | 2 | // |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | 4ee451d | 2007-12-29 20:36:04 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Misha Brukman | 4633f1c | 2005-04-21 23:13:11 +0000 | [diff] [blame] | 7 | // |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 8 | //===----------------------------------------------------------------------===// |
Misha Brukman | 4633f1c | 2005-04-21 23:13:11 +0000 | [diff] [blame] | 9 | // |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 10 | // |
| 11 | //===----------------------------------------------------------------------===// |
| 12 | |
| 13 | #include "Alpha.h" |
Andrew Lenharth | 0934ae0 | 2005-07-22 20:52:16 +0000 | [diff] [blame] | 14 | #include "AlphaJITInfo.h" |
Jim Laskey | fde1b3b | 2006-09-07 23:39:26 +0000 | [diff] [blame] | 15 | #include "AlphaTargetAsmInfo.h" |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 16 | #include "AlphaTargetMachine.h" |
Chris Lattner | 1911fd4 | 2006-09-04 04:14:57 +0000 | [diff] [blame] | 17 | #include "llvm/PassManager.h" |
David Greene | 7184781 | 2009-07-14 20:18:05 +0000 | [diff] [blame] | 18 | #include "llvm/Support/FormattedStream.h" |
Daniel Dunbar | 0c795d6 | 2009-07-25 06:49:55 +0000 | [diff] [blame] | 19 | #include "llvm/Target/TargetRegistry.h" |
Andrew Lenharth | 2f40163 | 2005-02-01 20:35:11 +0000 | [diff] [blame] | 20 | |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 21 | using namespace llvm; |
| 22 | |
Daniel Dunbar | 0c795d6 | 2009-07-25 06:49:55 +0000 | [diff] [blame] | 23 | extern "C" void LLVMInitializeAlphaTarget() { |
| 24 | // Register the target. |
| 25 | RegisterTargetMachine<AlphaTargetMachine> X(TheAlphaTarget); |
| 26 | } |
Douglas Gregor | 1555a23 | 2009-06-16 20:12:29 +0000 | [diff] [blame] | 27 | |
Jim Laskey | fde1b3b | 2006-09-07 23:39:26 +0000 | [diff] [blame] | 28 | const TargetAsmInfo *AlphaTargetMachine::createTargetAsmInfo() const { |
Chris Lattner | f67de7a | 2009-08-02 04:46:05 +0000 | [diff] [blame] | 29 | return new AlphaTargetAsmInfo(); |
Jim Laskey | fde1b3b | 2006-09-07 23:39:26 +0000 | [diff] [blame] | 30 | } |
| 31 | |
Daniel Dunbar | e28039c | 2009-08-02 23:37:13 +0000 | [diff] [blame] | 32 | AlphaTargetMachine::AlphaTargetMachine(const Target &T, const std::string &TT, |
Daniel Dunbar | 51b198a | 2009-07-15 20:24:03 +0000 | [diff] [blame] | 33 | const std::string &FS) |
Chris Lattner | 0a31d2f | 2009-08-11 20:42:37 +0000 | [diff] [blame^] | 34 | : LLVMTargetMachine(T, TT), |
Daniel Dunbar | 51b198a | 2009-07-15 20:24:03 +0000 | [diff] [blame] | 35 | DataLayout("e-f128:128:128"), |
Andrew Lenharth | dc7c0b8 | 2005-08-03 22:33:21 +0000 | [diff] [blame] | 36 | FrameInfo(TargetFrameInfo::StackGrowsDown, 16, 0), |
Andrew Lenharth | 120ab48 | 2005-09-29 22:54:56 +0000 | [diff] [blame] | 37 | JITInfo(*this), |
Daniel Dunbar | e28039c | 2009-08-02 23:37:13 +0000 | [diff] [blame] | 38 | Subtarget(TT, FS), |
Andrew Lenharth | 82c3d8f | 2006-10-11 04:29:42 +0000 | [diff] [blame] | 39 | TLInfo(*this) { |
Andrew Lenharth | 0607a2f | 2006-09-24 19:46:56 +0000 | [diff] [blame] | 40 | setRelocationModel(Reloc::PIC_); |
Andrew Lenharth | 120ab48 | 2005-09-29 22:54:56 +0000 | [diff] [blame] | 41 | } |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 42 | |
Misha Brukman | 4633f1c | 2005-04-21 23:13:11 +0000 | [diff] [blame] | 43 | |
Chris Lattner | 1911fd4 | 2006-09-04 04:14:57 +0000 | [diff] [blame] | 44 | //===----------------------------------------------------------------------===// |
| 45 | // Pass Pipeline Configuration |
| 46 | //===----------------------------------------------------------------------===// |
Andrew Lenharth | e4f161c | 2005-03-02 17:21:38 +0000 | [diff] [blame] | 47 | |
Bill Wendling | be8cc2a | 2009-04-29 00:15:41 +0000 | [diff] [blame] | 48 | bool AlphaTargetMachine::addInstSelector(PassManagerBase &PM, |
Bill Wendling | 98a366d | 2009-04-29 23:29:43 +0000 | [diff] [blame] | 49 | CodeGenOpt::Level OptLevel) { |
Andrew Lenharth | fabd5ba | 2006-01-23 21:56:07 +0000 | [diff] [blame] | 50 | PM.add(createAlphaISelDag(*this)); |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 51 | return false; |
| 52 | } |
Bill Wendling | be8cc2a | 2009-04-29 00:15:41 +0000 | [diff] [blame] | 53 | bool AlphaTargetMachine::addPreEmitPass(PassManagerBase &PM, |
Bill Wendling | 98a366d | 2009-04-29 23:29:43 +0000 | [diff] [blame] | 54 | CodeGenOpt::Level OptLevel) { |
Andrew Lenharth | 0934ae0 | 2005-07-22 20:52:16 +0000 | [diff] [blame] | 55 | // Must run branch selection immediately preceding the asm printer |
Andrew Lenharth | f81173f | 2006-10-31 16:49:55 +0000 | [diff] [blame] | 56 | PM.add(createAlphaBranchSelectionPass()); |
Chris Lattner | 7add5ff | 2009-07-15 21:40:24 +0000 | [diff] [blame] | 57 | PM.add(createAlphaLLRPPass(*this)); |
Chris Lattner | 1911fd4 | 2006-09-04 04:14:57 +0000 | [diff] [blame] | 58 | return false; |
Andrew Lenharth | 0934ae0 | 2005-07-22 20:52:16 +0000 | [diff] [blame] | 59 | } |
Bill Wendling | 98a366d | 2009-04-29 23:29:43 +0000 | [diff] [blame] | 60 | bool AlphaTargetMachine::addCodeEmitter(PassManagerBase &PM, |
| 61 | CodeGenOpt::Level OptLevel, |
Daniel Dunbar | cfe9a60 | 2009-07-15 22:33:19 +0000 | [diff] [blame] | 62 | MachineCodeEmitter &MCE) { |
Evan Cheng | 55fc280 | 2006-07-25 20:40:54 +0000 | [diff] [blame] | 63 | PM.add(createAlphaCodeEmitterPass(*this, MCE)); |
Andrew Lenharth | 0934ae0 | 2005-07-22 20:52:16 +0000 | [diff] [blame] | 64 | return false; |
| 65 | } |
Bruno Cardoso Lopes | a3f99f9 | 2009-05-30 20:51:52 +0000 | [diff] [blame] | 66 | bool AlphaTargetMachine::addCodeEmitter(PassManagerBase &PM, |
| 67 | CodeGenOpt::Level OptLevel, |
Daniel Dunbar | cfe9a60 | 2009-07-15 22:33:19 +0000 | [diff] [blame] | 68 | JITCodeEmitter &JCE) { |
Bruno Cardoso Lopes | a3f99f9 | 2009-05-30 20:51:52 +0000 | [diff] [blame] | 69 | PM.add(createAlphaJITCodeEmitterPass(*this, JCE)); |
Bruno Cardoso Lopes | a3f99f9 | 2009-05-30 20:51:52 +0000 | [diff] [blame] | 70 | return false; |
| 71 | } |
Bruno Cardoso Lopes | ac57e6e | 2009-07-06 05:09:34 +0000 | [diff] [blame] | 72 | bool AlphaTargetMachine::addCodeEmitter(PassManagerBase &PM, |
| 73 | CodeGenOpt::Level OptLevel, |
Daniel Dunbar | cfe9a60 | 2009-07-15 22:33:19 +0000 | [diff] [blame] | 74 | ObjectCodeEmitter &OCE) { |
Bruno Cardoso Lopes | ac57e6e | 2009-07-06 05:09:34 +0000 | [diff] [blame] | 75 | PM.add(createAlphaObjectCodeEmitterPass(*this, OCE)); |
Bruno Cardoso Lopes | ac57e6e | 2009-07-06 05:09:34 +0000 | [diff] [blame] | 76 | return false; |
| 77 | } |
Dan Gohman | bfae831 | 2008-03-11 22:29:46 +0000 | [diff] [blame] | 78 | bool AlphaTargetMachine::addSimpleCodeEmitter(PassManagerBase &PM, |
Bill Wendling | 98a366d | 2009-04-29 23:29:43 +0000 | [diff] [blame] | 79 | CodeGenOpt::Level OptLevel, |
Bill Wendling | 50e4e88 | 2007-02-08 01:38:33 +0000 | [diff] [blame] | 80 | MachineCodeEmitter &MCE) { |
Daniel Dunbar | cfe9a60 | 2009-07-15 22:33:19 +0000 | [diff] [blame] | 81 | return addCodeEmitter(PM, OptLevel, MCE); |
Bill Wendling | 50e4e88 | 2007-02-08 01:38:33 +0000 | [diff] [blame] | 82 | } |
Bruno Cardoso Lopes | a3f99f9 | 2009-05-30 20:51:52 +0000 | [diff] [blame] | 83 | bool AlphaTargetMachine::addSimpleCodeEmitter(PassManagerBase &PM, |
| 84 | CodeGenOpt::Level OptLevel, |
Bruno Cardoso Lopes | a3f99f9 | 2009-05-30 20:51:52 +0000 | [diff] [blame] | 85 | JITCodeEmitter &JCE) { |
Daniel Dunbar | cfe9a60 | 2009-07-15 22:33:19 +0000 | [diff] [blame] | 86 | return addCodeEmitter(PM, OptLevel, JCE); |
Bruno Cardoso Lopes | a3f99f9 | 2009-05-30 20:51:52 +0000 | [diff] [blame] | 87 | } |
Bruno Cardoso Lopes | ac57e6e | 2009-07-06 05:09:34 +0000 | [diff] [blame] | 88 | bool AlphaTargetMachine::addSimpleCodeEmitter(PassManagerBase &PM, |
| 89 | CodeGenOpt::Level OptLevel, |
Bruno Cardoso Lopes | ac57e6e | 2009-07-06 05:09:34 +0000 | [diff] [blame] | 90 | ObjectCodeEmitter &OCE) { |
Daniel Dunbar | cfe9a60 | 2009-07-15 22:33:19 +0000 | [diff] [blame] | 91 | return addCodeEmitter(PM, OptLevel, OCE); |
Bruno Cardoso Lopes | ac57e6e | 2009-07-06 05:09:34 +0000 | [diff] [blame] | 92 | } |
Bruno Cardoso Lopes | a3f99f9 | 2009-05-30 20:51:52 +0000 | [diff] [blame] | 93 | |