blob: ee152d41b378e047868190f3dd68dfc34dfe66e8 [file] [log] [blame]
Chris Lattner72614082002-10-25 22:55:53 +00001//===-- X86.h - Top-level interface for X86 representation ------*- C++ -*-===//
2//
3// This file contains the entry points for global functions defined in the x86
4// target library, as used by the LLVM JIT.
5//
6// FIXME: This file will be dramatically changed in the future
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef TARGET_X86_H
11#define TARGET_X86_H
12
13#include <iosfwd>
Chris Lattnera535fab2002-10-29 17:43:38 +000014class TargetMachine;
Chris Lattnerb4f68ed2002-10-29 22:37:54 +000015class Pass;
Chris Lattner72614082002-10-25 22:55:53 +000016
Chris Lattnerb4f68ed2002-10-29 22:37:54 +000017/// createSimpleX86InstructionSelector - This pass converts an LLVM function
18/// into a machine code representation is a very simple peep-hole fashion. The
Chris Lattner72614082002-10-25 22:55:53 +000019/// generated code sucks but the implementation is nice and simple.
20///
Chris Lattnerb4f68ed2002-10-29 22:37:54 +000021Pass *createSimpleX86InstructionSelector(TargetMachine &TM);
Chris Lattner72614082002-10-25 22:55:53 +000022
Chris Lattner1a456262002-12-16 14:38:13 +000023/// createSimpleRegisterAllocation - This function converts the specified
24/// machine code function from SSA form to use explicit registers by spilling
25/// every register. Wow, great policy huh?
Chris Lattner72614082002-10-25 22:55:53 +000026///
Chris Lattner1a456262002-12-16 14:38:13 +000027Pass *createSimpleRegisterAllocator(TargetMachine &TM);
Chris Lattnerc2fc7ea2002-12-16 15:55:51 +000028Pass *createLocalRegisterAllocator(TargetMachine &TM);
Chris Lattnerb4f68ed2002-10-29 22:37:54 +000029
30/// createX86CodePrinterPass - Print out the specified machine code function to
31/// the specified stream. This function should work regardless of whether or
32/// not the function is in SSA form or not.
33///
34Pass *createX86CodePrinterPass(TargetMachine &TM, std::ostream &O);
Chris Lattner72614082002-10-25 22:55:53 +000035
36/// X86EmitCodeToMemory - This function converts a register allocated function
37/// into raw machine code in a dynamically allocated chunk of memory. A pointer
38/// to the start of the function is returned.
39///
Chris Lattnerb4f68ed2002-10-29 22:37:54 +000040Pass *createEmitX86CodeToMemory(TargetMachine &TM);
Chris Lattner72614082002-10-25 22:55:53 +000041
42// Put symbolic names in a namespace to avoid causing these to clash with all
43// kinds of other things...
44//
45namespace X86 {
46 // Defines a large number of symbolic names for X86 registers. This defines a
47 // mapping from register name to register number.
48 //
49 enum Register {
Chris Lattner92aec042002-12-16 16:14:51 +000050#define R(ENUM, NAME, FLAGS, TSFLAGS, ALIAS_SET) ENUM,
Chris Lattner72614082002-10-25 22:55:53 +000051#include "X86RegisterInfo.def"
52 };
53
54 // This defines a large number of symbolic names for X86 instruction opcodes.
55 enum Opcode {
Chris Lattner4ce42a72002-12-03 05:42:53 +000056#define I(ENUM, NAME, BASEOPCODE, FLAGS, TSFLAGS, IMPDEFS, IMPUSES) ENUM,
Chris Lattner055c9652002-10-29 21:05:24 +000057#include "X86InstrInfo.def"
Chris Lattner72614082002-10-25 22:55:53 +000058 };
59}
60
61#endif