blob: 81c68da58e9b1e5cd522828e3165826db29dffa3 [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//
Chris Lattner72614082002-10-25 22:55:53 +00006//===----------------------------------------------------------------------===//
7
8#ifndef TARGET_X86_H
9#define TARGET_X86_H
10
11#include <iosfwd>
Chris Lattnera535fab2002-10-29 17:43:38 +000012class TargetMachine;
Chris Lattnerb4f68ed2002-10-29 22:37:54 +000013class Pass;
Chris Lattner72614082002-10-25 22:55:53 +000014
Chris Lattnerb4f68ed2002-10-29 22:37:54 +000015/// createSimpleX86InstructionSelector - This pass converts an LLVM function
16/// into a machine code representation is a very simple peep-hole fashion. The
Chris Lattner72614082002-10-25 22:55:53 +000017/// generated code sucks but the implementation is nice and simple.
18///
Chris Lattnerb4f68ed2002-10-29 22:37:54 +000019Pass *createSimpleX86InstructionSelector(TargetMachine &TM);
Chris Lattner72614082002-10-25 22:55:53 +000020
Chris Lattner31ad5dd2003-01-13 00:45:29 +000021/// createX86PeepholeOptimizer - Create a pass to perform X86 specific peephole
22/// optimizations.
Chris Lattner72614082002-10-25 22:55:53 +000023///
Chris Lattner31ad5dd2003-01-13 00:45:29 +000024Pass *createX86PeepholeOptimizerPass();
Chris Lattnerf2ab4122002-12-28 20:26:16 +000025
Chris Lattner31ad5dd2003-01-13 00:45:29 +000026/// createX86FloatingPointStackifierPass - This function returns a pass which
27/// converts floating point register references and pseudo instructions into
28/// floating point stack references and physical instructions.
Chris Lattnerf2ab4122002-12-28 20:26:16 +000029///
Chris Lattner31ad5dd2003-01-13 00:45:29 +000030Pass *createX86FloatingPointStackifierPass();
Chris Lattnerb4f68ed2002-10-29 22:37:54 +000031
Brian Gaekede420ae2003-07-23 20:25:08 +000032/// createX86CodePrinterPass - Returns a pass that prints the X86
33/// assembly code for a MachineFunction to the given output stream,
34/// using the given target machine description. This should work
35/// regardless of whether the function is in SSA form.
Chris Lattnerb4f68ed2002-10-29 22:37:54 +000036///
Brian Gaekede420ae2003-07-23 20:25:08 +000037Pass *createX86CodePrinterPass(std::ostream &o, TargetMachine &tm);
Chris Lattner72614082002-10-25 22:55:53 +000038
39/// X86EmitCodeToMemory - This function converts a register allocated function
40/// into raw machine code in a dynamically allocated chunk of memory. A pointer
41/// to the start of the function is returned.
42///
Chris Lattnerf2ab4122002-12-28 20:26:16 +000043Pass *createEmitX86CodeToMemory();
Chris Lattner72614082002-10-25 22:55:53 +000044
Chris Lattnerff3261a2003-06-03 15:31:23 +000045/// X86 namespace - This namespace contains all of the register and opcode enums
46/// used by the X86 backend.
47///
Chris Lattner72614082002-10-25 22:55:53 +000048namespace X86 {
49 // Defines a large number of symbolic names for X86 registers. This defines a
50 // mapping from register name to register number.
51 //
52 enum Register {
Chris Lattner92aec042002-12-16 16:14:51 +000053#define R(ENUM, NAME, FLAGS, TSFLAGS, ALIAS_SET) ENUM,
Chris Lattner72614082002-10-25 22:55:53 +000054#include "X86RegisterInfo.def"
55 };
56
57 // This defines a large number of symbolic names for X86 instruction opcodes.
58 enum Opcode {
Chris Lattner4ce42a72002-12-03 05:42:53 +000059#define I(ENUM, NAME, BASEOPCODE, FLAGS, TSFLAGS, IMPDEFS, IMPUSES) ENUM,
Chris Lattner055c9652002-10-29 21:05:24 +000060#include "X86InstrInfo.def"
Chris Lattner72614082002-10-25 22:55:53 +000061 };
62}
63
64#endif