blob: 1a4e4cbbbb019907ed0fe700b02dc190cf36441a [file] [log] [blame]
Tom Stellardf98f2ce2012-12-11 21:25:42 +00001//===-- SIMachineFunctionInfo.cpp - SI Machine Function Info -------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8/// \file
9//===----------------------------------------------------------------------===//
10
11
12#include "SIMachineFunctionInfo.h"
Christian Konigc3c169c2013-03-07 09:03:46 +000013#include "llvm/IR/Attributes.h"
14#include "llvm/IR/Function.h"
Tom Stellardf98f2ce2012-12-11 21:25:42 +000015
16using namespace llvm;
17
Christian Konigc3c169c2013-03-07 09:03:46 +000018const char *SIMachineFunctionInfo::ShaderTypeAttribute = "ShaderType";
19
Tom Stellardf98f2ce2012-12-11 21:25:42 +000020SIMachineFunctionInfo::SIMachineFunctionInfo(const MachineFunction &MF)
21 : MachineFunctionInfo(),
Christian Konigcc226402013-03-07 09:04:14 +000022 ShaderType(0),
23 PSInputAddr(0) {
Christian Konigc3c169c2013-03-07 09:03:46 +000024
25 AttributeSet Set = MF.getFunction()->getAttributes();
26 Attribute A = Set.getAttribute(AttributeSet::FunctionIndex,
27 ShaderTypeAttribute);
28
29 if (A.isStringAttribute()) {
30 StringRef Str = A.getValueAsString();
31 if (Str.getAsInteger(0, ShaderType))
32 llvm_unreachable("Can't parse shader type!");
33 }
34}