summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2012-05-24 04:22:05 +0000
committerCraig Topper <craig.topper@gmail.com>2012-05-24 04:22:05 +0000
commite4260f911b80d3047b6ce949b58b5f93cf143951 (patch)
treeaef46fe8f955f340a859ce9a157d59664bc673bb /llvm/lib/Target
parent42b96d1b741c1ff7a3a781851283296e593aedee (diff)
downloadbcm5719-llvm-e4260f911b80d3047b6ce949b58b5f93cf143951.tar.gz
bcm5719-llvm-e4260f911b80d3047b6ce949b58b5f93cf143951.zip
Mark a couple arrays as static and const. Use array_lengthof instead of sizeof/sizeof.
llvm-svn: 157369
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r--llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp2
-rw-r--r--llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp10
2 files changed, 6 insertions, 6 deletions
diff --git a/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp b/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
index f268b4aae40..c2eb894f032 100644
--- a/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
+++ b/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
@@ -490,7 +490,7 @@ NVPTXAsmPrinter::emitVirtualRegister(unsigned int vr, bool isVec,
void NVPTXAsmPrinter::printVecModifiedImmediate(const MachineOperand &MO,
const char *Modifier,
raw_ostream &O) {
-char vecelem[] = {'0', '1', '2', '3', '0', '1', '2', '3'};
+ static const char vecelem[] = {'0', '1', '2', '3', '0', '1', '2', '3'};
int Imm = (int)MO.getImm();
if(0 == strcmp(Modifier, "vecelem"))
O << "_" << vecelem[Imm];
diff --git a/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp b/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
index d326805b22c..d517e8117b7 100644
--- a/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
+++ b/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
@@ -887,10 +887,10 @@ NVPTXTargetLowering::getParamHelpSymbol(SelectionDAG &DAG, int idx) {
// Check to see if the kernel argument is image*_t or sampler_t
bool llvm::isImageOrSamplerVal(const Value *arg, const Module *context) {
- const char *specialTypes[] = {
- "struct._image2d_t",
- "struct._image3d_t",
- "struct._sampler_t"
+ static const char *const specialTypes[] = {
+ "struct._image2d_t",
+ "struct._image3d_t",
+ "struct._sampler_t"
};
const Type *Ty = arg->getType();
@@ -905,7 +905,7 @@ bool llvm::isImageOrSamplerVal(const Value *arg, const Module *context) {
const StructType *STy = dyn_cast<StructType>(PTy->getElementType());
const std::string TypeName = STy ? STy->getName() : "";
- for (int i=0, e=sizeof(specialTypes)/sizeof(specialTypes[0]); i!=e; ++i)
+ for (int i = 0, e = array_lengthof(specialTypes); i != e; ++i)
if (TypeName == specialTypes[i])
return true;
OpenPOWER on IntegriCloud