From 3d7125cd6665a303e315aad36794314c1481e1c0 Mon Sep 17 00:00:00 2001 From: Brian Gaeke Date: Thu, 23 Oct 2003 20:31:51 +0000 Subject: [PATCH] New file, containing AllocInfo structure. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9449 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/RegAlloc/AllocInfo.h | 61 +++++++++++++++++++++++++ lib/Target/SparcV9/RegAlloc/AllocInfo.h | 61 +++++++++++++++++++++++++ 2 files changed, 122 insertions(+) create mode 100644 lib/CodeGen/RegAlloc/AllocInfo.h create mode 100644 lib/Target/SparcV9/RegAlloc/AllocInfo.h diff --git a/lib/CodeGen/RegAlloc/AllocInfo.h b/lib/CodeGen/RegAlloc/AllocInfo.h new file mode 100644 index 00000000000..ad230506fb3 --- /dev/null +++ b/lib/CodeGen/RegAlloc/AllocInfo.h @@ -0,0 +1,61 @@ +//===-- AllocInfo.h - Store info about regalloc decisions -------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by the LLVM research group and is distributed under +// the University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This header file contains the data structure used to save the state +// of the global, graph-coloring register allocator. +// +//===----------------------------------------------------------------------===// + +#ifndef ALLOCINFO_H +#define ALLOCINFO_H + +#include "llvm/Type.h" +#include "llvm/DerivedTypes.h" +#include "llvm/Constants.h" + +/// AllocInfo - Structure representing one instruction's operand's-worth of +/// register allocation state. We create tables made out of these data +/// structures to generate mapping information for this register allocator. +/// +struct AllocInfo { + unsigned Instruction; + unsigned Operand; + unsigned AllocState; + int Placement; + AllocInfo (unsigned Instruction_, unsigned Operand_, + unsigned AllocState_, int Placement_) : + Instruction (Instruction_), Operand (Operand_), + AllocState (AllocState_), Placement (Placement_) { } + + /// getConstantType - Return a StructType representing an AllocInfo object. + /// + static StructType *getConstantType () { + std::vector TV; + TV.push_back (Type::UIntTy); + TV.push_back (Type::UIntTy); + TV.push_back (Type::UIntTy); + TV.push_back (Type::IntTy); + return StructType::get (TV); + } + + /// toConstant - Convert this AllocInfo into an LLVM Constant of type + /// getConstantType(), and return the Constant. + /// + Constant *toConstant () const { + StructType *ST = getConstantType (); + std::vector CV; + CV.push_back (ConstantUInt::get (Type::UIntTy, Instruction)); + CV.push_back (ConstantUInt::get (Type::UIntTy, Operand)); + CV.push_back (ConstantUInt::get (Type::UIntTy, AllocState)); + CV.push_back (ConstantSInt::get (Type::IntTy, Placement)); + return ConstantStruct::get (ST, CV); + } +}; + +#endif // ALLOCINFO_H diff --git a/lib/Target/SparcV9/RegAlloc/AllocInfo.h b/lib/Target/SparcV9/RegAlloc/AllocInfo.h new file mode 100644 index 00000000000..ad230506fb3 --- /dev/null +++ b/lib/Target/SparcV9/RegAlloc/AllocInfo.h @@ -0,0 +1,61 @@ +//===-- AllocInfo.h - Store info about regalloc decisions -------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by the LLVM research group and is distributed under +// the University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This header file contains the data structure used to save the state +// of the global, graph-coloring register allocator. +// +//===----------------------------------------------------------------------===// + +#ifndef ALLOCINFO_H +#define ALLOCINFO_H + +#include "llvm/Type.h" +#include "llvm/DerivedTypes.h" +#include "llvm/Constants.h" + +/// AllocInfo - Structure representing one instruction's operand's-worth of +/// register allocation state. We create tables made out of these data +/// structures to generate mapping information for this register allocator. +/// +struct AllocInfo { + unsigned Instruction; + unsigned Operand; + unsigned AllocState; + int Placement; + AllocInfo (unsigned Instruction_, unsigned Operand_, + unsigned AllocState_, int Placement_) : + Instruction (Instruction_), Operand (Operand_), + AllocState (AllocState_), Placement (Placement_) { } + + /// getConstantType - Return a StructType representing an AllocInfo object. + /// + static StructType *getConstantType () { + std::vector TV; + TV.push_back (Type::UIntTy); + TV.push_back (Type::UIntTy); + TV.push_back (Type::UIntTy); + TV.push_back (Type::IntTy); + return StructType::get (TV); + } + + /// toConstant - Convert this AllocInfo into an LLVM Constant of type + /// getConstantType(), and return the Constant. + /// + Constant *toConstant () const { + StructType *ST = getConstantType (); + std::vector CV; + CV.push_back (ConstantUInt::get (Type::UIntTy, Instruction)); + CV.push_back (ConstantUInt::get (Type::UIntTy, Operand)); + CV.push_back (ConstantUInt::get (Type::UIntTy, AllocState)); + CV.push_back (ConstantSInt::get (Type::IntTy, Placement)); + return ConstantStruct::get (ST, CV); + } +}; + +#endif // ALLOCINFO_H -- 2.34.1