[PATCH] D17092: [X86] Add -mseparate-stack-seg

Elena Demikhovsky via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 22 23:12:25 PST 2016


delena added a subscriber: delena.

================
Comment at: lib/CodeGen/TargetInfo.cpp:1569
@@ +1568,3 @@
+    CGF.getTarget().getTargetOpts().Features;
+  if (std::find(TargetFeatures.begin(), TargetFeatures.end(),
+                "+separate-stack-seg") != TargetFeatures.end()) {
----------------
Hi,
I'm not clang reviewer at all and you can ignore my comment.

Searching string looks strange for me. I suppose that this string should be defined in another form. Something like
options::OPT_separate_stack_seg.


================
Comment at: lib/CodeGen/TargetInfo.cpp:1577
@@ +1576,3 @@
+      CGF.Builder.CreatePtrToInt(Addr.getPointer(), CGF.IntPtrTy);
+    llvm::Value *PtrInStackSeg = CGF.Builder.CreateIntToPtr(PtrAsInt,
+                                                   DirectTy->getPointerTo(258));
----------------
You should not use 258 as a constant. It should be defined somewhere as address space enum.

================
Comment at: lib/CodeGen/TargetInfo.cpp:1578
@@ +1577,3 @@
+    llvm::Value *PtrInStackSeg = CGF.Builder.CreateIntToPtr(PtrAsInt,
+                                                   DirectTy->getPointerTo(258));
+    return Address(PtrInStackSeg, Addr.getAlignment());
----------------
This line alignment does not match LLVM style.

================
Comment at: lib/CodeGen/TargetInfo.cpp:1580
@@ +1579,3 @@
+    return Address(PtrInStackSeg, Addr.getAlignment());
+  }
+
----------------
Again, not sure that I'm right. You are trying to create addressspacecast. Is it the right way to create ptrtoint + inttoptr?


http://reviews.llvm.org/D17092





More information about the cfe-commits mailing list