CodeGenTarget.h revision 01d45827a1e512f3b19ba857772bf02baa3c0c4e
145872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattner//===- CodeGenWrappers.h - Code Generation Class Wrappers -------*- C++ -*-===// 201d45827a1e512f3b19ba857772bf02baa3c0c4eJohn Criswell// 301d45827a1e512f3b19ba857772bf02baa3c0c4eJohn Criswell// The LLVM Compiler Infrastructure 401d45827a1e512f3b19ba857772bf02baa3c0c4eJohn Criswell// 501d45827a1e512f3b19ba857772bf02baa3c0c4eJohn Criswell// This file was developed by the LLVM research group and is distributed under 601d45827a1e512f3b19ba857772bf02baa3c0c4eJohn Criswell// the University of Illinois Open Source License. See LICENSE.TXT for details. 701d45827a1e512f3b19ba857772bf02baa3c0c4eJohn Criswell// 801d45827a1e512f3b19ba857772bf02baa3c0c4eJohn Criswell//===----------------------------------------------------------------------===// 945872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattner// 1045872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattner// These classes wrap target description classes used by the various code 1145872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattner// generation TableGen backends. This makes it easier to access the data and 1245872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattner// provides a single place that needs to check it for validity. All of these 1345872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattner// classes throw exceptions on error conditions. 1445872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattner// 1545872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattner//===----------------------------------------------------------------------===// 1645872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattner 1745872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattner#ifndef CODEGENWRAPPERS_H 1845872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattner#define CODEGENWRAPPERS_H 1945872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattner 2045872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattner#include "llvm/CodeGen/ValueTypes.h" 2145872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattner#include <iosfwd> 226ad90765541c688d955437548bf6cc3799f6c7afMisha Brukman#include <string> 2345872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattner#include <vector> 2445872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattnerclass Record; 2545872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattnerclass RecordKeeper; 2645872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattner 2745872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattner/// getValueType - Return the MVT::ValueType that the specified TableGen record 2845872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattner/// corresponds to. 2945872079672a4fb500fdcb9c77b23e3e550c8f97Chris LattnerMVT::ValueType getValueType(Record *Rec); 3045872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattner 3145872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattnerstd::ostream &operator<<(std::ostream &OS, MVT::ValueType T); 32d3464c19a8b6acecd8a9618489ec7612505fd4bdChris Lattnerstd::string getName(MVT::ValueType T); 33b72fb7ef75862269879ecaaf8e31c5d9a6bb56e5Chris Lattnerstd::string getEnumName(MVT::ValueType T); 3445872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattner 3545872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattner 3645872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattner/// CodeGenTarget - This class corresponds to the Target class in the .td files. 3745872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattner/// 3845872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattnerclass CodeGenTarget { 3945872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattner Record *TargetRec; 4045872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattner std::vector<Record*> CalleeSavedRegisters; 4145872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattner MVT::ValueType PointerType; 4245872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattner 4345872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattnerpublic: 4445872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattner CodeGenTarget(); 4545872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattner 4645872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattner Record *getTargetRecord() const { return TargetRec; } 4745872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattner const std::string &getName() const; 4845872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattner 4945872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattner const std::vector<Record*> &getCalleeSavedRegisters() const { 5045872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattner return CalleeSavedRegisters; 5145872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattner } 5245872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattner 5354c66feed926f6cdaf544895f78b5bb1ead6f0eaChris Lattner MVT::ValueType getPointerType() const { return PointerType; } 5454c66feed926f6cdaf544895f78b5bb1ead6f0eaChris Lattner 5545872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattner // getInstructionSet - Return the InstructionSet object... 5645872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattner Record *getInstructionSet() const; 5745872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattner 5845872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattner // getInstructionSet - Return the CodeGenInstructionSet object for this 5945872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattner // target, lazily reading it from the record keeper as needed. 6045872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattner // CodeGenInstructionSet *getInstructionSet - 6145872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattner}; 6245872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattner 6345872079672a4fb500fdcb9c77b23e3e550c8f97Chris Lattner#endif 64