aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/R600/SIMachineFunctionInfo.cpp
blob: 1a4e4cbbbb019907ed0fe700b02dc190cf36441a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//===-- SIMachineFunctionInfo.cpp - SI Machine Function Info -------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
/// \file
//===----------------------------------------------------------------------===//


#include "SIMachineFunctionInfo.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/Function.h"

using namespace llvm;

const char *SIMachineFunctionInfo::ShaderTypeAttribute = "ShaderType";

SIMachineFunctionInfo::SIMachineFunctionInfo(const MachineFunction &MF)
  : MachineFunctionInfo(),
    ShaderType(0),
    PSInputAddr(0) {

  AttributeSet Set = MF.getFunction()->getAttributes();
  Attribute A = Set.getAttribute(AttributeSet::FunctionIndex,
                                 ShaderTypeAttribute);

  if (A.isStringAttribute()) {
    StringRef Str = A.getValueAsString();
    if (Str.getAsInteger(0, ShaderType))
      llvm_unreachable("Can't parse shader type!");
  }
}