blob: b2176aa1ebec90547ffa5827d6b1eca56b566f22 [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 Lattnerf2ab4122002-12-28 20:26:16 +000023/// createSimpleRegisterAllocation - This function returns a pass that converts
24/// the specified machine code function from SSA form to use explicit registers
25/// by spilling every register. Wow, great policy huh?
Chris Lattner72614082002-10-25 22:55:53 +000026///
Chris Lattnerf2ab4122002-12-28 20:26:16 +000027Pass *createSimpleRegisterAllocator();
28Pass *createLocalRegisterAllocator();
29
30/// createPrologEpilogCodeInserter - This function returns a pass that inserts
31/// prolog and epilog code, and eliminates abstract frame references.
32///
33Pass *createPrologEpilogCodeInserter();
Chris Lattnerb4f68ed2002-10-29 22:37:54 +000034
35/// createX86CodePrinterPass - Print out the specified machine code function to
36/// the specified stream. This function should work regardless of whether or
37/// not the function is in SSA form or not.
38///
Chris Lattnerf2ab4122002-12-28 20:26:16 +000039Pass *createX86CodePrinterPass(std::ostream &O);
Chris Lattner72614082002-10-25 22:55:53 +000040
41/// X86EmitCodeToMemory - This function converts a register allocated function
42/// into raw machine code in a dynamically allocated chunk of memory. A pointer
43/// to the start of the function is returned.
44///
Chris Lattnerf2ab4122002-12-28 20:26:16 +000045Pass *createEmitX86CodeToMemory();
Chris Lattner72614082002-10-25 22:55:53 +000046
47// Put symbolic names in a namespace to avoid causing these to clash with all
48// kinds of other things...
49//
50namespace X86 {
51 // Defines a large number of symbolic names for X86 registers. This defines a
52 // mapping from register name to register number.
53 //
54 enum Register {
Chris Lattner92aec042002-12-16 16:14:51 +000055#define R(ENUM, NAME, FLAGS, TSFLAGS, ALIAS_SET) ENUM,
Chris Lattner72614082002-10-25 22:55:53 +000056#include "X86RegisterInfo.def"
57 };
58
59 // This defines a large number of symbolic names for X86 instruction opcodes.
60 enum Opcode {
Chris Lattner4ce42a72002-12-03 05:42:53 +000061#define I(ENUM, NAME, BASEOPCODE, FLAGS, TSFLAGS, IMPDEFS, IMPUSES) ENUM,
Chris Lattner055c9652002-10-29 21:05:24 +000062#include "X86InstrInfo.def"
Chris Lattner72614082002-10-25 22:55:53 +000063 };
64}
65
66#endif