1 /**************************************************************************
3 * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **************************************************************************/
58 StorageSoa(llvm::BasicBlock
*block
,
65 std::vector
<llvm::Value
*> load(Argument type
, int idx
, int swizzle
,
66 llvm::Value
*indIdx
=0);
67 void store(Argument type
, int idx
, const std::vector
<llvm::Value
*> &val
,
70 void addImmediate(float *vec
);
71 void declareImmediates();
73 void addAddress(int idx
);
75 llvm::Value
* addrElement(int idx
) const;
77 llvm::ConstantInt
*constantInt(int) const;
79 llvm::Value
*elementPointer(llvm::Value
*ptr
, int index
,
81 llvm::Value
*element(llvm::Value
*ptr
, int index
,
83 llvm::Value
*indirectElementPointer(llvm::Value
*ptr
, llvm::Value
*indIdx
,
85 llvm::Value
*indirectElement(llvm::Value
*ptr
, llvm::Value
*indIdx
,
87 const char *name(const char *prefix
) const;
88 llvm::Value
*alignedArrayLoad(llvm::Value
*val
);
89 llvm::Module
*currentModule() const;
90 llvm::Constant
*createConstGlobalVector(const std::vector
<float> &vec
);
92 std::vector
<llvm::Value
*> inputElement(int idx
, llvm::Value
*indIdx
=0);
93 std::vector
<llvm::Value
*> constElement(int idx
, llvm::Value
*indIdx
=0);
94 std::vector
<llvm::Value
*> outputElement(int idx
, llvm::Value
*indIdx
=0);
95 std::vector
<llvm::Value
*> tempElement(int idx
, llvm::Value
*indIdx
=0);
96 std::vector
<llvm::Value
*> immediateElement(int idx
, llvm::Value
*indIdx
=0);
98 llvm::BasicBlock
*m_block
;
100 llvm::Value
*m_input
;
101 llvm::Value
*m_output
;
102 llvm::Value
*m_consts
;
103 llvm::Value
*m_temps
;
104 llvm::GlobalVariable
*m_immediates
;
106 std::map
<int, llvm::Value
*> m_addresses
;
108 std::vector
<std::vector
<float> > m_immediatesToFlush
;
110 mutable std::map
<int, llvm::ConstantInt
*> m_constInts
;
111 mutable char m_name
[32];