1 //===-- 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" 13 #include "llvm/IR/Attributes.h" 14 #include "llvm/IR/Function.h" 15 16 using namespace llvm; 17 18 const char *SIMachineFunctionInfo::ShaderTypeAttribute = "ShaderType"; 19 20 SIMachineFunctionInfo::SIMachineFunctionInfo(const MachineFunction &MF) 21 : MachineFunctionInfo(), 22 ShaderType(0), 23 PSInputAddr(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 } 35