blob: e5fbf05e08083cd420df92a7f78c814d19bbb781 [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(),
22 SPIPSInputAddr(0),
Christian Konigc3c169c2013-03-07 09:03:46 +000023 ShaderType(0) {
24
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}