Revert r77654, it appears to be causing llvm-gcc bootstrap failures, and many
[oota-llvm.git] / lib / CodeGen / ShadowStackGC.cpp
index fe843f7250b661ccfd434dbfdc34eed78e2c4a9d..b412532e331037a16e2f8069cd948d2b2e8ffda4 100644 (file)
@@ -188,8 +188,6 @@ ShadowStackGC::ShadowStackGC() : Head(0), StackEntryTy(0) {
 
 Constant *ShadowStackGC::GetFrameMap(Function &F) {
   // doInitialization creates the abstract type of this value.
-  LLVMContext &Context = F.getContext();
-
   Type *VoidPtr = PointerType::getUnqual(Type::Int8Ty);
 
   // Truncate the ShadowStackDescriptor if some metadata is null.
@@ -203,17 +201,17 @@ Constant *ShadowStackGC::GetFrameMap(Function &F) {
   }
 
   Constant *BaseElts[] = {
-    Context.getConstantInt(Type::Int32Ty, Roots.size(), false),
-    Context.getConstantInt(Type::Int32Ty, NumMeta, false),
+    ConstantInt::get(Type::Int32Ty, Roots.size(), false),
+    ConstantInt::get(Type::Int32Ty, NumMeta, false),
   };
 
   Constant *DescriptorElts[] = {
-    Context.getConstantStruct(BaseElts, 2),
-    Context.getConstantArray(Context.getArrayType(VoidPtr, NumMeta),
+    ConstantStruct::get(BaseElts, 2),
+    ConstantArray::get(ArrayType::get(VoidPtr, NumMeta),
                        Metadata.begin(), NumMeta)
   };
 
-  Constant *FrameMap = Context.getConstantStruct(DescriptorElts, 2);
+  Constant *FrameMap = ConstantStruct::get(DescriptorElts, 2);
 
   std::string TypeName("gc_map.");
   TypeName += utostr(NumMeta);
@@ -236,9 +234,9 @@ Constant *ShadowStackGC::GetFrameMap(Function &F) {
                                     GlobalVariable::InternalLinkage,
                                     FrameMap, "__gc_" + F.getName());
 
-  Constant *GEPIndices[2] = { Context.getConstantInt(Type::Int32Ty, 0),
-                              Context.getConstantInt(Type::Int32Ty, 0) };
-  return Context.getConstantExprGetElementPtr(GV, GEPIndices, 2);
+  Constant *GEPIndices[2] = { ConstantInt::get(Type::Int32Ty, 0),
+                              ConstantInt::get(Type::Int32Ty, 0) };
+  return ConstantExpr::getGetElementPtr(GV, GEPIndices, 2);
 }
 
 const Type* ShadowStackGC::GetConcreteStackEntryType(Function &F) {
@@ -342,9 +340,9 @@ void ShadowStackGC::CollectRoots(Function &F) {
 GetElementPtrInst *
 ShadowStackGC::CreateGEP(LLVMContext &Context, IRBuilder<> &B, Value *BasePtr,
                          int Idx, int Idx2, const char *Name) {
-  Value *Indices[] = { Context.getConstantInt(Type::Int32Ty, 0),
-                       Context.getConstantInt(Type::Int32Ty, Idx),
-                       Context.getConstantInt(Type::Int32Ty, Idx2) };
+  Value *Indices[] = { ConstantInt::get(Type::Int32Ty, 0),
+                       ConstantInt::get(Type::Int32Ty, Idx),
+                       ConstantInt::get(Type::Int32Ty, Idx2) };
   Value* Val = B.CreateGEP(BasePtr, Indices, Indices + 3, Name);
 
   assert(isa<GetElementPtrInst>(Val) && "Unexpected folded constant");
@@ -355,8 +353,8 @@ ShadowStackGC::CreateGEP(LLVMContext &Context, IRBuilder<> &B, Value *BasePtr,
 GetElementPtrInst *
 ShadowStackGC::CreateGEP(LLVMContext &Context, IRBuilder<> &B, Value *BasePtr,
                          int Idx, const char *Name) {
-  Value *Indices[] = { Context.getConstantInt(Type::Int32Ty, 0),
-                       Context.getConstantInt(Type::Int32Ty, Idx) };
+  Value *Indices[] = { ConstantInt::get(Type::Int32Ty, 0),
+                       ConstantInt::get(Type::Int32Ty, Idx) };
   Value *Val = B.CreateGEP(BasePtr, Indices, Indices + 2, Name);
 
   assert(isa<GetElementPtrInst>(Val) && "Unexpected folded constant");