Tom Stellard | f98f2ce | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 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" |
Christian Konig | c3c169c | 2013-03-07 09:03:46 +0000 | [diff] [blame] | 13 | #include "llvm/IR/Attributes.h" |
| 14 | #include "llvm/IR/Function.h" |
Tom Stellard | f98f2ce | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 15 | |
| 16 | using namespace llvm; |
| 17 | |
Christian Konig | c3c169c | 2013-03-07 09:03:46 +0000 | [diff] [blame] | 18 | const char *SIMachineFunctionInfo::ShaderTypeAttribute = "ShaderType"; |
| 19 | |
Tom Stellard | f98f2ce | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 20 | SIMachineFunctionInfo::SIMachineFunctionInfo(const MachineFunction &MF) |
| 21 | : MachineFunctionInfo(), |
Christian Konig | cc22640 | 2013-03-07 09:04:14 +0000 | [diff] [blame] | 22 | ShaderType(0), |
| 23 | PSInputAddr(0) { |
Christian Konig | c3c169c | 2013-03-07 09:03:46 +0000 | [diff] [blame] | 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 | } |